Changeset 04d5aeb in Klonkt for src/routes
- Timestamp:
- 08/02/2026 09:42:34 PM (5 weeks ago)
- Branches:
- main
- Children:
- 5327324
- Parents:
- f3a58a4
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
rf3a58a4 r04d5aeb 585 585 586 586 // ── Note ────────────────────────────────────────────────────────── 587 router.get('/ap/notes/:id', (req, res) => { 587 router.get('/ap/notes/:id', async (req, res) => { 588 // No fan_only filter in the SELECT anymore: a friends-only post is not 589 // absent, it is GATED. The old route hid it from EVERYONE, also from the 590 // follower whose friendship earns it — so the signed resolution the reply 591 // path performs knocked on a door that could never open, and every reply 592 // to a friends-only post (Shaer's default!) died in 593 // cannot_resolve_inReplyTo. Strangers still get the exact same 404, so a 594 // note's existence stays as private as before. 588 595 const post = db.prepare( 589 "SELECT * FROM posts WHERE id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0)"596 "SELECT * FROM posts WHERE id = ? AND status = 'published'" 590 597 ).get(req.params.id); 598 if (post && AP.noteAudience(post) !== 'public') { 599 // The whole gate in a try: this is the only async route in this file, 600 // and Express 4 does not catch an async rejection — the request would 601 // hang forever instead of failing (which is exactly how the missing 602 // default-export entry manifested while building this). Any error here 603 // reads as "not authorized", never as silence. 604 try { 605 if (AP.noteAudience(post) === 'direct') return res.status(404).end(); 606 const gsite = db.prepare('SELECT * FROM sites WHERE id = ?').get(post.site_id); 607 const actor = await AP.verifyRequest(req).catch(() => null); 608 if (!actor || !AP.mayReadNote(gsite, post, actor.id)) return res.status(404).end(); 609 } catch { return res.status(404).end(); } 610 } 591 611 if (!post) { 592 612 // Could be one of OUR outbound replies (ap_outbox), not a post.
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)