Changeset 2a17f0a in Klonkt for src/routes
- Timestamp:
- 07/30/2026 11:54:08 PM (6 weeks ago)
- Branches:
- main
- Children:
- 0f48411
- Parents:
- ef519a3
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
ref519a3 r2a17f0a 174 174 <p class="small">No Shaer? Any fediverse app can follow ${esc(handle)}.</p> 175 175 </main></body></html>`); 176 }); 177 178 // ── Long-poll (owner only, Robins verzoek 31-7) ─────────────────── 179 // Hold the request until something push-worthy lands for this account, then 180 // answer 200 (news: re-read your feed) or 204 after ~25s (nothing: re-arm). 181 // The thread in the app stays live without interval polling. 182 router.get('/ap/users/:slug/inbox/wait', (req, res) => { 183 const auth = OAuth.verifyBearer(req.headers.authorization); 184 if (!auth || auth.site.slug !== req.params.slug) return res.status(403).end(); 185 let settled = false; 186 const done = (code) => { 187 if (settled) return; 188 settled = true; 189 clearTimeout(timer); 190 off(); 191 if (!res.headersSent) res.status(code).end(); 192 }; 193 const off = AP.onNews(auth.site.slug, () => done(200)); 194 const timer = setTimeout(() => done(204), 25_000); 195 req.on('close', () => done(204)); 176 196 }); 177 197
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)