Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Move static assets to 'static' dir

Kailash Nadh709668d811c8
diff --git a/init.go b/init.go
index 769a5791..699f30c4 100644
--- a/init.go
+++ b/init.go
@@ -50,8 +50,10 @@ func initFS() stuffbin.FileSystem {
"config.toml.sample",
"queries.sql",
"schema.sql",
- "email-templates",
- "public",
+ "static/email-templates",
+
+ // Alias /static/public to /public for the HTTP fileserver.
+ "static/public:/public",
// The frontend app's static assets are aliased to /frontend
// so that they are accessible at localhost:port/frontend/static/ ...
@@ -261,7 +263,7 @@ func initNotifTemplates(path string, fs stuffbin.FileSystem, cs *constants) *tem
return cs.LogoURL
}}
- tpl, err := stuffbin.ParseTemplatesGlob(funcs, fs, "/email-templates/*.html")
+ tpl, err := stuffbin.ParseTemplatesGlob(funcs, fs, "/static/email-templates/*.html")
if err != nil {
lo.Fatalf("error parsing e-mail notif templates: %v", err)
}
diff --git a/email-templates/base.html b/static/email-templates/base.html
similarity index 100%
rename from email-templates/base.html
rename to static/email-templates/base.html
diff --git a/email-templates/campaign-status.html b/static/email-templates/campaign-status.html
similarity index 100%
rename from email-templates/campaign-status.html
rename to static/email-templates/campaign-status.html
diff --git a/email-templates/default.tpl b/static/email-templates/default.tpl
similarity index 100%
rename from email-templates/default.tpl
rename to static/email-templates/default.tpl
diff --git a/email-templates/import-status.html b/static/email-templates/import-status.html
similarity index 100%
rename from email-templates/import-status.html
rename to static/email-templates/import-status.html
diff --git a/email-templates/subscriber-data.html b/static/email-templates/subscriber-data.html
similarity index 100%
rename from email-templates/subscriber-data.html
rename to static/email-templates/subscriber-data.html
diff --git a/email-templates/subscriber-optin-campaign.html b/static/email-templates/subscriber-optin-campaign.html
similarity index 100%
rename from email-templates/subscriber-optin-campaign.html
rename to static/email-templates/subscriber-optin-campaign.html
diff --git a/email-templates/subscriber-optin.html b/static/email-templates/subscriber-optin.html
similarity index 100%
rename from email-templates/subscriber-optin.html
rename to static/email-templates/subscriber-optin.html
diff --git a/static/public/base.html b/static/public/base.html
new file mode 100644
index 00000000..0f478973
--- /dev/null
+++ b/static/public/base.html
@@ -0,0 +1,98 @@
+{{ define "header" }}
+<!doctype html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
+ <base target="_blank">
+
+ <style>
+ body {
+ background-color: #F0F1F3;
+ font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, sans-serif;
+ font-size: 15px;
+ line-height: 26px;
+ margin: 0;
+ color: #444;
+ }
+
+ .wrap {
+ background-color: #fff;
+ padding: 30px;
+ max-width: 525px;
+ margin: 0 auto;
+ border-radius: 5px;
+ }
+
+ .header {
+ border-bottom: 1px solid #eee;
+ padding-bottom: 15px;
+ margin-bottom: 15px;
+ }
+
+ .footer {
+ text-align: center;
+ font-size: 12px;
+ color: #888;
+ }
+ .footer a {
+ color: #888;
+ }
+
+ .gutter {
+ padding: 30px;
+ }
+ .button {
+ background: #7f2aff;
+ color: #fff !important;
+ display: inline-block;
+ border-radius: 3px;
+ padding: 10px 30px;
+ text-align: center;
+ text-decoration: none;
+ font-weight: bold;
+ }
+ .button:hover {
+ background: #222;
+ color: #fff;
+ }
+ img {
+ max-width: 100%;
+ }
+
+ a {
+ color: #7f2aff;
+ }
+ a:hover {
+ color: #111;
+ }
+ @media screen and (max-width: 600px) {
+ .wrap {
+ max-width: auto;
+ }
+ .gutter {
+ padding: 10px;
+ }
+ }
+ </style>
+ </head>
+<body style="background-color: #F0F1F3;">
+ <div class="gutter">&nbsp;</div>
+ <div class="wrap">
+ <div class="header">
+ {{ if ne LogoURL "" }}
+ <a href="{{ RootURL }}"><img src="{{ LogoURL }}" alt="listmonk" /></a>
+ {{ end }}
+ </div>
+{{ end }}
+
+{{ define "footer" }}
+ </div>
+
+ <div class="footer">
+ <p>Powered by <a href="https://listmonk.app" target="_blank">listmonk</a></p>
+ </div>
+ <div class="gutter">&nbsp;</div>
+</body>
+</html>
+{{ end }}
diff --git a/static/public/campaign-status.html b/static/public/campaign-status.html
new file mode 100644
index 00000000..d174c02b
--- /dev/null
+++ b/static/public/campaign-status.html
@@ -0,0 +1,25 @@
+{{ define "campaign-status" }}
+{{ template "header" . }}
+<h2>Campaign update</h2>
+<table width="100%">
+ <tr>
+ <td width="30%"><strong>Campaign</strong></td>
+ <td><a href="{{ index . "RootURL" }}/campaigns/{{ index . "ID" }}">{{ index . "Name" }}</a></td>
+ </tr>
+ <tr>
+ <td width="30%"><strong>Status</strong></td>
+ <td>{{ index . "Status" }}</td>
+ </tr>
+ <tr>
+ <td width="30%"><strong>Sent</strong></td>
+ <td>{{ index . "Sent" }} / {{ index . "ToSend" }}</td>
+ </tr>
+ {{ if ne (index . "Reason") "" }}
+ <tr>
+ <td width="30%"><strong>Reason</strong></td>
+ <td>{{ index . "Reason" }}</td>
+ </tr>
+ {{ end }}
+</table>
+{{ template "footer" }}
+{{ end }}
\ No newline at end of file
diff --git a/static/public/default.tpl b/static/public/default.tpl
new file mode 100644
index 00000000..810a42b8
--- /dev/null
+++ b/static/public/default.tpl
@@ -0,0 +1,84 @@
+<!doctype html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
+ <base target="_blank">
+
+ <style>
+ body {
+ background-color: #F0F1F3;
+ font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, sans-serif;
+ font-size: 15px;
+ line-height: 26px;
+ margin: 0;
+ color: #444;
+ }
+
+ .wrap {
+ background-color: #fff;
+ padding: 30px;
+ max-width: 525px;
+ margin: 0 auto;
+ border-radius: 5px;
+ }
+
+ .button {
+ background: #7f2aff;
+ border-radius: 3px;
+ text-decoration: none !important;
+ color: #fff !important;
+ font-weight: bold;
+ padding: 10px 30px;
+ display: inline-block;
+ }
+ .button:hover {
+ background: #111;
+ }
+
+ .footer {
+ text-align: center;
+ font-size: 12px;
+ color: #888;
+ }
+ .footer a {
+ color: #888;
+ }
+
+ .gutter {
+ padding: 30px;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ a {
+ color: #7f2aff;
+ }
+ a:hover {
+ color: #111;
+ }
+ @media screen and (max-width: 600px) {
+ .wrap {
+ max-width: auto;
+ }
+ .gutter {
+ padding: 10px;
+ }
+ }
+ </style>
+ </head>
+<body style="background-color: #F0F1F3;font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, sans-serif;font-size: 15px;line-height: 26px;margin: 0;color: #444;">
+ <div class="gutter" style="padding: 30px;">&nbsp;</div>
+ <div class="wrap" style="background-color: #fff;padding: 30px;max-width: 525px;margin: 0 auto;border-radius: 5px;">
+ {{ template "content" . }}
+ </div>
+
+ <div class="footer" style="text-align: center;font-size: 12px;color: #888;">
+ <p>Don't want to receive these e-mails? <a href="{{ UnsubscribeURL }}" style="color: #888;">Unsubscribe</a></p>
+ <p>Powered by <a href="https://listmonk.app" target="_blank" style="color: #888;">listmonk</a></p>
+ </div>
+ <div class="gutter" style="padding: 30px;">&nbsp;{{ TrackView }}</div>
+</body>
+</html>
diff --git a/static/public/import-status.html b/static/public/import-status.html
new file mode 100644
index 00000000..3fa6e08e
--- /dev/null
+++ b/static/public/import-status.html
@@ -0,0 +1,19 @@
+{{ define "import-status" }}
+{{ template "header" . }}
+<h2>Import update</h2>
+<table width="100%">
+ <tr>
+ <td width="30%"><strong>File</strong></td>
+ <td><a href="{{ RootURL }}/subscribers/import">{{ .Name }}</a></td>
+ </tr>
+ <tr>
+ <td width="30%"><strong>Status</strong></td>
+ <td>{{ .Status }}</td>
+ </tr>
+ <tr>
+ <td width="30%"><strong>Records</strong></td>
+ <td>{{ .Imported }} / {{ .Total }}</td>
+ </tr>
+</table>
+{{ template "footer" }}
+{{ end }}
\ No newline at end of file
diff --git a/public/static/logo.png b/static/public/static/logo.png
similarity index 100%
rename from public/static/logo.png
rename to static/public/static/logo.png
diff --git a/public/static/logo.svg b/static/public/static/logo.svg
similarity index 100%
rename from public/static/logo.svg
rename to static/public/static/logo.svg
diff --git a/public/static/script.js b/static/public/static/script.js
similarity index 100%
rename from public/static/script.js
rename to static/public/static/script.js
diff --git a/public/static/style.css b/static/public/static/style.css
similarity index 100%
rename from public/static/style.css
rename to static/public/static/style.css
diff --git a/static/public/subscriber-data.html b/static/public/subscriber-data.html
new file mode 100644
index 00000000..3873abad
--- /dev/null
+++ b/static/public/subscriber-data.html
@@ -0,0 +1,9 @@
+{{ define "subscriber-data" }}
+{{ template "header" . }}
+<h2>Your data</h2>
+<p>
+ A copy of all data recorded on you is attached as a file in the JSON format.
+ It can be viewed in a text editor.
+</p>
+{{ template "footer" }}
+{{ end }}
diff --git a/static/public/subscriber-optin-campaign.html b/static/public/subscriber-optin-campaign.html
new file mode 100644
index 00000000..fbdaab6d
--- /dev/null
+++ b/static/public/subscriber-optin-campaign.html
@@ -0,0 +1,17 @@
+{{ define "optin-campaign" }}
+
+<p>Hi {{`{{ .Subscriber.FirstName }}`}},</p>
+<p>You have been added to the following mailing lists:</p>
+<ul>
+ {{ range $i, $l := .Lists }}
+ {{ if eq .Type "public" }}
+ <li>{{ .Name }}</li>
+ {{ else }}
+ <li>Private list</li>
+ {{ end }}
+ {{ end }}
+</ul>
+<p>
+ <a class="button" {{ .OptinURLAttr }} class="button">Confirm subscription(s)</a>
+</p>
+{{ end }}
diff --git a/static/public/subscriber-optin.html b/static/public/subscriber-optin.html
new file mode 100644
index 00000000..f81bff37
--- /dev/null
+++ b/static/public/subscriber-optin.html
@@ -0,0 +1,21 @@
+{{ define "subscriber-optin" }}
+{{ template "header" . }}
+<h2>Confirm subscription</h2>
+<p>Hi {{ .Subscriber.FirstName }},</p>
+<p>You have been added to the following mailing lists:</p>
+<ul>
+ {{ range $i, $l := .Lists }}
+ {{ if eq .Type "public" }}
+ <li>{{ .Name }}</li>
+ {{ else }}
+ <li>Private list</li>
+ {{ end }}
+ {{ end }}
+</ul>
+<p>Confirm your subscription by clicking the below button.</p>
+<p>
+ <a href="{{ .OptinURL }}" class="button">Confirm subscription</a>
+</p>
+
+{{ template "footer" }}
+{{ end }}
diff --git a/public/templates/index.html b/static/public/templates/index.html
similarity index 100%
rename from public/templates/index.html
rename to static/public/templates/index.html
diff --git a/public/templates/message.html b/static/public/templates/message.html
similarity index 100%
rename from public/templates/message.html
rename to static/public/templates/message.html
diff --git a/public/templates/optin.html b/static/public/templates/optin.html
similarity index 100%
rename from public/templates/optin.html
rename to static/public/templates/optin.html
diff --git a/public/templates/subscription.html b/static/public/templates/subscription.html
similarity index 100%
rename from public/templates/subscription.html
rename to static/public/templates/subscription.html