Changeset e62f65d in Klonkt for src/routes/guardian2.js
- Timestamp:
- 07/25/2026 08:01:21 AM (7 weeks ago)
- Branches:
- main
- Children:
- ad6f62a
- Parents:
- 5c373b8
- File:
-
- 1 edited
-
src/routes/guardian2.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/guardian2.js
r5c373b8 re62f65d 40 40 'pending', 'active', 'retract', 'release', 'open', 'push_unavailable', 41 41 'accept', 'reject', 'complete', 'awaiting_others', 'coguard']; 42 return Object.fromEntries(keys.map((k) => [k, i18nT(L, `guardian.${k}`)])); 42 const s = Object.fromEntries(keys.map((k) => [k, i18nT(L, `guardian.${k}`)])); 43 s.wave = i18nT(L, 'guardian2.wave'); 44 s.waved = i18nT(L, 'guardian2.waved'); 45 return s; 43 46 } 44 47 … … 170 173 } catch (e) { return res.status(502).json({ error: 'delivery', outcome: r.outcome }); } 171 174 res.json({ ok: true, outcome: r.outcome }); 175 }); 176 177 // ── Wave (FEP-633c §5, shaer:wave): a gentle "thinking of you" from a 178 // guardian to a ward. A private direct note, never a feed post. Warmth 179 // without publishing (Robins besluit). 180 router.post('/api/wave', requireAuth, express.json({ limit: '2kb' }), async (req, res) => { 181 const site = siteForUser(req); 182 if (!site) return res.status(404).json({ error: 'no_site' }); 183 const wardUri = String(req.body?.ward || '').trim(); 184 // Only wave at a ward you actually guard. 185 const isWard = Guardianship.listWards(site.slug).some((w) => w.other_uri === wardUri); 186 if (!wardUri || !isWard) return res.status(403).json({ error: 'not_your_ward' }); 187 const text = String(req.body?.text || '').trim().slice(0, 200) || '👋 thinking of you'; 188 const r = await AP.deliverDirectNote(site, { recipients: [wardUri], text, wave: true }).catch(() => null); 189 if (!r) return res.status(502).json({ error: 'delivery' }); 190 res.json({ ok: true, delivered: r.delivered }); 172 191 }); 173 192
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)