Changeset 9a00f28 in Klonkt for src/views/pages/paid-gate.ejs


Ignore:
Timestamp:
07/22/2026 08:18:39 AM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
6b5d7da
Parents:
96c714f
git-author:
Robin <roboburr@…> (07/22/2026 08:18:19 AM)
git-committer:
Robin <roboburr@…> (07/22/2026 08:18:39 AM)
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/paid-gate.ejs

    r96c714f r9a00f28  
    1313  <section class="pg-card">
    1414    <div class="pg-lock">💶</div>
    15     <h2 class="pg-h2">Voor supporters</h2>
     15    <h2 class="pg-h2"><%= t('pgate.h') %></h2>
    1616    <p class="pg-sub">
    17       Deze post is voor supporters van deze site
    18       <% if (typeof pgCents !== 'undefined' && pgCents) { %>(vanaf &euro;<%= (pgCents/100).toFixed(2) %> per maand op Patreon)<% } %>.
    19       Word supporter en ontgrendel 'm daarna met een passkey. Geen account op deze site, geen cookie.
     17      <% if (typeof pgCents !== 'undefined' && pgCents) { %><%= t('pgate.sub_cents', { eur: (pgCents/100).toFixed(2) }) %><% } else { %><%= t('pgate.sub') %><% } %>
    2018    </p>
    2119
    2220    <div class="pg-actions">
    2321      <% if (_hasPatron) { %>
    24         <a class="pg-btn" href="<%= pgPatronUrl %>" target="_blank" rel="noopener">Word supporter op Patreon</a>
    25         <button type="button" id="pg-unlock" class="pg-btn pg-btn-ghost">Al supporter? Ontgrendelen</button>
     22        <a class="pg-btn" href="<%= pgPatronUrl %>" target="_blank" rel="noopener"><%= t('pgate.join') %></a>
     23        <button type="button" id="pg-unlock" class="pg-btn pg-btn-ghost"><%= t('pgate.unlock_have') %></button>
    2624      <% } else { %>
    27         <button type="button" id="pg-unlock" class="pg-btn">Ontgrendelen met Patreon</button>
     25        <button type="button" id="pg-unlock" class="pg-btn"><%= t('pgate.unlock') %></button>
    2826      <% } %>
    2927    </div>
     
    3836  var slug = "<%= pgSlug %>";
    3937  var hasPatron = <%= _hasPatron ? 'true' : 'false' %>;
     38  var I = { join: "<%= t('pgate.join_short') %>", confirm: "<%= t('pgate.confirm') %>", failed: "<%= t('pgate.failed') %>", error: "<%= t('pgate.error') %>" };
    4039  var btn = document.getElementById('pg-unlock');
    4140  var status = document.getElementById('pg-status');
     
    4847  if (!window.SimpleWebAuthnBrowser || !window.PublicKeyCredential) {
    4948    if (hasPatron) { btn.style.display = 'none'; }
    50     else { btn.textContent = 'Word supporter'; btn.addEventListener('click', toLink); }
     49    else { btn.textContent = I.join; btn.addEventListener('click', toLink); }
    5150    return;
    5251  }
     
    5453  btn.addEventListener('click', function () {
    5554    btn.disabled = true;
    56     say('Bevestig met je passkey…');
     55    say(I.confirm);
    5756    fetch(base + '/paid/challenge?post=' + encodeURIComponent(slug))
    5857      .then(function (r) { if (!r.ok) throw { link: true }; return r.json(); })
     
    7574          toLink();   // no valid passkey yet (or lapsed tier): link via Patreon
    7675        } else {
    77           btn.disabled = false; say('Ontgrendelen mislukt. Probeer opnieuw.', true);
     76          btn.disabled = false; say(I.failed, true);
    7877        }
    7978      })
     
    8180        if (e && e.link) { toLink(); return; }
    8281        if (e && e.name === 'NotAllowedError') { toLink(); return; }   // cancelled / no passkey -> link
    83         btn.disabled = false; say('Er ging iets mis. Probeer opnieuw.', true);
     82        btn.disabled = false; say(I.error, true);
    8483      });
    8584  });
Note: See TracChangeset for help on using the changeset viewer.