Changeset c26cc18 in Klonkt for src/routes
- Timestamp:
- 07/24/2026 06:04:03 PM (7 weeks ago)
- Branches:
- main
- Children:
- 780a7c6
- Parents:
- 1a2d8ac
- File:
-
- 1 edited
-
src/routes/guardian.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/guardian.js
r1a2d8ac rc26cc18 31 31 /** Everything the dashboard shows, one shape for page and API. */ 32 32 function uiStrings(L) { 33 const keys = ['sent', 'failed', 'network', 'pending', 'retract', 'release']; 33 const keys = ['sent', 'sent_retry', 'sending', 'not_found', 'failed', 'network', 34 'pending', 'active', 'retract', 'release', 'open', 'push_unavailable']; 34 35 return Object.fromEntries(keys.map((k) => [k, i18nT(L, `guardian.${k}`)])); 35 36 } … … 80 81 if (!handle) return res.status(400).json({ error: 'empty_handle' }); 81 82 const wardUri = /^https?:\/\//i.test(handle) ? handle : await AP.webfingerResolve(handle).catch(() => null); 82 if (!wardUri) return res.status(404).json({ error: 'not_found' }); 83 if (!wardUri) return res.status(404).json({ error: 'not_found' }); // the handle does not resolve to an account 83 84 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 84 85 const me = AP.actorId(base, site.slug); … … 87 88 object: { type: 'Relationship', subject: wardUri, relationship: 'shaer:Guardian', object: me }, 88 89 }); 89 if (!r || r.status >= 400) return res.status(r?.status || 500).json({ error: r?.error || 'offer_failed' }); 90 res.json({ ok: true, ward: wardUri }); 90 // 403/400 = a real refusal (e.g. you are a ward yourself); anything else the 91 // offer is recorded and delivery is retried in the background. 92 if (!r || (r.status >= 400 && r.status !== 502)) return res.status(r?.status || 500).json({ error: r?.error || 'offer_failed' }); 93 res.json({ ok: true, ward: wardUri, delivered: r.delivered !== false }); 91 94 }); 92 95
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)