Changeset 4f322bc in Klonkt for src/routes/activitypub.js
- Timestamp:
- 08/07/2026 08:49:58 AM (5 weeks ago)
- Branches:
- main
- Children:
- a6d703a
- Parents:
- 5861849
- git-author:
- Robin <roboburr@…> (08/07/2026 08:49:56 AM)
- git-committer:
- roboburr <roboburr@…> (08/07/2026 08:49:58 AM)
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r5861849 r4f322bc 268 268 // they follow) as Create(Note) items, so an app (Shaer) can build a unified 269 269 // feed. Anyone else gets 403; the inbox stays write-only for the public. 270 router.get('/ap/users/:slug/inbox', (req, res) => {270 router.get('/ap/users/:slug/inbox', async (req, res) => { 271 271 const auth = OAuth.verifyBearer(req.headers.authorization); 272 272 if (!auth || auth.site.slug !== req.params.slug) return res.status(403).end(); 273 273 const base = baseUrl(req); 274 // Wachten is een UITBREIDING van deze lezing, geen tweede endpoint (shaer-n05). 275 // Geef `since` (de shaer:cursor van je vorige antwoord) en `wait` mee, en het 276 // antwoord blijft hangen tot er iets is of de tijd om is. Zonder die twee 277 // gedraagt de route zich exact zoals altijd. 278 // 279 // Bewust hetzelfde antwoord in plaats van een "er is nieuws"-seintje: dan 280 // hoeft er niets nieuws geparsed te worden, is er geen tweede beschrijving van 281 // de kaartvorm die uit de pas kan lopen, en scheelt het de client een tweede 282 // ronde. 283 const wachtS = Math.min(Math.max(parseInt(req.query.wait, 10) || 0, 0), 50); 284 if (req.query.since && wachtS > 0) { 285 const afbreken = new AbortController(); 286 res.on('close', () => afbreken.abort()); // client hing op: niet doorgaan met wachten 287 await AP.waitForFeedChange(auth.site.slug, { 288 since: String(req.query.since), waitMs: wachtS * 1000, signal: afbreken.signal, 289 }); 290 if (res.writableEnded || afbreken.signal.aborted) return undefined; 291 } 274 292 // Gated feature (FEP-633c): may this account see EXTERNAL embeds? A ward's 275 293 // world outside the fediverse is the guardians' call. The gate is applied … … 444 462 'shaer:externalLinks': playbackAllowed, 445 463 }, 464 // Het merk van wat hierin zit. Geef hem terug als `since` om op het 465 // volgende te wachten. NA het samenstellen bepaald, zodat hij precies dekt 466 // wat je in handen hebt en niet iets dat er ondertussen bij kwam. 467 'shaer:cursor': AP.feedCursor(auth.site.slug), 446 468 totalItems: items.length, 447 469 orderedItems: items, 448 470 }); 471 return undefined; 449 472 }); 450 473
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)