Changeset f63cbc2 in Klonkt for src/routes/federation.js
- Timestamp:
- 06/16/2026 06:33:38 AM (3 months ago)
- Branches:
- main
- Children:
- 4fee228
- Parents:
- 1b4d5dd
- File:
-
- 1 edited
-
src/routes/federation.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/federation.js
r1b4d5dd rf63cbc2 8 8 9 9 import express from 'express'; 10 import { buildActor, buildOutbox, signBody } from '../services/CircleFederation.js';10 import { buildActor, buildOutbox, signBody, KLONKT_PROTO, MIN_PROTO } from '../services/CircleFederation.js'; 11 11 import { getTenancy } from '../services/SettingsService.js'; 12 12 … … 18 18 } 19 19 20 // De proto die de consument zegt te draaien (uit z'n request-header), of 0. 21 function consumerProto(req) { 22 return parseInt(req.get('Klonkt-Proto') || '0', 10) || 0; 23 } 24 20 25 router.get('/.klonkt/actor.json', (req, res) => { 21 26 // Cirkels = solo-naar-solo; hubs publiceren geen federatie-actor. 22 27 if (getTenancy() === 'hub') return res.status(404).type('text/plain').send('Niet beschikbaar in hub-modus'); 28 // De actor serveren we ALTIJD (ook aan oudere consumenten) zodat zij onze proto 29 // kunnen lezen en een nette "update vereist"-melding kunnen tonen. 23 30 const body = JSON.stringify(buildActor(baseUrl(req)), null, 2); 24 31 res.type('application/activity+json; charset=utf-8'); 32 res.set('Klonkt-Proto', String(KLONKT_PROTO)); 25 33 res.set('Cache-Control', 'public, max-age=300'); 26 34 res.send(body); … … 29 37 router.get('/.klonkt/outbox.json', (req, res) => { 30 38 if (getTenancy() === 'hub') return res.status(404).type('text/plain').send('Niet beschikbaar in hub-modus'); 39 res.set('Klonkt-Proto', String(KLONKT_PROTO)); 40 // Te-oude consument? Weiger met 426 Upgrade Required (de crypto-binding sluit 'm 41 // sowieso al uit; dit geeft een expliciet, leesbaar signaal). proto 0 = geen 42 // header (bv. een browser/curl) → toestaan, die verifieert toch niet. 43 const cp = consumerProto(req); 44 if (cp && cp < MIN_PROTO) { 45 return res.status(426).type('text/plain') 46 .send(`Upgrade Required: deze cirkel draait proto ${KLONKT_PROTO}; jouw Klonkt (proto ${cp}) is te oud.`); 47 } 31 48 const body = JSON.stringify(buildOutbox(baseUrl(req)), null, 2); 32 49 res.type('application/activity+json; charset=utf-8');
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)