Changeset 1a2f206 in Klonkt for src/routes/activitypub.js
- Timestamp:
- 07/30/2026 11:17:05 PM (6 weeks ago)
- Branches:
- main
- Children:
- ef519a3
- Parents:
- 55eca8b
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r55eca8b r1a2f206 121 121 } 122 122 AP.sendAP(res, ob, audience === 'friend' ? 'private, no-store' : undefined); 123 }); 124 125 // ── Follow-QR (Robins verzoek, 31-7) ────────────────────────────── 126 // A PNG QR of share:social/follow/AP/@slug@host: the ward shows it in 127 // Account, a friend scans the SCREEN with the ordinary camera app and their 128 // Shaer opens with the follow question. Public on purpose: it encodes only 129 // the public handle, and the app's plain image loaders carry no bearer. 130 router.get('/ap/users/:slug/follow-qr.png', async (req, res) => { 131 const site = db.prepare('SELECT slug FROM sites WHERE slug = ?').get(req.params.slug); 132 if (!site) return res.status(404).end(); 133 try { 134 const host = new URL(baseUrl(req)).host; 135 const { default: QRCode } = await import('qrcode'); 136 const png = await QRCode.toBuffer(`share:social/follow/AP/@${site.slug}@${host}`, { width: 600, margin: 1 }); 137 res.set('Content-Type', 'image/png'); 138 res.set('Cache-Control', 'public, max-age=86400'); 139 res.send(png); 140 } catch (e) { 141 console.warn('[AP] follow-qr failed:', e && e.message); 142 res.status(500).end(); 143 } 123 144 }); 124 145
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)