Changeset 75ab393 in Klonkt for src/routes/activitypub.js
- Timestamp:
- 06/25/2026 08:45:02 PM (3 months ago)
- Branches:
- main
- Children:
- a9900ec
- Parents:
- 49edc72
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r49edc72 r75ab393 16 16 import db from '../config/database.js'; 17 17 import AP from '../services/ActivityPubService.js'; 18 import { apReadLimiter, apInboxLimiter } from '../middleware/rate-limit.js'; 18 19 19 20 const router = express.Router(); 21 // Generous per-IP baseline over all /ap/* (reads). The inbox POST gets an 22 // additional, tighter cap inline (it triggers outbound fetches). 23 router.use(apReadLimiter); 20 24 let _ver = '1.0.0'; 21 25 try { _ver = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url))).version || _ver; } catch { /* keep default */ } … … 160 164 verify: (req, _res, buf) => { req.rawBody = buf; }, // raw body for digest verification 161 165 }); 162 router.post(['/ap/users/:slug/inbox', '/ap/inbox'], ap Json, async (req, res) => {166 router.post(['/ap/users/:slug/inbox', '/ap/inbox'], apInboxLimiter, apJson, async (req, res) => { 163 167 try { return res.status(await AP.handleInbox(req, req.params.slug || null) || 202).end(); } 164 168 catch (e) { console.warn('[AP inbox] error:', e.message); return res.status(202).end(); }
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)