first commit

This commit is contained in:
julien
2025-01-14 17:52:22 +01:00
commit f392a81435
27 changed files with 1094 additions and 0 deletions

View File

@ -0,0 +1,41 @@
{{ define "archive" }}
{{ template "header" .}}
<section>
<h2>{{ L.T "public.archiveTitle" }}</h2>
<ul class="archive">
{{ range $c := .Data.Campaigns }}
<li>
<a href="{{ $c.URL }}">{{ $c.Subject }}</a>
<span class="date">
{{ if $c.SendAt.Valid }}
{{ $c.SendAt.Time.Format "Mon, 02 Jan 2006" }}
{{ else }}
{{ $c.CreatedAt.Time.Format "Mon, 02 Jan 2006" }}
{{ end }}
</span>
</li>
{{ end }}
</ul>
{{ if not .Data.Campaigns }}
{{ L.T "public.archiveEmpty" }}
{{ end }}
{{ if .EnablePublicSubPage }}
<div class="right">
<a href="{{ .RootURL }}/archive.xml">
<img src="{{ .RootURL }}/public/static/rss.svg" alt="RSS" class="feed"
width="16" height="16" />
</a>
<a href="{{ .RootURL }}/subscription/form">{{ L.T "public.sub" }}</a>
</div>
{{ end }}
{{ if gt .Data.TotalPages 1 }}
<div class="pagination">{{ .Data.Pagination }}</div>
{{ end }}
</section>
{{ template "footer" .}}
{{ end }}

View File

@ -0,0 +1,18 @@
{{ define "home" }}
{{ template "header" .}}
<section class="center">
<a href="admin" class="button">{{ L.T "users.login" }}</a>
<div class="home-options">
{{ if .EnablePublicSubPage }}
<a href="{{ .RootURL }}/subscription/form">{{ L.T "public.sub" }}</a>
{{ end }}
{{ if .EnablePublicArchive }}
<a href="{{ .RootURL }}/archive">{{ L.T "public.archiveTitle" }}</a>
{{ end }}
</div>
</section>
{{ template "footer" .}}
{{ end }}

View File

@ -0,0 +1,47 @@
{{ define "header" }}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{ .Data.Title }} - {{ .SiteName }}</title>
<meta name="description" content="{{ .Data.Description }}" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
{{ if .EnablePublicArchive }}
<link rel="alternate" type="application/rss+xml" title="{{ L.T "public.archiveTitle" }} - {{ .SiteName }}"
href="{{ .RootURL }}/archive.xml" />
{{ end }}
<link href="/public/static/style.css?v2.3.0" rel="stylesheet" type="text/css" />
<link href="/public/custom.css" rel="stylesheet" type="text/css">
<script src="/public/custom.js" async defer></script>
{{ if ne .FaviconURL "" }}
<link rel="shortcut icon" href="{{ .FaviconURL }}" type="image/x-icon" />
{{ else }}
<link rel="shortcut icon" href="/public/static/favicon.png" type="image/x-icon" />
{{ end }}
</head>
<body>
<div class="container wrap">
<header class="header">
<div class="logo">
<a href="{{ if .EnablePublicSubPage }}{{ .RootURL}}/subscription/form{{ end }}">
{{ if ne .LogoURL "" }}
<img src="{{ .LogoURL }}" alt="{{ .Data.Title }}" /></a>
{{ else }}
<img src="/public/static/logo.svg" alt="{{ .Data.Title }}" />
{{ end }}
</a>
</div>
</header>
{{ end }}
{{ define "footer" }}
</div>
<footer class="container">
</footer>
</body>
</html>
{{ end }}

View File

@ -0,0 +1,27 @@
{{ define "message" }}
{{ template "header" .}}
<h2>{{ .Data.Title }}</h2>
<div>
{{ .Data.Message }}
</div>
<p>
<a href="" class="button" id="btn-back">{{ L.T "globals.buttons.back" }}</a>
</p>
<script>
(function() {
// If there's page history to go back to, show the back button.
if(history && history.length >= 3) {
var btn = document.getElementById("btn-back");
btn.style.display = 'inline-block';
btn.onclick = function(e) {
history.go(history.length > 2 ? -2 : -1);
e.preventDefault();
};
}
})();
</script>
{{ template "footer" .}}
{{ end }}

View File

@ -0,0 +1,30 @@
{{ define "optin" }}
{{ template "header" .}}
<section>
<h2>{{ L.T "public.confirmSubTitle" }}</h2>
<p>
{{ L.T "public.confirmSubInfo" }}
</p>
<form method="post">
<ul>
{{ range $i, $l := .Data.Lists }}
<input type="hidden" name="l" value="{{ $l.UUID }}" />
{{ if eq $l.Type "public" }}
<li>{{ $l.Name }}</li>
{{ else }}
<li>{{ L.Ts "public.subPrivateList" }}</li>
{{ end }}
{{ end }}
</ul>
<p>
<input type="hidden" name="confirm" value="true" />
<button type="submit" class="button" id="btn-unsub">
{{ L.Ts "public.confirmSub" }}
</button>
</p>
</form>
</section>
{{ template "footer" .}}
{{ end }}

View File

@ -0,0 +1,52 @@
{{ define "subscription-form" }}
{{ template "header" . }}
<section>
<h2>{{ L.T "public.subTitle" }}</h2>
<form method="post" action="" class="form">
<div>
<p>
<label for="email">{{ L.T "subscribers.email" }}</label>
<input id="email" name="email" required="true" type="email" placeholder="{{ L.T "subscribers.email" }}" autofocus="true" >
<input name="nonce" class="nonce" value="" />
</p>
<p>
<label for="name">{{ L.T "public.subName" }}</label>
<input id="name" name="name" type="text" placeholder="{{ L.T "public.subName" }}" >
</p>
<ul class="lists">
<h2>{{ L.T "globals.terms.lists" }}</h2>
{{ range $i, $l := .Data.Lists }}
<li>
<input checked="true" id="l-{{ $l.UUID}}" type="checkbox" name="l" value="{{ $l.UUID }}" >
<label for="l-{{ $l.UUID}}">{{ $l.Name }}</label>
{{ if ne $l.Description "" }}
<p class="description">{{ $l.Description }}</p>
{{ end }}
</li>
{{ end }}
</ul>
{{ if .Data.CaptchaKey }}
<div class="captcha">
<div class="h-captcha" data-sitekey="{{ .Data.CaptchaKey }}"></div>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
</div>
{{ end }}
<p>
<button type="submit" class="button">{{ L.T "public.sub" }}</button>
{{ if .EnablePublicArchive }}
<p class="right">
<a href="{{ .RootURL }}/archive">{{ L.T "public.archiveTitle" }}</a>
</p>
{{ end }}
</p>
</div>
</form>
</section>
{{ template "footer" .}}
{{ end }}

View File

@ -0,0 +1,123 @@
{{ define "subscription" }}
{{ template "header" .}}
<section class="section">
{{ if not .Data.ShowManage }}
<h2>{{ L.T "public.unsubTitle" }}</h2>
<form method="post">
<div>
{{ if .Data.AllowBlocklist }}
<p>{{ L.T "public.unsubHelp" }}</p>
<p>
<input id="privacy-blocklist" type="checkbox" name="blocklist" value="true" />
<label for="privacy-blocklist">{{ L.T "public.unsubFull" }}</label>
</p>
{{ end }}
<p>
<button type="submit" class="button" id="btn-unsub">{{ L.T "public.unsub" }}</button>
</p>
{{ if .Data.AllowPreferences }}
<a href="?manage=true">{{ L.T "public.managePrefs" }}</a>
{{ end }}
</div>
</form>
{{ else }}
<form method="post">
<div>
<input type="hidden" name="manage" value="true" />
<h2>{{ L.T "public.managePrefs" }}</h2>
<label>{{ L.T "globals.fields.name" }}</label>
<input type="text" name="name" value="{{ .Data.Subscriber.Name }}" maxlength="256" required />
{{ if .Data.Subscriptions }}
<br /><br />
<h3>{{ L.T "public.managePrefsUnsub" }}</h3>
<ul class="lists">
{{ range $i, $l := .Data.Subscriptions }}
{{ if ne $l.SubscriptionStatus.Value "unsubscribed" }}
<li>
<input id="l-{{ $l.UUID}}" type="checkbox" name="l" value="{{ $l.UUID }}" checked />
<label for="l-{{ $l.UUID}}">{{ $l.Name }}</label>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
{{ if .Data.AllowBlocklist }}
<p>
<input id="privacy-blocklist" type="checkbox" name="blocklist" value="true" onchange="unsubAll(event)" />
<label for="privacy-blocklist">{{ L.T "public.unsubFull" }}</label>
</p>
{{ end }}
<p>
<button type="submit" class="button" id="btn-unsub">{{ L.T "globals.buttons.save" }}</button>
</p>
</div>
</form>
{{ end }}
</section>
{{ if or .Data.AllowExport .Data.AllowWipe }}
<form id="data-form" method="post" action="" onsubmit="return handleData()">
<section>
<h2>{{ L.T "public.privacyTitle" }}</h2>
{{ if .Data.AllowExport }}
<div class="row">
<input id="privacy-export" type="radio" name="data-action" value="export" required />
<label for="privacy-export"><strong>{{ L.T "public.privacyExport" }}</strong></label>
<br />
{{ L.T "public.privacyExportHelp" }}
</div>
{{ end }}
{{ if .Data.AllowWipe }}
<div class="row">
<input id="privacy-wipe" type="radio" name="data-action" value="wipe" required />
<label for="privacy-wipe"><strong>{{ L.T "public.privacyWipe" }}</strong></label>
<br />
{{ L.T "public.privacyWipeHelp" }}
</div>
{{ end }}
<p>
<input type="submit" value="{{ L.T "globals.buttons.continue" }}" class="button button-outline" />
</p>
</section>
</form>
<script>
function handleData() {
var a = document.querySelector('input[name="data-action"]:checked').value,
f = document.querySelector("#data-form");
if (a == "export") {
f.action = "/subscription/export/{{ .Data.SubUUID }}";
return true;
} else if (confirm("{{ L.T "public.privacyConfirmWipe" }}")) {
f.action = "/subscription/wipe/{{ .Data.SubUUID }}";
return true;
}
return false;
}
function unsubAll(e) {
if (e.target.checked) {
document.querySelector("input[name=name]").disabled = "disabled";
} else {
document.querySelector("input[name=name]").removeAttribute("disabled");
}
document.querySelectorAll('input[type=checkbox][name=l]').forEach(function(l) {
if (e.target.checked) {
l.disabled = "disabled";
} else {
l.removeAttribute("disabled");
}
});
}
</script>
{{ end }}
{{ template "footer" .}}
{{ end }}