Changeset 0091cb7 in Klonkt


Ignore:
Timestamp:
06/16/2026 12:59:24 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
efdde37
Parents:
25d4041
Message:

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@…>

Location:
src
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • src/config/database.js

    r25d4041 r0091cb7  
    4747  // Per-site Prutter toggle: when off, DM endpoints/UI are hidden for that site.
    4848  ensureColumn('sites', 'enable_prutter', 'INTEGER DEFAULT 1');
     49  // Cirkels: mag deze site in cirkels van anderen verschijnen (surfacing opt-out).
     50  ensureColumn('sites', 'allow_circle', 'INTEGER DEFAULT 1');
    4951
    5052  // v9 audit additions —————————————————————————————————————————
  • src/routes/admin-settings.js

    r25d4041 r0091cb7  
    3333router.post('/', requireGod, (req, res) => {
    3434  if (typeof req.body.tenancy !== 'undefined') {
    35     setTenancy(req.body.tenancy === 'hub' ? 'hub' : 'solo');
     35    setTenancy(req.body.tenancy); // valideert naar solo | hub | circle
    3636  }
    3737  if (typeof req.body.hub_title !== 'undefined') {
  • src/server.js

    r25d4041 r0091cb7  
    4545import federationRoutes from './routes/federation.js';
    4646import { startCircleSyncLoop } from './services/CircleService.js';
     47import adminCircleRoutes from './routes/admin-circle.js';
     48import circleRoutes from './routes/circle.js';
    4749
    4850if (!process.env.SESSION_SECRET) {
     
    225227app.use('/admin/comments', adminCommentsRoutes);
    226228app.use('/admin/settings', adminSettingsRoutes);
     229app.use('/admin/circle', adminCircleRoutes);
    227230app.use('/admin', adminRoutes);
    228231app.use('/prutter', prutterRoutes);
     
    238241app.get('/artiesten', (req, res) => res.redirect(301, req.originalUrl.replace(/^\/artiesten/, '/leden'))); // oude URL -> /leden
    239242app.use('/', hubRoutes); // hub-overview op '/' (solo: next() -> postsRoutes)
     243app.use('/', circleRoutes); // /cirkel-feed (solo/hub: next() -> postsRoutes)
    240244app.use('/', postsRoutes);
    241245
  • src/services/CircleFederation.js

    r25d4041 r0091cb7  
    7474// aan is_public (aparte expliciete flag volgt in de Beheer-UX-stap).
    7575function allowsCircle(site) {
    76   return !!site && site.is_public !== 0;
     76  return !!site && site.is_public !== 0 && site.allow_circle !== 0;
    7777}
    7878
  • src/views/pages/admin-settings.ejs

    r25d4041 r0091cb7  
    2525          <strong>Hub</strong> — bedrijfssite met <code>/user/</code>.
    2626          <small>Jij (admin) wijst gebruikers een eigen Klonkt Hub toe. Gesloten cirkel: geen open registratie.</small>
     27        </span>
     28      </label>
     29      <label class="set-opt">
     30        <input type="radio" name="tenancy" value="circle" <%= tenancy === 'circle' ? 'checked' : '' %>>
     31        <span>
     32          <strong>Cirkels</strong> &mdash; solo + federatie.
     33          <small>E&eacute;n eigen site die de publieke posts van andere Klonkt-sites toont. Asymmetrisch: jij bepaalt wie in jouw cirkel zit.</small>
    2734        </span>
    2835      </label>
     
    5966  </section>
    6067  <% } %>
     68
     69  <% if (tenancy === 'circle') { %>
     70  <section class="set-card" style="margin-top:1rem">
     71    <h2>Cirkel</h2>
     72    <p class="set-help">
     73      Beheer welke andere Klonkt-sites je in je cirkel toont, en of jouw site in
     74      cirkels van anderen mag verschijnen.
     75    </p>
     76    <p><a href="/admin/circle" class="btn btn-primary">Beheer je cirkel &rarr;</a></p>
     77  </section>
     78  <% } %>
    6179</div>
    6280
Note: See TracChangeset for help on using the changeset viewer.