Changeset bac4bf3 in Klonkt for src/routes/activitypub.js
- Timestamp:
- 08/13/2026 11:55:04 AM (4 weeks ago)
- Branches:
- main
- Children:
- 783b9ff
- Parents:
- 7e9d0ea
- git-author:
- Robin <roboburr@…> (08/13/2026 11:54:36 AM)
- git-committer:
- Robin <roboburr@…> (08/13/2026 11:55:04 AM)
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r7e9d0ea rbac4bf3 28 28 29 29 const router = express.Router(); 30 31 /** 32 * Welke pagina vraagt de lezer? (shaer-sk4) 33 * 34 * Hier stond `!!req.query.page` -- of de parameter er STAAT, niet welke. Daardoor 35 * gaf ?page=2 en ?page=99 allemaal pagina 1, en noemde het antwoord zichzelf ook 36 * nog pagina 1. Onleesbaar getal of geen parameter: dan de wortel. 37 */ 38 function paginaNr(req) { 39 if (req.query.page === undefined) return false; 40 const n = Math.floor(Number(req.query.page)); 41 return Number.isFinite(n) && n > 0 ? n : 1; 42 } 30 43 // The whole fediverse layer can be turned off (solo "no federation" mode): 31 44 // then /ap/*, WebFinger and NodeInfo are simply gone — the site is undiscoverable … … 182 195 }); 183 196 if (audience === 'blocked') { 184 return AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, [], [], { page: !!req.query.page}), 'private, no-store');197 return AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, [], [], { page: paginaNr(req) }), 'private, no-store'); 185 198 } 186 199 const fanClause = audience === 'friend' ? '' : "AND (fan_only IS NULL OR fan_only = 0)"; … … 192 205 // De tracks gaan mee voor iedereen die de deur door mag; de blocked-tak 193 206 // hierboven levert bewust een outbox ZONDER posts en zonder tracks. 194 const ob = AP.buildOutbox(baseUrl(req), site, posts, AP.siteOpenTracks(site.id), { page: !!req.query.page});207 const ob = AP.buildOutbox(baseUrl(req), site, posts, AP.siteOpenTracks(site.id), { page: paginaNr(req) }); 195 208 if (audience === 'friend') { 196 209 // The owner's app builds its feed from this leg, and every note here is … … 986 999 // Default = bare references; enrich only when the client asks (FEP-9876). 987 1000 const items = wantsEnriched(req, res) ? uris.map((u) => AP.buildActorRef(site.slug, u)) : uris; 988 return AP.sendAP(res, AP.buildFollowers(baseUrl(req), site, items.length, items ));1001 return AP.sendAP(res, AP.buildFollowers(baseUrl(req), site, items.length, items, { page: paginaNr(req) })); 989 1002 } 990 1003 const n = db.prepare('SELECT COUNT(*) n FROM ap_followers WHERE slug = ?').get(site.slug).n; 991 AP.sendAP(res, AP.buildFollowers(baseUrl(req), site, n ));1004 AP.sendAP(res, AP.buildFollowers(baseUrl(req), site, n, null, { page: paginaNr(req) })); 992 1005 }); 993 1006 … … 1005 1018 items = enrich ? uris.map((u) => AP.buildActorRef(site.slug, u)) : uris; 1006 1019 } catch { /* table may not exist */ } 1007 return AP.sendAP(res, AP.buildFollowing(baseUrl(req), site, items.length, items ));1020 return AP.sendAP(res, AP.buildFollowing(baseUrl(req), site, items.length, items, { page: paginaNr(req) })); 1008 1021 } 1009 1022 let n = 0; 1010 1023 try { n = db.prepare("SELECT COUNT(*) n FROM ap_following WHERE slug = ? AND status = 'accepted'").get(site.slug).n; } catch { /* table may not exist */ } 1011 AP.sendAP(res, AP.buildFollowing(baseUrl(req), site, n ));1024 AP.sendAP(res, AP.buildFollowing(baseUrl(req), site, n, null, { page: paginaNr(req) })); 1012 1025 }); 1013 1026
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)