Changeset 9a00f28 in Klonkt for src/views/pages


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

Location:
src/views/pages
Files:
7 edited

Legend:

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

    r96c714f r9a00f28  
    11<div class="container" style="max-width:640px;margin:1.5rem auto 3rem;padding:0 1rem">
    2   <h1 style="margin:0 0 .3rem">Betaalde posts</h1>
     2  <h1 style="margin:0 0 .3rem"><%= t('apaid.t') %></h1>
    33  <p style="color:var(--ink-soft,#888);margin:0 0 1.2rem">
    4     Koppel je eigen Patreon-campagne. Supporters ontgrendelen betaalde posts met een passkey,
    5     zonder account en zonder cookie. Wij bewaren geen namen of e-mailadressen van supporters,
    6     alleen het versleutelde token van jouw campagne.
     4    <%= t('apaid.intro') %>
    75  </p>
    86
    9   <% if (saved) { %><p style="color:var(--accent);font-weight:600">Opgeslagen.</p><% } %>
     7  <% if (saved) { %><p style="color:var(--accent);font-weight:600"><%= t('apaid.saved') %></p><% } %>
    108  <% if (error) { %><p style="color:#c0392b"><%= error %></p><% } %>
    119  <% if (!secretReady) { %>
    12     <p style="color:#c0392b">Let op: de encryptiesleutel kon niet worden aangemaakt of gelezen (schrijfrechten op de opslagmap?). Zonder sleutel kunnen secrets niet veilig worden opgeslagen.</p>
     10    <p style="color:#c0392b"><%= t('apaid.nokey') %></p>
    1311  <% } %>
    1412
    1513  <p style="margin:.2rem 0 1.2rem">
    16     Status:
     14    <%= t('apaid.status') %>
    1715    <% if (status.connected) { %>
    18       <strong style="color:var(--accent)">verbonden</strong> (campagne <%= status.campaignId %>)
     16      <strong style="color:var(--accent)"><%= t('apaid.connected') %></strong> (<%= t('apaid.campaign') %> <%= status.campaignId %>)
    1917    <% } else if (status.configured) { %>
    20       <strong>ingesteld, nog niet verbonden</strong> (vul een token in)
     18      <strong><%= t('apaid.configured') %></strong>
    2119    <% } else { %>
    22       <strong>nog niet ingesteld</strong>
     20      <strong><%= t('apaid.notyet') %></strong>
    2321    <% } %>
    2422  </p>
    2523
    2624  <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)">
    27     <p style="margin:0 0 .4rem;font-weight:600">Zet deze redirect-URI in je Patreon-client</p>
     25    <p style="margin:0 0 .4rem;font-weight:600"><%= t('apaid.redirect_h') %></p>
    2826    <p style="margin:0 0 .6rem;color:var(--ink-soft,#888);font-size:.9rem">
    29       Bij je Patreon API-client, onder <em>Redirect URIs</em>, moet exact deze regel staan.
    30       Klopt hij niet, dan geeft Patreon een foutmelding in plaats van je supporters terug te sturen.
     27      <%= t('apaid.redirect_p') %>
    3128    </p>
    3229    <div style="display:flex;gap:.5rem;align-items:center">
    3330      <input id="pd-redirect" type="text" readonly value="<%= redirectUri %>" style="flex:1;min-width:0;font-family:monospace;font-size:.9rem">
    34       <button type="button" id="pd-copy" class="btn">Kopieer</button>
     31      <button type="button" id="pd-copy" class="btn" data-copied="<%= t('apaid.copied') %>"><%= t('apaid.copy') %></button>
    3532    </div>
    3633  </div>
    3734
    3835  <form method="post" action="/admin/paid" style="display:flex;flex-direction:column;gap:.9rem">
    39     <label>Patreon client id
     36    <label><%= t('apaid.client_id') %>
    4037      <input type="text" name="client_id" value="<%= status.clientId || '' %>" autocomplete="off" style="width:100%">
    4138    </label>
    42     <label>Patreon client secret
    43       <input type="password" name="client_secret" placeholder="<%= status.hasSecret ? 'blijft ongewijzigd' : '' %>" autocomplete="off" style="width:100%">
    44       <small style="color:var(--ink-soft,#888)">Leeg laten = huidige waarde behouden.</small>
     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>
    4542    </label>
    46     <label>Campagne-id
     43    <label><%= t('apaid.campaign_id') %>
    4744      <input type="text" name="campaign_id" value="<%= status.campaignId || '' %>" autocomplete="off" style="width:100%">
    4845    </label>
    49     <label>Openbare Patreon-pagina
     46    <label><%= t('apaid.public_page') %>
    5047      <input type="url" name="patreon_url" value="<%= status.patreonUrl || '' %>" placeholder="https://www.patreon.com/jouwnaam" autocomplete="off" style="width:100%">
    51       <small style="color:var(--ink-soft,#888)">De link waar bezoekers supporter kunnen worden. Getoond als "Word supporter" wanneer iemand nog niet doneert.</small>
     48      <small style="color:var(--ink-soft,#888)"><%= t('apaid.public_help') %></small>
    5249    </label>
    53     <label>Creator access token
    54       <input type="password" name="access_token" placeholder="blijft ongewijzigd" autocomplete="off" style="width:100%">
     50    <label><%= t('apaid.access') %>
     51      <input type="password" name="access_token" placeholder="<%= t('apaid.unchanged') %>" autocomplete="off" style="width:100%">
    5552    </label>
    56     <label>Creator refresh token
    57       <input type="password" name="refresh_token" placeholder="blijft ongewijzigd" autocomplete="off" style="width:100%">
    58       <small style="color:var(--ink-soft,#888)">De access + refresh token krijg je op je Patreon API-clientpagina. Wij versleutelen ze en verversen automatisch.</small>
     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>
    5956    </label>
    60     <label>Standaard-steunbedrag voor een betaalde post (euro)
     57    <label><%= t('apaid.min_eur') %>
    6158      <input type="text" name="default_min_eur" value="<%= status.defaultMinCents ? (status.defaultMinCents/100).toFixed(2) : '' %>" inputmode="decimal" style="width:120px">
    6259    </label>
    6360    <div style="display:flex;gap:.6rem;align-items:center">
    64       <button type="submit" class="btn btn-primary">Opslaan</button>
     61      <button type="submit" class="btn btn-primary"><%= t('apaid.save') %></button>
    6562    </div>
    6663  </form>
    6764
    6865  <% if (status.configured || status.connected) { %>
    69     <form method="post" action="/admin/paid/disconnect" data-confirm="Patreon-koppeling verwijderen?" style="margin-top:1rem">
    70       <button type="submit" class="btn btn-danger">Koppeling verwijderen</button>
     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>
    7168    </form>
    7269  <% } %>
    7370
    74   <p style="margin-top:1.5rem"><a href="/admin">&larr; Terug naar Beheer</a></p>
     71  <p style="margin-top:1.5rem"><a href="/admin">&larr; <%= t('admin.back') %></a></p>
    7572</div>
    7673
     
    8380  btn.addEventListener('click', function () {
    8481    field.select();
    85     var done = function () { var t = btn.textContent; btn.textContent = 'Gekopieerd'; setTimeout(function () { btn.textContent = t; }, 1400); };
     82    var done = function () { var t = btn.textContent; btn.textContent = document.getElementById('pd-copy').getAttribute('data-copied'); setTimeout(function () { btn.textContent = t; }, 1400); };
    8683    if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(field.value).then(done, function () { try { document.execCommand('copy'); done(); } catch (e) {} }); }
    8784    else { try { document.execCommand('copy'); done(); } catch (e) {} }
  • src/views/pages/admin-push.ejs

    r96c714f r9a00f28  
    11<div class="container" style="max-width:640px;margin:1.5rem auto 3rem;padding:0 1rem">
    2   <h1 style="margin:0 0 .3rem">Notificaties</h1>
     2  <h1 style="margin:0 0 .3rem"><%= t('push.t') %></h1>
    33  <p style="color:var(--ink-soft,#888);margin:0 0 1.2rem">
    4     Krijg een melding op dit apparaat bij nieuwe volgers, reacties en berichten,
    5     ook als de site niet open staat. Versleuteld tot in je browser; wij sturen zo
    6     min mogelijk inhoud mee.
     4    <%= t('push.intro') %>
    75  </p>
    86
    97  <% if (!vapidKey) { %>
    10     <p style="color:#c0392b">Push is op deze server niet beschikbaar (sleutel kon niet worden aangemaakt of de dependency ontbreekt).</p>
     8    <p style="color:#c0392b"><%= t('push.unavailable') %></p>
    119  <% } else { %>
    1210
    1311  <div id="np-unsupported" hidden style="color:#c0392b;margin:0 0 1rem">
    14     Deze browser ondersteunt geen push-notificaties.
     12    <%= t('push.unsupported') %>
    1513  </div>
    1614  <div id="np-ios-hint" hidden style="border:1px solid var(--border,#333);border-radius:10px;padding:.8rem 1rem;margin:0 0 1rem;font-size:.92rem;color:var(--ink-soft,#888)">
    17     Op iPhone/iPad werkt dit alleen als de site op je beginscherm staat:
    18     deel-knop → <em>Zet op beginscherm</em>, en open 'm daarna vanaf daar.
     15    <%= t('push.ios_hint') %>
    1916  </div>
    2017
    2118  <section style="border:1px solid var(--border,#333);border-radius:12px;padding:1rem 1.1rem;margin:0 0 1.2rem">
    22     <p style="margin:0 0 .6rem"><strong>Dit apparaat:</strong> <span id="np-state">controleren…</span></p>
     19    <p style="margin:0 0 .6rem"><strong><%= t('push.this_device') %></strong> <span id="np-state"><%= t('push.checking') %></span></p>
    2320    <div style="display:flex;gap:.6rem;flex-wrap:wrap">
    24       <button type="button" id="np-on" class="btn btn-primary" hidden>Zet aan op dit apparaat</button>
    25       <button type="button" id="np-off" class="btn" hidden>Zet uit</button>
    26       <button type="button" id="np-test" class="btn" hidden>Stuur testmelding</button>
     21      <button type="button" id="np-on" class="btn btn-primary" hidden><%= t('push.enable') %></button>
     22      <button type="button" id="np-off" class="btn" hidden><%= t('push.disable') %></button>
     23      <button type="button" id="np-test" class="btn" hidden><%= t('push.test') %></button>
    2724    </div>
    2825    <fieldset id="np-alerts" hidden style="border:none;padding:0;margin:1rem 0 0">
    29       <legend style="font-weight:600;margin-bottom:.4rem">Waarvoor wil je een melding?</legend>
    30       <label style="display:block"><input type="checkbox" data-alert="follow"> Nieuwe volger</label>
    31       <label style="display:block"><input type="checkbox" data-alert="reply"> Reactie of vermelding</label>
    32       <label style="display:block"><input type="checkbox" data-alert="like"> Waardering (ster)</label>
    33       <label style="display:block"><input type="checkbox" data-alert="boost"> Boost</label>
    34       <label style="display:block"><input type="checkbox" data-alert="dm"> Priv&eacute;bericht</label>
    35       <p id="np-saved" hidden style="color:var(--accent);margin:.4rem 0 0">Opgeslagen.</p>
     26      <legend style="font-weight:600;margin-bottom:.4rem"><%= t('push.what') %></legend>
     27      <label style="display:block"><input type="checkbox" data-alert="follow"> <%= t('push.a_follow') %></label>
     28      <label style="display:block"><input type="checkbox" data-alert="reply"> <%= t('push.a_reply') %></label>
     29      <label style="display:block"><input type="checkbox" data-alert="like"> <%= t('push.a_like') %></label>
     30      <label style="display:block"><input type="checkbox" data-alert="boost"> <%= t('push.a_boost') %></label>
     31      <label style="display:block"><input type="checkbox" data-alert="dm"> <%= t('push.a_dm') %></label>
     32      <p id="np-saved" hidden style="color:var(--accent);margin:.4rem 0 0"><%= t('push.saved') %></p>
    3633    </fieldset>
    3734  </section>
    3835
    3936  <% if (subscriptions.length) { %>
    40     <h2 style="font-size:1.05rem;margin:0 0 .5rem">Gekoppelde apparaten</h2>
     37    <h2 style="font-size:1.05rem;margin:0 0 .5rem"><%= t('push.devices') %></h2>
    4138    <ul style="list-style:none;padding:0;margin:0 0 1.2rem">
    4239      <% subscriptions.forEach(function (s) { %>
    4340        <li data-endpoint="<%= s.endpoint %>" style="display:flex;justify-content:space-between;gap:.8rem;align-items:center;padding:.45rem 0;border-bottom:1px solid var(--border,#2a2a2a)">
    44           <span style="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><%= s.ua_label || 'Apparaat' %> <small style="color:var(--ink-soft,#888)">sinds <%= String(s.created_at || '').slice(0, 10) %></small></span>
    45           <button type="button" class="btn np-remove" data-endpoint="<%= s.endpoint %>">Verwijder</button>
     41          <span style="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><%= s.ua_label || t('push.device') %> <small style="color:var(--ink-soft,#888)"><%= t('push.since') %> <%= String(s.created_at || '').slice(0, 10) %></small></span>
     42          <button type="button" class="btn np-remove" data-endpoint="<%= s.endpoint %>"><%= t('push.remove') %></button>
    4643        </li>
    4744      <% }); %>
     
    5148  <% } %>
    5249
    53   <p style="margin-top:1.5rem"><a href="/admin">&larr; Terug naar Beheer</a></p>
     50  <p style="margin-top:1.5rem"><a href="/admin">&larr; <%= t('admin.back') %></a></p>
    5451</div>
    5552
     
    5956  alerts: defaultAlerts,
    6057  saved: subscriptions.reduce(function (m, s) { try { m[s.endpoint] = JSON.parse(s.alert_types || '{}'); } catch (e) { m[s.endpoint] = {}; } return m; }, {}),
     58  i18n: { on: t('push.state_on'), off: t('push.state_off'), denied: t('push.state_denied'), unknown: t('push.state_unknown'), unsupported: t('push.state_unsupported'), failed: t('push.enable_failed') },
    6159}).replace(/</g, '\\u003c') %></script>
    6260<script>
     
    7472  if (!('serviceWorker' in navigator) || !('PushManager' in window) || !('Notification' in window)) {
    7573    document.getElementById('np-unsupported').hidden = false;
    76     elState.textContent = 'niet ondersteund';
     74    elState.textContent = cfg.i18n.unsupported;
    7775    return;
    7876  }
     
    107105  function render(sub) {
    108106    currentEndpoint = sub ? sub.endpoint : null;
    109     elState.textContent = sub ? 'meldingen staan aan' : (Notification.permission === 'denied' ? 'geblokkeerd in de browserinstellingen' : 'meldingen staan uit');
     107    elState.textContent = sub ? cfg.i18n.on : (Notification.permission === 'denied' ? cfg.i18n.denied : cfg.i18n.off);
    110108    btnOn.hidden = !!sub || Notification.permission === 'denied';
    111109    btnOff.hidden = !sub;
     
    120118    setAlertBoxes((sub && cfg.saved[sub.endpoint]) ? Object.assign({}, cfg.alerts, cfg.saved[sub.endpoint]) : cfg.alerts);
    121119    render(sub);
    122   }).catch(function () { elState.textContent = 'status onbekend'; });
     120  }).catch(function () { elState.textContent = cfg.i18n.unknown; });
    123121
    124122  btnOn.addEventListener('click', function () {
     
    131129        return post('/push/subscribe', { subscription: sub.toJSON(), alerts: readAlertBoxes(), uaLabel: deviceLabel() })
    132130          .then(function (r) { if (!r.ok) throw new Error('subscribe failed'); render(sub); location.reload(); });
    133       }).catch(function () { btnOn.disabled = false; elState.textContent = 'aanzetten mislukt'; });
     131      }).catch(function () { btnOn.disabled = false; elState.textContent = cfg.i18n.failed; });
    134132    });
    135133  });
  • src/views/pages/admin.ejs

    r96c714f r9a00f28  
    1919  <% if (tenancy === 'hub') { %>
    2020    <p class="admin-tagline"><%= t('admin.tagline_hub') %></p>
     21  <% } else if (typeof circlesOn !== 'undefined' && circlesOn) { %>
     22    <p class="admin-tagline"><%= t('admin.tagline_cirkels') %></p>
    2123  <% } else { %>
    2224    <p class="admin-tagline"><%= t('admin.tagline_solo') %></p>
     
    4648    <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
    4749      <a href="/admin/stats" class="btn"><%= t('admin.b_stats') %></a>
    48       <a href="/admin/paid" class="btn">Betaalde posts</a>
     50      <a href="/admin/paid" class="btn"><%= t('admin.b_paid') %></a>
    4951      <a href="/admin/newsletter" class="btn"><%= t('admin.b_newsletter') %></a>
    5052      <% if (tenancy !== 'hub' && primarySite) { %><a href="/pers" class="btn" target="_blank"><%= t('admin.b_perskit') %></a><% } %>
     
    5557    <%# Fediverse pages (News / Notifications / My replies / Blocking) are reached via the
    5658        "Fediverse" nav button + the bell + the tabbed section — not duplicated here. %>
    57     <a href="/admin/push" class="btn">Notificaties</a>
     59    <a href="/admin/push" class="btn"><%= t('admin.b_push') %></a>
    5860    <a href="/admin/updates" class="btn"><%= t('admin.b_updates') %></a>
    5961    <a href="/admin/handleiding" class="btn"><%= t('admin.b_help') %></a>
  • src/views/pages/fedi-notifications.ejs

    r96c714f r9a00f28  
    3434              <% if (n.type === 'mention' && n.note_url) { %><a class="nt-post" href="<%= n.note_url %>" target="_blank" rel="nofollow noopener"><%= t('tl.view_original') %></a><% } %>
    3535            </div>
    36             <% if (n.type === 'report' && n.content) { %><div class="nt-content"><%= n.content %></div>
     36            <% if (n.type === 'report') { %>
     37              <% if (n.content) { %><div class="nt-content"><%= n.content %></div><% } else { %><div class="nt-content nt-noreason"><%= t('notif.report_noreason') %></div><% } %>
     38              <% if (n.objects && n.objects.length) { %>
     39                <div class="nt-report-about">
     40                  <% n.objects.forEach(function (o) { %>
     41                    <a class="nt-post" href="/<%= o.slug %>"><%= t('notif.report_about') %>: <%= o.title %></a>
     42                  <% }); %>
     43                </div>
     44              <% } %>
    3745            <% } else if ((n.type === 'reply' || n.type === 'mention') && n.content) { %><div class="nt-content"><%- n.content %></div><% } %>
    3846          </div>
     
    5866    display: inline-flex; align-items: center; justify-content: center; }
    5967  .nt-icon svg { width: 18px; height: 18px; }
     68  .nt-report-about { margin-top: .35rem; display: flex; flex-direction: column; gap: .15rem; }
     69  .nt-noreason { font-style: italic; opacity: .7; }
    6070  .nt-like .nt-icon { background: color-mix(in srgb, #e8b04b 16%, transparent); color: #e8b04b; }
    6171  .nt-boost .nt-icon { background: color-mix(in srgb, #2fa85a 16%, transparent); color: #2fa85a; }
  • 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  });
  • 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})();
  • src/views/pages/paid-result.ejs

    r96c714f r9a00f28  
    88    <div class="pr-ic">🔒</div>
    99    <% if (reason === 'notpatron') { %>
    10       <h1 class="pr-h1">Nog geen supporter</h1>
    11       <p class="pr-sub">Je bent (nog) geen actieve supporter van deze site op Patreon. Word supporter en probeer het daarna opnieuw vanaf de post.</p>
     10      <h1 class="pr-h1"><%= t('pres.notpatron_h') %></h1>
     11      <p class="pr-sub"><%= t('pres.notpatron_p') %></p>
    1212    <% } else if (reason === 'tier') { %>
    13       <h1 class="pr-h1">Een niveau hoger nodig</h1>
    14       <p class="pr-sub">
    15         Deze post vraagt vanaf &euro;<%= ((typeof neededCents !== 'undefined' ? neededCents : 0)/100).toFixed(2) %>.
    16         Jouw steun is nu &euro;<%= ((typeof haveCents !== 'undefined' ? haveCents : 0)/100).toFixed(2) %>. Verhoog je steun en probeer opnieuw.
    17       </p>
     13      <h1 class="pr-h1"><%= t('pres.tier_h') %></h1>
     14      <p class="pr-sub"><%= t('pres.tier_p', { need: ((typeof neededCents !== 'undefined' ? neededCents : 0)/100).toFixed(2), have: ((typeof haveCents !== 'undefined' ? haveCents : 0)/100).toFixed(2) }) %></p>
    1815    <% } else if (reason === 'expired') { %>
    19       <h1 class="pr-h1">Aanvraag verlopen</h1>
    20       <p class="pr-sub">Deze ontgrendel-link is verlopen of al gebruikt. Ga terug naar de post en probeer het opnieuw.</p>
     16      <h1 class="pr-h1"><%= t('pres.expired_h') %></h1>
     17      <p class="pr-sub"><%= t('pres.expired_p') %></p>
    2118    <% } else { %>
    22       <h1 class="pr-h1">Ontgrendelen afgebroken</h1>
    23       <p class="pr-sub">Er is niets gekoppeld. Je kunt het opnieuw proberen vanaf de post.</p>
     19      <h1 class="pr-h1"><%= t('pres.declined_h') %></h1>
     20      <p class="pr-sub"><%= t('pres.declined_p') %></p>
    2421    <% } %>
    2522
    2623    <div class="pr-actions">
    2724      <% if ((reason === 'notpatron' || reason === 'tier') && _patron) { %>
    28         <a class="pr-btn" href="<%= _patron %>" target="_blank" rel="noopener">Word supporter op Patreon</a>
     25        <a class="pr-btn" href="<%= _patron %>" target="_blank" rel="noopener"><%= t('pres.join') %></a>
    2926      <% } %>
    3027      <% if (_slug) { %>
    31         <a class="pr-btn pr-btn-ghost" href="<%= _base %>/<%= _slug %>">Terug naar de post</a>
     28        <a class="pr-btn pr-btn-ghost" href="<%= _base %>/<%= _slug %>"><%= t('pres.back_post') %></a>
    3229      <% } else { %>
    33         <a class="pr-btn pr-btn-ghost" href="<%= _base %>/">Terug naar de site</a>
     30        <a class="pr-btn pr-btn-ghost" href="<%= _base %>/"><%= t('pres.back_site') %></a>
    3431      <% } %>
    3532    </div>
Note: See TracChangeset for help on using the changeset viewer.