From 0e156777c0b257458892d4acd183db76cdf054ea Mon Sep 17 00:00:00 2001 From: ThomasTJdev Date: Mon, 3 Feb 2025 17:29:02 +0100 Subject: [PATCH] Bump --- nimletter.nimble | 2 +- src/database/database_setup.nim | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nimletter.nimble b/nimletter.nimble index 03d4f19..309acc1 100644 --- a/nimletter.nimble +++ b/nimletter.nimble @@ -1,6 +1,6 @@ # Package -version = "0.3.6" +version = "0.3.7" author = "ThomasTJdev" description = "Newsletter" license = "AGPL v3" diff --git a/src/database/database_setup.nim b/src/database/database_setup.nim index 6c0bde2..b25b015 100644 --- a/src/database/database_setup.nim +++ b/src/database/database_setup.nim @@ -44,6 +44,9 @@ proc databaseCreate*() = echo "Error executing SQL: " & sqlItem echo "Got this error code: " & getCurrentExceptionMsg() + if getAllRows(conn, sql("SELECT * FROM mails")).len > 0: + return + exec(conn, sql("INSERT INTO mails (name, identifier, category, contentHTML, contentEditor, subject) VALUES (?, ?, ?, ?, ?, ?);"), "Double Opt-In", "double-opt-in", "template", "

Hi {{ firstname | there }}

We're glad to have you with us at {{ pagename }}!
To finish subscribing to our emails, just click the button below. You can unsubscribe anytime if you change your mind.
", "{ \"root\": { \"type\": \"EmailLayout\", \"data\": { \"backdropColor\": \"#F5F5F5\", \"canvasColor\": \"#FFFFFF\", \"textColor\": \"#262626\", \"fontFamily\": \"MODERN_SANS\", \"childrenIds\": [ \"block-1737229372503\" ] } }, \"block-1737229372503\": { \"type\": \"Container\", \"data\": { \"style\": { \"padding\": { \"top\": 24, \"bottom\": 24, \"right\": 32, \"left\": 32 } }, \"props\": { \"childrenIds\": [ \"block-1737229386674\", \"block-1737229395871\", \"block-1737229536738\", \"block-1737229551815\" ] } } }, \"block-1737229386674\": { \"type\": \"Heading\", \"data\": { \"props\": { \"text\": \"Hi {{ firstname | there }}\" }, \"style\": { \"padding\": { \"top\": 16, \"bottom\": 16, \"right\": 24, \"left\": 24 } } } }, \"block-1737229395871\": { \"type\": \"Text\", \"data\": { \"style\": { \"fontWeight\": \"normal\", \"padding\": { \"top\": 16, \"bottom\": 16, \"right\": 24, \"left\": 24 } }, \"props\": { \"text\": \"We’re glad to have you with us at {{ pagename }}!\" } } }, \"block-1737229536738\": { \"type\": \"Text\", \"data\": { \"style\": { \"fontWeight\": \"normal\", \"padding\": { \"top\": 16, \"bottom\": 16, \"right\": 24, \"left\": 24 } }, \"props\": { \"text\": \"To finish subscribing to our emails, just click the button below. You can unsubscribe anytime if you change your mind.\" } } }, \"block-1737229551815\": { \"type\": \"Button\", \"data\": { \"style\": { \"fontWeight\": \"bold\", \"textAlign\": \"center\", \"padding\": { \"top\": 16, \"bottom\": 16, \"right\": 24, \"left\": 24 } }, \"props\": { \"buttonBackgroundColor\": \"#4F46E5\", \"fullWidth\": true, \"text\": \"Subscribe!\", \"url\": \"{{ hostname }}/subscribe/optin?contactUUID={{ contactUUID }}\" } } } }", "Confirm your email address") exec(conn, sql("INSERT INTO settings (page_name, hostname, optin_email) VALUES (?, ?, ?) ON CONFLICT DO NOTHING;"), "Nimletter, drip it!", "https://nimletter.com", 1)