Changeset 9a00f28 in Klonkt for src/routes


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/routes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/routes/admin-paid.js

    r96c714f r9a00f28  
    3636  if (!gate(req, res)) return;
    3737  renderPage(req, res, 'pages/admin-paid', {
    38     pageTitle: 'Betaalde posts',
     38    pageTitleKey: 'apaid.t',
    3939    bodyClass: 'on-admin',
    4040    status: PaidPatreon.ownerStatus(res.locals.site.id),
  • src/routes/admin-push.js

    r96c714f r9a00f28  
    1212router.get('/', requireSiteManager, async (req, res) => {
    1313  renderPage(req, res, 'pages/admin-push', {
    14     pageTitle: 'Notificaties',
     14    pageTitleKey: 'push.t',
    1515    bodyClass: 'on-admin',
    1616    vapidKey: await Push.publicKey(),          // null → feature unavailable
  • src/routes/admin.js

    r96c714f r9a00f28  
    99import { renderPage } from '../middleware/render.js';
    1010import { requireAuth } from '../middleware/auth.js';
    11 import { getTenancy } from '../services/SettingsService.js';
     11import { getTenancy, apEnabled } from '../services/SettingsService.js';
    1212import { getPrimarySite } from '../middleware/site.js';
    1313
     
    9696    bodyClass: 'on-admin',
    9797    tenancy,
     98    circlesOn: apEnabled(),   // solo vs cirkels tagline (federatie aan/uit)
    9899    primarySite,
    99100    stats,
  • src/routes/paid.js

    r96c714f r9a00f28  
    5454  if (!payload || payload.purpose !== 'patron' || payload.siteId !== r.site.id) {
    5555    return renderPage(req, res, 'pages/paid-result', {
    56       pageTitle: 'Ontgrendelen', bodyClass: 'on-special', ok: false, reason: 'expired',
     56      pageTitleKey: 'pres.t', bodyClass: 'on-special', ok: false, reason: 'expired',
    5757    });
    5858  }
     
    6060  const code = String(req.query.code || '');
    6161  if (req.query.error || !code) {
    62     return renderPage(req, res, 'pages/paid-result', { pageTitle: 'Ontgrendelen', bodyClass: 'on-special', ok: false, reason: 'declined', postSlug: payload.post, patronUrl });
     62    return renderPage(req, res, 'pages/paid-result', { pageTitleKey: 'pres.t', bodyClass: 'on-special', ok: false, reason: 'declined', postSlug: payload.post, patronUrl });
    6363  }
    6464  const membership = await PaidPatreon.verifyPatron(r.site.id, code, baseUrl(req) + '/paid/callback').catch(() => null);
     
    6767  if (!active || cents < payload.cents) {
    6868    return renderPage(req, res, 'pages/paid-result', {
    69       pageTitle: 'Ontgrendelen', bodyClass: 'on-special', ok: false,
     69      pageTitleKey: 'pres.t', bodyClass: 'on-special', ok: false,
    7070      reason: active ? 'tier' : 'notpatron', neededCents: payload.cents, haveCents: cents, postSlug: payload.post, patronUrl,
    7171    });
     
    7676  const blob = signBlob({ purpose: 'reg', siteId: r.site.id, cents, challenge: options.challenge }, 900);
    7777  renderPage(req, res, 'pages/paid-passkey', {
    78     pageTitle: 'Maak je passkey', bodyClass: 'on-special',
     78    pageTitleKey: 'ppk.t', bodyClass: 'on-special',
    7979    optionsJson: JSON.stringify(options), regBlob: blob, postSlug: payload.post,
    8080  });
  • src/routes/push.js

    r96c714f r9a00f28  
    99import { requireAuth } from '../middleware/auth.js';
    1010import Push from '../services/PushService.js';
     11import { t as i18nT, resolveLang } from '../services/i18n.js';
    1112
    1213const router = express.Router();
     
    5556// A test ping to all of the caller's own devices (bypasses alert prefs).
    5657router.post('/test', requireAuth, async (req, res) => {
     58  const L = resolveLang(req);
    5759  const sent = await Push.notifyUser(req.session.user.id, {
    58     type: 'test', title: 'Klonkt-testnotificatie',
    59     body: 'Werkt. Zo komen meldingen binnen op dit apparaat.', url: '/admin/push',
     60    type: 'test', title: i18nT(L, 'push.n_test_t'),
     61    body: i18nT(L, 'push.n_test_b'), url: '/admin/push',
    6062  });
    6163  res.json({ ok: true, sent });
Note: See TracChangeset for help on using the changeset viewer.