source: Klonkt/src/routes/admin-settings.js@ 0091cb7

main
Last change on this file since 0091cb7 was 0091cb7, checked in by roboburr <roboburr@…>, 3 months ago

Circles v1 — steps 4+5: Admin UI + /cirkel feed

  • Mode 'Circles' in Admin > Settings (radio + section).
  • Admin > Circle (admin-circle): add sources/list/status, per source Refresh (syncOne) + Delete (cleans up orphaned cache), and a visibility toggle (sites.allow_circle, opt-out for surfacing).
  • /cirkel feed: cached remote_posts as static cards (source/avatar, title, summary, cover, link to source). Only when tenancy=circle.
  • allow_circle column (ensureColumn) + CircleFederation respects it.
  • Output escaped everywhere + URL-scheme guards (http/https) against XSS import.

v1 functionally complete (publish + pull + UI + feed). Remaining: hardening/review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[6351545]1/**
[6e0249f]2 * Admin: globale instellingen.
3 * - tenancy-modus (Solo/Hub)
4 * - hub-branding (naam/tagline/intro van de generieke hub-hoofdpagina)
[6351545]5 *
[6e0249f]6 * GET /admin/settings -> toon huidige instellingen
7 * POST /admin/settings -> sla op (god-only)
[6351545]8 *
[6e0249f]9 * De hub-pagina is generiek (van geen enkele user); deze branding leeft in
10 * globale settings, niet in een site.
[6351545]11 */
12
13import express from 'express';
14import { renderPage } from '../middleware/render.js';
15import { requireGod } from '../middleware/auth.js';
[6e0249f]16import { getTenancy, setTenancy, getSetting, setSetting } from '../services/SettingsService.js';
[6351545]17
18const router = express.Router();
19
20router.get('/', requireGod, (req, res) => {
21 renderPage(req, res, 'pages/admin-settings', {
22 pageTitle: 'Instellingen',
23 bodyClass: 'on-admin',
24 tenancy: getTenancy(),
[6e0249f]25 hubTitle: getSetting('hub_title') || '',
26 hubTagline: getSetting('hub_tagline') || '',
27 hubIntro: getSetting('hub_intro') || '',
[4c5169f]28 hubHeroImage: getSetting('hub_hero_image') || '',
[6351545]29 success: req.query.success || null,
30 });
31});
32
33router.post('/', requireGod, (req, res) => {
[6e0249f]34 if (typeof req.body.tenancy !== 'undefined') {
[0091cb7]35 setTenancy(req.body.tenancy); // valideert naar solo | hub | circle
[6e0249f]36 }
37 if (typeof req.body.hub_title !== 'undefined') {
38 setSetting('hub_title', (req.body.hub_title || '').toString().slice(0, 80).trim());
39 }
40 if (typeof req.body.hub_tagline !== 'undefined') {
41 setSetting('hub_tagline', (req.body.hub_tagline || '').toString().slice(0, 120).trim());
42 }
43 if (typeof req.body.hub_intro !== 'undefined') {
44 setSetting('hub_intro', (req.body.hub_intro || '').toString().slice(0, 400).trim());
45 }
[4c5169f]46 if (typeof req.body.hub_hero_image !== 'undefined') {
47 setSetting('hub_hero_image', (req.body.hub_hero_image || '').toString().slice(0, 300).trim());
48 }
[6e0249f]49 res.redirect('/admin/settings?success=' + encodeURIComponent('Opgeslagen'));
[6351545]50});
51
52export default router;
Note: See TracBrowser for help on using the repository browser.