Changeset 834bcc3 in Klonkt for src/routes/admin-circle.js
- Timestamp:
- 06/23/2026 06:14:27 PM (3 months ago)
- Branches:
- main
- Children:
- d774679
- Parents:
- bb42dfb
- File:
-
- 1 edited
-
src/routes/admin-circle.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-circle.js
rbb42dfb r834bcc3 1 1 /** 2 * Admin: Cir kel-beheer(god-only).3 * GET /admin/circle -> li jst van cirkel-links + status4 * POST /admin/circle/add -> Klonkt-URL toevoegen2 * Admin: Circle management (god-only). 3 * GET /admin/circle -> list of circle links + status 4 * POST /admin/circle/add -> add a Klonkt URL 5 5 * POST /admin/circle/:id/remove 6 * POST /admin/circle/:id/sync -> nu verversen (pull + verifieer)7 * POST /admin/circle/allow -> toggle "ma g in cirkels van anderen verschijnen"6 * POST /admin/circle/:id/sync -> refresh now (pull + verify) 7 * POST /admin/circle/allow -> toggle "may appear in others' circles" 8 8 * 9 * Zie docs/cirkels-v1-spec.md §5d.9 * See docs/cirkels-v1-spec.md §5d. 10 10 */ 11 11 … … 51 51 const site = primarySite(); 52 52 if (!site) return res.redirect('/admin/circle?error=' + encodeURIComponent('Geen site gevonden')); 53 // Schema automatisch aanvullen: een kale domeinnaam → https://, een getypte54 // http:// → https:// (federati e is bewust https-only, getekende feeds). Zo hoeft55 // de gebruiker nooit zelf http(s):// te typen.53 // Auto-complete the scheme: a bare domain name → https://, a typed 54 // http:// → https:// (federation is intentionally https-only, signed feeds). So the 55 // user never has to type http(s):// themselves. 56 56 let url = (req.body.remote_url || '').toString().trim().replace(/\/+$/, ''); 57 57 if (url && !/^[a-z]+:\/\//i.test(url)) url = 'https://' + url; … … 68 68 return res.redirect('/admin/circle?error=' + encodeURIComponent('Deze site staat al in je cirkel')); 69 69 } 70 // Meteen ophalen i.p.v. wachten op de 15-min-loop.70 // Fetch immediately instead of waiting for the 15-minute loop. 71 71 try { 72 72 const link = db.prepare('SELECT * FROM circle_links WHERE id = ?').get(id); … … 75 75 } catch (e) { 76 76 const msg = String((e && e.message) || e); 77 // 404 = geen cirkel-endpoint. Hubs federeren bewust NIET (hun/.klonkt/actor.json78 // geeft 404), net als losse niet-Klonkt-sites. Niet toevoegen: rol de insert terug79 // zodat er geen dode "fout"-rij in de cirkel blijft staan.77 // 404 = no circle endpoint. Hubs intentionally do NOT federate (their /.klonkt/actor.json 78 // returns 404), same as standalone non-Klonkt sites. Don't add: roll back the insert 79 // so no dead "error" row is left in the circle. 80 80 if (/\b404\b/.test(msg)) { 81 81 db.prepare('DELETE FROM circle_links WHERE id = ?').run(id); 82 82 return res.redirect('/admin/circle?error=' + encodeURIComponent('Niet toegevoegd: deze site doet niet mee aan cirkels. Een hub kan geen cirkel-partner zijn (en losse/niet-Klonkt-sites ook niet).')); 83 83 } 84 // Andere (mogelijk tijdelijke) fout → link blijft staan; later "Verversen".84 // Other (possibly temporary) error → link stays; use "Refresh" later to retry. 85 85 return res.redirect('/admin/circle?success=' + encodeURIComponent('Toegevoegd — synchroniseren mislukte (klik "Verversen" om opnieuw te proberen)')); 86 86 } … … 91 91 if (link) { 92 92 db.prepare('DELETE FROM circle_links WHERE id = ?').run(link.id); 93 // Gecachte content opruimen als geen andere link nog naar deze actor wijst.93 // Clean up cached content if no other link still points to this actor. 94 94 if (link.remote_actor_id) { 95 95 const other = db.prepare('SELECT 1 FROM circle_links WHERE remote_actor_id = ? LIMIT 1').get(link.remote_actor_id); … … 117 117 }); 118 118 119 // Alles in één keer verversen (handig "voor de zekerheid").119 // Refresh everything at once (handy "just to be sure"). 120 120 router.post('/sync-all', requireGod, async (req, res) => { 121 121 try {
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)