Changeset 9a00f28 in Klonkt for src/views/pages/paid-passkey.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-passkey.ejs

    r96c714f r9a00f28  
    22  <div class="pk-card">
    33    <div class="pk-ic">🔑</div>
    4     <h1 class="pk-h1">Je bent supporter, mooi.</h1>
     4    <h1 class="pk-h1"><%= t('ppk.h') %></h1>
    55    <p class="pk-sub">
    6       Maak nu een passkey aan. Die wordt je sleutel voor betaalde posts, zonder
    7       account en zonder cookie. We bewaren geen naam of e-mailadres.
     6      <%= t('ppk.sub') %>
    87    </p>
    9     <button type="button" id="pk-go" class="pk-btn">Maak passkey</button>
     8    <button type="button" id="pk-go" class="pk-btn"><%= t('ppk.make') %></button>
    109    <p id="pk-status" class="pk-status" hidden></p>
    1110  </div>
     
    1716  var options = <%- optionsJson %>;
    1817  var blob = "<%= regBlob %>";
     18  var I = { unsupported: "<%= t('ppk.unsupported') %>", follow: "<%= t('ppk.follow') %>", done: "<%= t('ppk.done') %>", failed: "<%= t('ppk.failed') %>", cancelled: "<%= t('ppk.cancelled') %>", error: "<%= t('pgate.error') %>" };
    1919  var postUrl = "<%= (typeof siteUrlBase !== 'undefined' && siteUrlBase ? siteUrlBase : '') %>/<%= postSlug %>";
    2020  var btn = document.getElementById('pk-go');
     
    2424  if (!window.SimpleWebAuthnBrowser || !window.PublicKeyCredential) {
    2525    btn.disabled = true;
    26     say('Passkeys worden niet ondersteund in deze browser.', true);
     26    say(I.unsupported, true);
    2727    return;
    2828  }
    2929  btn.addEventListener('click', function () {
    3030    btn.disabled = true;
    31     say('Volg de vraag van je apparaat…');
     31    say(I.follow);
    3232    window.SimpleWebAuthnBrowser.startRegistration({ optionsJSON: options })
    3333      .then(function (response) {
     
    3939      .then(function (r) { return r.json(); })
    4040      .then(function (j) {
    41         if (j && j.ok) { say('Gelukt. Je passkey is aangemaakt.'); setTimeout(function () { location.href = postUrl; }, 900); }
    42         else { btn.disabled = false; say('Aanmaken mislukt (' + ((j && j.error) || 'onbekend') + '). Probeer opnieuw.', true); }
     41        if (j && j.ok) { say(I.done); setTimeout(function () { location.href = postUrl; }, 900); }
     42        else { btn.disabled = false; say(I.failed.replace('{err}', (j && j.error) || '?'), true); }
    4343      })
    44       .catch(function (e) { btn.disabled = false; say(e && e.name === 'NotAllowedError' ? 'Geannuleerd.' : 'Er ging iets mis. Probeer opnieuw.', true); });
     44      .catch(function (e) { btn.disabled = false; say(e && e.name === 'NotAllowedError' ? I.cancelled : I.error, true); });
    4545  });
    4646})();
Note: See TracChangeset for help on using the changeset viewer.