source: Klonkt/src/views/pages/admin-paid.ejs@ 9a00f28

main
Last change on this file since 9a00f28 was 9a00f28, checked in by Robin <roboburr@…>, 7 weeks ago

Fix: test feedback round, cirkels tagline + report details + full i18n

Three findings from Bart's test pass, tied together by the new i18n keys:

  1. The admin tagline said "Solo mode" even with Cirkels (federation) on. Solo-tenancy now distinguishes: apEnabled -> "Cirkels-modus: jouw site, verbonden met de fediverse", else the solo line. New key in nl/en/de.
  1. Reports only showed who reported; now they show the reason and WHICH post. getNotifications resolves the stored objects URIs of a report: our own /ap/notes/<id> become "Over de post: <title>" links under the description; an empty reason renders "Geen reden opgegeven". Other URIs (the actor itself) are skipped, the row already names the account.
  1. Notificaties and Betaalde posts were hardcoded Dutch on an English-configured Klonkt. Everything now goes through t(): the two admin pages (including their client-side status strings, passed via the JSON data block), the admin menu buttons, and the visitor-facing paid pages (gate, passkey, result). Server-side push payloads translate too, using the SITE's content language (fallback KLONKT_DEFAULT_LANG), and the test ping uses the request language. Full nl/en/de dictionaries.

Changed files:
src/services/i18n.js

  • admin.tagline_cirkels, admin.b_paid/b_push/back, notif.report_about/ report_noreason, and the push.*, apaid.*, pgate.*, ppk.*, pres.* blocks in nl/en/de

src/routes/admin.js, src/views/pages/admin.ejs

  • circlesOn (apEnabled) -> cirkels tagline; menu buttons via t()

src/services/ActivityPubService.js

  • report objects resolved to post links; push payloads via i18nT with pushLang(slug) (site language)

src/views/pages/fedi-notifications.ejs

  • report reason fallback + "Over de post" links (+ styles)

src/routes/admin-push.js, src/views/pages/admin-push.ejs

  • pageTitleKey push.t; all copy + JS status strings via t()

src/routes/admin-paid.js, src/views/pages/admin-paid.ejs

  • pageTitleKey apaid.t; all copy via t(), copy-button label via data-attr

src/routes/paid.js

  • pageTitleKey pres.t / ppk.t

src/views/pages/paid-gate.ejs, paid-passkey.ejs, paid-result.ejs

  • visitor copy + JS strings via t()

src/routes/push.js

  • test notification via resolveLang(req)

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

  • Property mode set to 100644
File size: 4.6 KB
Line 
1<div class="container" style="max-width:640px;margin:1.5rem auto 3rem;padding:0 1rem">
2 <h1 style="margin:0 0 .3rem"><%= t('apaid.t') %></h1>
3 <p style="color:var(--ink-soft,#888);margin:0 0 1.2rem">
4 <%= t('apaid.intro') %>
5 </p>
6
7 <% if (saved) { %><p style="color:var(--accent);font-weight:600"><%= t('apaid.saved') %></p><% } %>
8 <% if (error) { %><p style="color:#c0392b"><%= error %></p><% } %>
9 <% if (!secretReady) { %>
10 <p style="color:#c0392b"><%= t('apaid.nokey') %></p>
11 <% } %>
12
13 <p style="margin:.2rem 0 1.2rem">
14 <%= t('apaid.status') %>
15 <% if (status.connected) { %>
16 <strong style="color:var(--accent)"><%= t('apaid.connected') %></strong> (<%= t('apaid.campaign') %> <%= status.campaignId %>)
17 <% } else if (status.configured) { %>
18 <strong><%= t('apaid.configured') %></strong>
19 <% } else { %>
20 <strong><%= t('apaid.notyet') %></strong>
21 <% } %>
22 </p>
23
24 <div style="border:1px solid var(--border,#333);border-radius:10px;padding:.9rem 1rem;margin:0 0 1.3rem;background:color-mix(in srgb,var(--accent,#6b8f71) 8%,transparent)">
25 <p style="margin:0 0 .4rem;font-weight:600"><%= t('apaid.redirect_h') %></p>
26 <p style="margin:0 0 .6rem;color:var(--ink-soft,#888);font-size:.9rem">
27 <%= t('apaid.redirect_p') %>
28 </p>
29 <div style="display:flex;gap:.5rem;align-items:center">
30 <input id="pd-redirect" type="text" readonly value="<%= redirectUri %>" style="flex:1;min-width:0;font-family:monospace;font-size:.9rem">
31 <button type="button" id="pd-copy" class="btn" data-copied="<%= t('apaid.copied') %>"><%= t('apaid.copy') %></button>
32 </div>
33 </div>
34
35 <form method="post" action="/admin/paid" style="display:flex;flex-direction:column;gap:.9rem">
36 <label><%= t('apaid.client_id') %>
37 <input type="text" name="client_id" value="<%= status.clientId || '' %>" autocomplete="off" style="width:100%">
38 </label>
39 <label><%= t('apaid.client_secret') %>
40 <input type="password" name="client_secret" placeholder="<%= status.hasSecret ? t('apaid.unchanged') : '' %>" autocomplete="off" style="width:100%">
41 <small style="color:var(--ink-soft,#888)"><%= t('apaid.keep') %></small>
42 </label>
43 <label><%= t('apaid.campaign_id') %>
44 <input type="text" name="campaign_id" value="<%= status.campaignId || '' %>" autocomplete="off" style="width:100%">
45 </label>
46 <label><%= t('apaid.public_page') %>
47 <input type="url" name="patreon_url" value="<%= status.patreonUrl || '' %>" placeholder="https://www.patreon.com/jouwnaam" autocomplete="off" style="width:100%">
48 <small style="color:var(--ink-soft,#888)"><%= t('apaid.public_help') %></small>
49 </label>
50 <label><%= t('apaid.access') %>
51 <input type="password" name="access_token" placeholder="<%= t('apaid.unchanged') %>" autocomplete="off" style="width:100%">
52 </label>
53 <label><%= t('apaid.refresh') %>
54 <input type="password" name="refresh_token" placeholder="<%= t('apaid.unchanged') %>" autocomplete="off" style="width:100%">
55 <small style="color:var(--ink-soft,#888)"><%= t('apaid.token_help') %></small>
56 </label>
57 <label><%= t('apaid.min_eur') %>
58 <input type="text" name="default_min_eur" value="<%= status.defaultMinCents ? (status.defaultMinCents/100).toFixed(2) : '' %>" inputmode="decimal" style="width:120px">
59 </label>
60 <div style="display:flex;gap:.6rem;align-items:center">
61 <button type="submit" class="btn btn-primary"><%= t('apaid.save') %></button>
62 </div>
63 </form>
64
65 <% if (status.configured || status.connected) { %>
66 <form method="post" action="/admin/paid/disconnect" data-confirm="<%= t('apaid.disconnect_confirm') %>" style="margin-top:1rem">
67 <button type="submit" class="btn btn-danger"><%= t('apaid.disconnect') %></button>
68 </form>
69 <% } %>
70
71 <p style="margin-top:1.5rem"><a href="/admin">&larr; <%= t('admin.back') %></a></p>
72</div>
73
74<script>
75(function () {
76 var field = document.getElementById('pd-redirect');
77 var btn = document.getElementById('pd-copy');
78 if (!field || !btn) return;
79 field.addEventListener('focus', function () { field.select(); });
80 btn.addEventListener('click', function () {
81 field.select();
82 var done = function () { var t = btn.textContent; btn.textContent = document.getElementById('pd-copy').getAttribute('data-copied'); setTimeout(function () { btn.textContent = t; }, 1400); };
83 if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(field.value).then(done, function () { try { document.execCommand('copy'); done(); } catch (e) {} }); }
84 else { try { document.execCommand('copy'); done(); } catch (e) {} }
85 });
86})();
87</script>
Note: See TracBrowser for help on using the repository browser.