Changeset 283f618 in Klonkt for src/routes/activitypub.js


Ignore:
Timestamp:
06/26/2026 07:26:26 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
f278df9
Parents:
eb2fe08
Message:

feat(fediverse): add an ActivityPub on/off toggle (off = no federation, no comments)

A solo site can now run without the fediverse. ap_enabled (default on, Beheer ->
Instellingen). When off: /ap/*, WebFinger and NodeInfo 404 (undiscoverable), the
'from the fediverse' reactions section is hidden on posts (= no comments, since
native comments were removed), the profile follow button and the fediverse admin
links disappear. Cirkels is separate (not gated here).

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/activitypub.js

    reb2fe08 r283f618  
    1717import AP from '../services/ActivityPubService.js';
    1818import { apReadLimiter, apInboxLimiter } from '../middleware/rate-limit.js';
     19import { apEnabled } from '../services/SettingsService.js';
    1920
    2021const router = express.Router();
     22// The whole fediverse layer can be turned off (solo "no federation" mode):
     23// then /ap/*, WebFinger and NodeInfo are simply gone — the site is undiscoverable
     24// and unfederatable.
     25router.use((req, res, next) => { if (!apEnabled()) return res.status(404).end(); next(); });
    2126// Generous per-IP baseline over all /ap/* (reads). The inbox POST gets an
    2227// additional, tighter cap inline (it triggers outbound fetches).
Note: See TracChangeset for help on using the changeset viewer.