source: Klonkt/src/views/pages/admin-settings.ejs@ b79466e

main
Last change on this file since b79466e was 8ef8c3e, checked in by Robin Genis <roboburr@…>, 2 months ago

feat(cirkel): remove the old Cirkels pull-protocol; Cirkels is now AP-only

Phase 4 of the Cirkels-on-AP rework. Removes the legacy custom-Ed25519 pull
protocol and everything around it: /.klonkt/* (federation.js), CircleService +
CircleFederation, the 15-min sync loop, the /admin/circle UI, the remote_posts
union in /cirkel and the /cirkel/:id local-reading page. Tenancy is retired
(getTenancy always 'solo'); the Solo|Circle mode picker is gone. /cirkel is now
purely the auto-boosted (featured) feed. The circle_links/remote_* tables are
kept as dead data. A scripts/migrate-circles.mjs converts existing circle_links
to AP follows with auto-boost (run per instance).

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 13.3 KB
Line 
1<div class="container admin-page">
2 <h1><%= t('aset.title') %></h1>
3 <p><a href="/admin" class="btn">&larr; <%= t('aset.back_admin') %></a></p>
4
5 <% if (success) { %><div class="alert alert-success"><%= success %></div><% } %>
6 <% if (typeof error !== 'undefined' && error) { %><div class="alert alert-error"><%= error %></div><% } %>
7
8 <%# ── Default language for visitors ── %>
9 <section class="set-card" style="margin-top:1rem">
10 <h2><%= t('aset.default_lang') %></h2>
11 <p class="set-help"><%= t('aset.default_lang_hint') %></p>
12 <form method="post" action="/admin/settings" class="set-form">
13 <label class="set-field">
14 <span><%= t('aset.default_lang') %></span>
15 <select name="default_lang">
16 <option value=""<%= !defaultLang ? ' selected' : '' %>><%= t('aset.default_lang_auto') %></option>
17 <% langs.forEach(function(l){ %>
18 <option value="<%= l.code %>"<%= defaultLang === l.code ? ' selected' : '' %>><%= l.name %></option>
19 <% }); %>
20 </select>
21 </label>
22 <button type="submit" class="btn btn-primary"><%= t('aset.save') %></button>
23 </form>
24 </section>
25
26 <%# ── Timezone ── %>
27 <section class="set-card" style="margin-top:1rem">
28 <h2><%= t('aset.timezone') %></h2>
29 <p class="set-help"><%= t('aset.timezone_hint') %></p>
30 <form method="post" action="/admin/settings" class="set-form">
31 <label class="set-field">
32 <span><%= t('aset.timezone') %></span>
33 <select name="timezone">
34 <option value=""<%= !timezone ? ' selected' : '' %>><%= t('aset.timezone_auto') %></option>
35 <%
36 var _tz = ['Europe/Amsterdam','Europe/Brussels','Europe/Berlin','Europe/Paris','Europe/London','Europe/Madrid','Europe/Rome','Europe/Lisbon','Europe/Warsaw','Europe/Athens','UTC','America/New_York','America/Chicago','America/Los_Angeles','America/Sao_Paulo','Asia/Tokyo','Asia/Dubai','Australia/Sydney'];
37 if (timezone && _tz.indexOf(timezone) < 0) _tz.unshift(timezone);
38 %>
39 <% _tz.forEach(function(z){ %><option value="<%= z %>"<%= timezone === z ? ' selected' : '' %>><%= z %></option><% }); %>
40 </select>
41 </label>
42 <button type="submit" class="btn btn-primary"><%= t('aset.save') %></button>
43 </form>
44 </section>
45
46 <%# Mode-specific config — Circle settings below the mode card. (Hub removed.) %>
47
48 <%# Premium (Patreon) — only visible when the self-hoster enables the premium layer
49 (env KLONKT_PREMIUM_ENABLED=on). Hidden by default; nothing gated. %>
50 <% if (premium && premium.enabled) { %>
51 <section class="set-card" style="margin-top:1rem">
52 <h2><%= t('aset.premium') %></h2>
53 <p class="set-help"><%= t('aset.premium_help_1') %> <strong><%= t('aset.premium_lifetime') %></strong> <%= t('aset.premium_help_2') %></p>
54 <% if (premium.premium) { %>
55 <p class="set-help"><strong>✓ <%= t('aset.premium_active') %></strong>
56 <% if (premium.supportCents) { %><%= t('aset.lifetime_support') %> $<%= (premium.supportCents/100).toFixed(2) %>.<% } %></p>
57 <a href="/admin/patreon/disconnect" class="btn"><%= t('aset.patreon_disconnect') %></a>
58 <% } else if (premium.connected) { %>
59 <p class="set-help"><%= t('aset.patreon_no_lifetime') %><% if (premium.supportCents) { %>
60 (<%= t('aset.now') %> $<%= (premium.supportCents/100).toFixed(2) %>)<% } %>. <%= t('aset.patreon_support_again') %></p>
61 <a href="/admin/patreon/connect" class="btn btn-primary"><%= t('aset.patreon_reconnect') %></a>
62 <% } else { %>
63 <p class="set-help"><%= t('aset.patreon_not_connected') %></p>
64 <a href="/admin/patreon/connect" class="btn btn-primary"><%= t('aset.patreon_connect') %></a>
65 <% } %>
66 </section>
67 <% } %>
68
69 <%# Newsletter signup in the footer (premium). %>
70 <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
71 <section class="set-card" style="margin-top:1rem">
72 <h2><%= t('aset.newsletter') %></h2>
73 <p class="set-help"><%= t('aset.newsletter_help_1') %> <strong><%= t('aset.newsletter_footer_field') %></strong> <%= t('aset.newsletter_help_2') %> <code><%= (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '' %>/nieuwsbrief</code>.)</p>
74 <form method="post" action="/admin/settings/footer" class="set-form">
75 <label class="set-toggle" style="display:flex;align-items:center;gap:.6rem;cursor:pointer">
76 <input type="checkbox" name="footer_newsletter" value="1" <%= footerNewsletter ? 'checked' : '' %>>
77 <span><%= t('aset.newsletter_show_footer') %></span>
78 </label>
79 <div class="set-actions"><button type="submit" class="btn btn-primary"><%= t('aset.save') %></button></div>
80 </form>
81 </section>
82 <% } %>
83
84 <%# Fediverse (ActivityPub) on/off. Off = no federation + no fediverse reactions,
85 which (since native comments were removed) means no comments at all. %>
86 <section class="set-card" style="margin-top:1rem">
87 <h2><%= t('aset.fediverse') %></h2>
88 <p class="set-help"><%= t('aset.fediverse_help') %></p>
89 <form method="post" action="/admin/settings/ap" class="set-form">
90 <label class="set-toggle" style="display:flex;align-items:center;gap:.6rem;cursor:pointer">
91 <input type="checkbox" name="ap_enabled" value="1" <%= (typeof apEnabledSetting === 'undefined' || apEnabledSetting) ? 'checked' : '' %>>
92 <span><%= t('aset.fediverse_toggle') %></span>
93 </label>
94 <div class="set-actions"><button type="submit" class="btn btn-primary"><%= t('aset.save') %></button></div>
95 </form>
96 </section>
97
98 <%# E-mail / SMTP — required for sending newsletters, notify-mails and password resets. %>
99 <section class="set-card" style="margin-top:1rem">
100 <h2><%= t('aset.email_smtp') %></h2>
101 <p class="set-help"><%= t('aset.smtp_help_1') %> <strong><%= t('aset.smtp_help_newsletter') %></strong><%= t('aset.smtp_help_2') %> <strong><%= t('aset.smtp_help_notify') %></strong><%= t('aset.smtp_help_3') %>
102 <% if (smtp && smtp.configured) { %><br><strong><%= t('aset.status_set') %>&nbsp;✓</strong><% if (smtp.fromEnv) { %> <small>(<%= t('aset.via_env') %>)</small><% } %><% } else { %><br><%= t('aset.smtp_not_set') %><% } %></p>
103
104 <form method="post" action="/admin/settings/smtp" class="set-form">
105 <label><span><%= t('aset.smtp_host') %></span>
106 <input type="text" name="smtp_host" value="<%= smtp ? smtp.host : '' %>" placeholder="smtp.jouwprovider.nl" autocomplete="off">
107 </label>
108 <label><span><%= t('aset.smtp_port') %> <small style="font-weight:400">— <%= t('aset.smtp_port_hint') %></small></span>
109 <input type="text" name="smtp_port" value="<%= (smtp && smtp.port) ? smtp.port : '' %>" placeholder="587" autocomplete="off" inputmode="numeric">
110 </label>
111 <label><span><%= t('aset.smtp_user') %></span>
112 <input type="text" name="smtp_user" value="<%= smtp ? smtp.user : '' %>" placeholder="jij@jouwprovider.nl" autocomplete="off">
113 </label>
114 <label><span><%= t('aset.smtp_pass') %> <% if (smtp && smtp.passSet) { %><small style="font-weight:400">— <%= t('aset.smtp_pass_set_hint') %></small><% } %></span>
115 <input type="password" name="smtp_pass" placeholder="<%= (smtp && smtp.passSet) ? t('aset.smtp_pass_ph_set') : t('aset.smtp_pass_ph') %>" autocomplete="off">
116 </label>
117 <label><span><%= t('aset.smtp_from') %> <small style="font-weight:400">— <%= t('aset.smtp_from_hint') %></small></span>
118 <input type="text" name="smtp_from" value="<%= smtp ? smtp.from : '' %>" placeholder="<%= t('aset.smtp_from_ph') %>" autocomplete="off">
119 </label>
120 <div class="set-actions">
121 <button type="submit" class="btn btn-primary"><%= t('aset.smtp_save') %></button>
122 <% if (smtp && (smtp.host || smtp.passSet)) { %>
123 <button type="submit" name="clear" value="1" class="btn" formnovalidate><%= t('aset.clear') %></button>
124 <% } %>
125 </div>
126 </form>
127
128 <% if (smtp && smtp.configured) { %>
129 <form method="post" action="/admin/settings/smtp/test" class="set-form" style="margin-top:.8rem">
130 <label><span><%= t('aset.test_mail_to') %></span>
131 <input type="email" name="to" placeholder="jij@email.nl" autocomplete="off">
132 </label>
133 <div class="set-actions"><button type="submit" class="btn">✉ <%= t('aset.send_test_mail') %></button></div>
134 </form>
135 <% } %>
136 </section>
137
138</div>
139
140<style>
141.admin-page { max-width: 700px; margin: 3rem auto; padding: 0 1rem; }
142.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 0.25rem; }
143.admin-tagline { color: var(--ink-muted); margin: 0 0 2rem; }
144.admin-tagline a { color: var(--accent); }
145.set-card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 1.25rem; }
146/* Mode-specific card (Hub/Circle): accent border on the left so it visually
147 belongs to the selected mode, directly below the Mode card. */
148.set-card--mode { border-left: 3px solid var(--accent); }
149.set-card h2 { font-family: var(--font-display, serif); font-size: 1.25rem; margin: 0 0 0.5rem; }
150.set-help { color: var(--ink-muted); font-size: 0.9rem; margin: 0 0 1.25rem; }
151/* Google setup guide (collapsible) */
152.set-google-guide { margin: 0 0 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
153.set-google-guide > summary { cursor: pointer; padding: 0.6rem 0.85rem; font-size: 0.9rem; font-weight: 600; color: var(--accent); list-style: none; }
154.set-google-guide > summary::-webkit-details-marker { display: none; }
155.set-google-guide > summary::before { content: "▸ "; }
156.set-google-guide[open] > summary::before { content: "▾ "; }
157.set-google-steps { margin: 0; padding: 0 1rem 0.6rem 2rem; font-size: 0.88rem; color: var(--ink); line-height: 1.5; }
158.set-google-steps li { margin: 0.35rem 0; }
159.set-google-guide code { background: var(--paper-2); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
160.set-google-guide .set-help { padding: 0 0.85rem; }
161.set-form { display: flex; flex-direction: column; gap: 1rem; max-width: 460px; }
162/* Bare <label>s inside a set-form inherit the same neat stacked style as .set-field:
163 label text on top, input full-width. (.set-toggle = checkbox row, excluded.) */
164.set-form > label:not(.set-toggle):not(.set-opt) { display: flex; flex-direction: column; gap: 0.3rem; }
165.set-form > label:not(.set-toggle):not(.set-opt) > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft, var(--ink-muted)); }
166.set-form > label:not(.set-toggle):not(.set-opt) > span small { font-weight: 400; }
167.set-form > label:not(.set-toggle):not(.set-opt) input {
168 width: 100%; box-sizing: border-box; padding: 0.55rem 0.7rem;
169 border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink);
170 font: inherit; font-size: 0.95rem;
171}
172.set-form > label:not(.set-toggle):not(.set-opt) input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
173.set-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
174.set-opt { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1rem; border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; background: var(--paper); }
175.set-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
176.set-opt input { margin-top: 0.25rem; flex-shrink: 0; }
177.set-opt span { display: flex; flex-direction: column; gap: 0.2rem; }
178.set-opt small { color: var(--ink-muted); font-size: 0.82rem; }
179.set-opt code { background: var(--paper-2); padding: 0.05rem 0.35rem; border-radius: 3px; font-size: 0.85em; }
180.set-form .btn { align-self: flex-start; }
181.set-field { display: flex; flex-direction: column; gap: 0.3rem; }
182.set-field > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft, var(--ink-muted)); }
183.set-field input, .set-field textarea {
184 width: 100%; box-sizing: border-box; padding: 0.55rem 0.7rem;
185 border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink);
186 font: inherit; font-size: 0.95rem;
187}
188.set-field textarea { resize: vertical; }
189.set-field input:focus, .set-field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
190/* Selects styled the same as inputs instead of the bare native dropdown:
191 custom chevron, accent focus ring, full width. */
192.set-form select {
193 appearance: none; -webkit-appearance: none;
194 width: 100%; box-sizing: border-box;
195 padding: 0.55rem 2.2rem 0.55rem 0.7rem;
196 border: 1px solid var(--rule); border-radius: 6px;
197 background-color: var(--paper); color: var(--ink);
198 font: inherit; font-size: 0.95rem; cursor: pointer;
199 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
200 background-repeat: no-repeat; background-position: right 0.7rem center;
201 transition: border-color 0.15s ease, box-shadow 0.15s ease;
202}
203.set-form select:hover { border-color: var(--ink-soft, #888); }
204.set-form select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
205.set-form select option { background: var(--paper); color: var(--ink); }
206.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
207.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
208</style>
Note: See TracBrowser for help on using the repository browser.