Skip to content

Commit

Permalink
Add public archive on/off toggle to settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Nov 10, 2022
1 parent f958f3d commit 818f2c9
Show file tree
Hide file tree
Showing 31 changed files with 79 additions and 11 deletions.
13 changes: 9 additions & 4 deletions cmd/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ func initHTTPHandlers(e *echo.Echo, app *App) {
// Public API endpoints.
e.GET("/api/public/lists", handleGetPublicLists)
e.POST("/api/public/subscription", handlePublicSubscription)
e.GET("/api/public/archive", handleGetCampaignArchives)

if app.constants.EnablePublicArchive {
e.GET("/api/public/archive", handleGetCampaignArchives)
}

// /public/static/* file server is registered in initHTTPServer().
// Public subscriber facing views.
Expand All @@ -195,9 +198,11 @@ func initHTTPHandlers(e *echo.Echo, app *App) {
e.GET("/campaign/:campUUID/:subUUID/px.png", noIndex(validateUUID(handleRegisterCampaignView,
"campUUID", "subUUID")))

e.GET("/archive", handleCampaignArchivesPage)
e.GET("/archive.xml", handleGetCampaignArchivesFeed)
e.GET("/archive/:uuid", handleCampaignArchivePage)
if app.constants.EnablePublicArchive {
e.GET("/archive", handleCampaignArchivesPage)
e.GET("/archive.xml", handleGetCampaignArchivesFeed)
e.GET("/archive/:uuid", handleCampaignArchivePage)
}

e.GET("/public/custom.css", serveCustomApperance("public.custom_css"))
e.GET("/public/custom.js", serveCustomApperance("public.custom_js"))
Expand Down
2 changes: 2 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type constants struct {
FromEmail string `koanf:"from_email"`
NotifyEmails []string `koanf:"notify_emails"`
EnablePublicSubPage bool `koanf:"enable_public_subscription_page"`
EnablePublicArchive bool `koanf:"enable_public_archive"`
SendOptinConfirmation bool `koanf:"send_optin_confirmation"`
Lang string `koanf:"lang"`
DBBatchSize int `koanf:"batch_size"`
Expand Down Expand Up @@ -699,6 +700,7 @@ func initHTTPServer(app *App) *echo.Echo {
LogoURL: app.constants.LogoURL,
FaviconURL: app.constants.FaviconURL,
EnablePublicSubPage: app.constants.EnablePublicSubPage,
EnablePublicArchive: app.constants.EnablePublicArchive,
}

// Initialize the static file server.
Expand Down
3 changes: 3 additions & 0 deletions cmd/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type tplRenderer struct {
LogoURL string
FaviconURL string
EnablePublicSubPage bool
EnablePublicArchive bool
}

// tplData is the data container that is injected
Expand All @@ -41,6 +42,7 @@ type tplData struct {
LogoURL string
FaviconURL string
EnablePublicSubPage bool
EnablePublicArchive bool
Data interface{}
L *i18n.I18n
}
Expand Down Expand Up @@ -92,6 +94,7 @@ func (t *tplRenderer) Render(w io.Writer, name string, data interface{}, c echo.
LogoURL: t.LogoURL,
FaviconURL: t.FaviconURL,
EnablePublicSubPage: t.EnablePublicSubPage,
EnablePublicArchive: t.EnablePublicArchive,
Data: data,
L: c.Get("app").(*App).i18n,
})
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/views/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,21 @@

<hr />
<div class="columns">
<div class="column is-6">
<div class="column is-4">
<b-field :label="$t('settings.general.enablePublicSubPage')"
:message="$t('settings.general.enablePublicSubPageHelp')">
<b-switch v-model="data['app.enable_public_subscription_page']"
name="app.enable_public_subscription_page" />
</b-field>
</div>
<div class="column is-6">
<div class="column is-4">
<b-field :label="$t('settings.general.enablePublicArchive')"
:message="$t('settings.general.enablePublicArchiveHelp')">
<b-switch v-model="data['app.enable_public_archive']"
name="app.enable_public_archive" />
</b-field>
</div>
<div class="column is-4">
<b-field :label="$t('settings.general.sendOptinConfirm')"
:message="$t('settings.general.sendOptinConfirmHelp')">
<b-switch v-model="data['app.send_optin_confirmation']"
Expand Down
2 changes: 2 additions & 0 deletions i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@
"settings.general.adminNotifEmailsHelp": "Llista d'adreces de correu electrònic separades per comes a les quals s'han d'enviar notificacions d'administrador, com ara actualitzacions d'importació, finalització de campanya, errors, etc.",
"settings.general.checkUpdates": "Busca actualitzacions",
"settings.general.checkUpdatesHelp": "Comprova periòdicament si hi ha noves versions d'aplicacions i notifica-ho.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Activa la pàgina de subscripció pública",
"settings.general.enablePublicSubPageHelp": "Mostra una pàgina de subscripció pública amb totes les llistes públiques perquè la gent es subscrigui.",
"settings.general.faviconURL": "Favicon URL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/cs-cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Seznam e-mailových adres oddělených čárkami, na které by se měla odeslat oznámení administrátora, jako jsou aktualizace importu, dokončení kampaní, selhání atd.",
"settings.general.checkUpdates": "Kontrola aktualizací",
"settings.general.checkUpdatesHelp": "Pravidelně kontrolovat nová vydání aplikace a upozornit.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Povolit veřejnou stránku odběru",
"settings.general.enablePublicSubPageHelp": "Zobrazit veřejnou stránku odběru se všemi veřejnými seznamy pro lidi k odběru.",
"settings.general.faviconURL": "Adresa URL ikony favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Kommagetrennte Liste von E-Mail Adressen, welche Admin Benachrichtigungen erhalten sollen. Dies können Importupdates, Fertigstellung von Kampagnen, Fehler usw. sein",
"settings.general.checkUpdates": "Suche nach Aktualisierungen",
"settings.general.checkUpdatesHelp": "Prüfe regelmäßig nach Aktualisierungen und benachrichtige mich.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Aktiviere eine öffentliche Abonnement Seite",
"settings.general.enablePublicSubPageHelp": "Zeige eine öffentliche Abonnement Seite mit allen öffentlichen Listen, die Personen abonnieren können.",
"settings.general.faviconURL": "Favicon URL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@
"settings.general.adminNotifEmailsHelp": "Comma separated list of e-mail addresses to which admin notifications such as import updates, campaign completion, failure etc. should be sent.",
"settings.general.checkUpdates": "Check for updates",
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Enable public subscription page",
"settings.general.enablePublicSubPageHelp": "Show a public subscription page with all the public lists for people to subscribe.",
"settings.general.faviconURL": "Favicon URL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Lista de correos electrónicos separados por comas, a donde las notificaciones como actualizaciones de importación, campañas completadas, fallas, etc. deben ser enviadas.",
"settings.general.checkUpdates": "Revisa las actualizaciones",
"settings.general.checkUpdatesHelp": "Periódicamente buscar nuevas actualizaciones y notificarme.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Habilitar pagina publica de subscripción",
"settings.general.enablePublicSubPageHelp": "Muestra una página con todas las listas públicas para subscribirse.",
"settings.general.faviconURL": "URL del Favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Comma separated list of e-mail addresses to which admin notifications such as import updates, campaign completion, failure etc. should be sent.",
"settings.general.checkUpdates": "Check for updates",
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Enable public subscription page",
"settings.general.enablePublicSubPageHelp": "Show a public subscription page with all the public lists for people to subscribe.",
"settings.general.faviconURL": "Favicon URL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Liste d'adresses e-mail (séparées par des virgules) auxquelles les notifications d'admin telles que les mises à jour d'importation, fins de campagnes, échecs, etc. seront envoyées.",
"settings.general.checkUpdates": "Vérifier les mises à jour",
"settings.general.checkUpdatesHelp": "Vérifier régulièrement si de nouvelles applications sont disponibles et notifier-les.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Activer la page d'abonnement publique",
"settings.general.enablePublicSubPageHelp": "Afficher une page d'abonnement publique avec toutes les listes publiques auxquelles les personnes peuvent s'abonner.",
"settings.general.faviconURL": "URL du favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Azon e-mail címek vesszővel elválasztott listája, amelyekre az adminisztrátori értesítéseket kell küldeni, például az importálási frissítésekről, a kampány befejezéséről, a sikertelenségről stb.",
"settings.general.checkUpdates": "Frissítések keresése ",
"settings.general.checkUpdatesHelp": "Rendszeresen ellenőrizze az új alkalmazáskiadásokat, és értesítéseket.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Nyilvános feliratkozási oldal engedélyezése ",
"settings.general.enablePublicSubPageHelp": "Nyilvános feliratkozási oldal megjelenítése az összes nyilvános listával a feliratkozáshoz.",
"settings.general.faviconURL": "Favicon URL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Lista indirizzi mail separati da virgole ai quali saranno inviate notifiche di amministrazione come gli aggiornamenti di importazione, la fine della campagna, eventuali problemi ecc.",
"settings.general.checkUpdates": "Controlla le attualizazioni.",
"settings.general.checkUpdatesHelp": "Rutinariamente controllare se ci sono nuove versioni dell'app e notificami.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Attiva la pagina di iscrizione pubblica",
"settings.general.enablePublicSubPageHelp": "Visualizza una pagina di iscrizione pubblica con tutte le liste pubbliche a cui è possibile iscriversi.",
"settings.general.faviconURL": "URL della favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "インポートの更新、キャンペーンの完了、失敗など管理者通知を送信するメールアドレスのカンマ区切りリスト",
"settings.general.checkUpdates": "アップデートの確認",
"settings.general.checkUpdatesHelp": "定期的に新しいアプリのリリースを確認し、通知する。",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "公開サブスクリプションページを有効にする。",
"settings.general.enablePublicSubPageHelp": "全ての公開リストを含む公開サブスクリプションページを表示し人々が加入できるようにする。",
"settings.general.faviconURL": "ファビコンURL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "ഇംപോർട്ട് ചെയ്തതിലുള്ള വിവരങ്ങൾ, ക്യാമ്പേയ്ൻ പൂർത്തീകരണം, പ്രശ്നങ്ങൾ എന്നിങ്ങനെയുള്ള പ്രധാനപ്പെട്ട കാര്യനിര്‍വ്വാഹകർക്കുള്ള അറിയിപ്പിനായുള്ള കോമാ ഉപയോഗിച്ച് വേർതിരിച്ച ഇ-മെയിൽ വിലാസങ്ങൾ.",
"settings.general.checkUpdates": "Check for updates",
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Enable public subscription page",
"settings.general.enablePublicSubPageHelp": "Show a public subscription page with all the public lists for people to subscribe.",
"settings.general.faviconURL": "ഫാവ് ഐക്കൺ യൂ. ആർ. എൽ",
Expand Down
2 changes: 2 additions & 0 deletions i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Kommagescheiden lijst van e-mailadressen waar admin notificaties zoals importeerupdates, campagne voltooiing, fouten enz. naar moeten worden verzonden.",
"settings.general.checkUpdates": "Controleer op updates",
"settings.general.checkUpdatesHelp": "Controleer regelmatig voor nieuwe app releases en verwittig.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Publieke inschrijvingspagina inschakelen.",
"settings.general.enablePublicSubPageHelp": "Laat een publieke inschrijvingspagina zien met alle publieke lijsten waarmee mensen zich kunnen inschrijven.",
"settings.general.faviconURL": "Favicon URL",
Expand Down
2 changes: 2 additions & 0 deletions i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Lista maili oddzielona przecinkami do adminów, którym przesyłać informacje o importach, zakończonych kampaniach, błędach itd. ",
"settings.general.checkUpdates": "Sprawdź czy są aktualizacje",
"settings.general.checkUpdatesHelp": "Regularnie sprawdzaj czy są aktualizacje i powiadamiaj o tym.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Włącz publiczną stronę subskrypcji",
"settings.general.enablePublicSubPageHelp": "Pokaż publiczną stronę do zapisu na subskrypcje publicznych list.",
"settings.general.faviconURL": "URL Favicony",
Expand Down
2 changes: 2 additions & 0 deletions i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Lista de e-mails separados por vírgula para os quais as notificações de administração, como atualizações de importação, conclusão da campanha, falha, etc. devem ser enviadas.",
"settings.general.checkUpdates": "Verificar atualizações",
"settings.general.checkUpdatesHelp": "Checar periodicamente por notificações e atualizações do app.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Habilitar a página pública de inscrição",
"settings.general.enablePublicSubPageHelp": "Habilitar a página pública de inscrição com todas as listas públicas para as pessoas se inscreverem.",
"settings.general.faviconURL": "URL do Favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Lista separada por vírgulas dos endereços de email para os quais devem ser enviadas notificações de administração como updates importantes, conclusão de campanhas, falhas, etc.",
"settings.general.checkUpdates": "Check for updates",
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Ativar página de subscrição pública",
"settings.general.enablePublicSubPageHelp": "Mostrar uma página de subscrição pública com todas as listas públicas para as pessoas se subscreverem.",
"settings.general.faviconURL": "URL do Favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Lista separată prin virgulă a adreselor de e-mail către care ar trebui trimise notificări de administrator, cum ar fi actualizări de import, finalizarea campaniei, eșec etc.",
"settings.general.checkUpdates": "Verifică actualizări",
"settings.general.checkUpdatesHelp": "Verifică periodic lansările de aplicații noi și notifică.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Activează pagina de abonament public",
"settings.general.enablePublicSubPageHelp": "Afișează o pagină de abonament publică cu toate listele publice pentru ca oamenii să se aboneze.",
"settings.general.faviconURL": "URL favicon",
Expand Down
2 changes: 2 additions & 0 deletions i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@
"settings.general.adminNotifEmailsHelp": "Список адресов электронной почты, разделенных запятыми, на которые следует отправлять уведомления администратора, такие как обновления импорта, завершение кампании, сбой и т.д. ",
"settings.general.checkUpdates": "Проверьте наличие обновлений",
"settings.general.checkUpdatesHelp": "Периодически проверяйте новые выпуски приложений и уведомляйте об этом.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicSubPage": "Включить публичную страницу подписки",
"settings.general.enablePublicSubPageHelp": "Показать страницу общедоступной подписки со всеми общедоступными списками, на которые можно подписаться.",
"settings.general.faviconURL": "URL-адрес фавикона",
Expand Down
Loading

0 comments on commit 818f2c9

Please sign in to comment.