Changeset 62b899d in Klonkt for src


Ignore:
Timestamp:
06/16/2026 07:02:15 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
fb02cc0
Parents:
682d504
Message:

Circle: strip shortcodes from summary + "Sync all now" button

[[playlist:..]]/[[track:..]]/[[album:..]]-shortcodes survived stripHtml (not
HTML) → appeared raw in the circle summary (buggy). Now stripped on ingest
(consumer) and on publish. Also added a global sync button on
Admin → Circle.

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

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/routes/admin-circle.js

    r682d504 r62b899d  
    1616import db from '../config/database.js';
    1717import { getTenancy } from '../services/SettingsService.js';
    18 import { syncOne } from '../services/CircleService.js';
     18import { syncOne, sync } from '../services/CircleService.js';
    1919
    2020const router = express.Router();
     
    9595});
    9696
     97// Alles in één keer verversen (handig "voor de zekerheid").
     98router.post('/sync-all', requireGod, async (req, res) => {
     99  try {
     100    const r = await sync();
     101    const n = (r && r.results) ? r.results.filter((x) => x && x.ok).length : 0;
     102    res.redirect('/admin/circle?success=' + encodeURIComponent(`Cirkel gesynchroniseerd (${n} site(s) bijgewerkt)`));
     103  } catch (e) {
     104    res.redirect('/admin/circle?error=' + encodeURIComponent(String((e && e.message) || e).slice(0, 200)));
     105  }
     106});
     107
    97108router.post('/allow', requireGod, (req, res) => {
    98109  const site = primarySite();
  • src/services/CircleFederation.js

    r682d504 r62b899d  
    7878
    7979function stripHtml(s) {
    80   return String(s || '').replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();
     80  return String(s || '')
     81    .replace(/<[^>]+>/g, ' ')
     82    .replace(/\[\[[^\]]*\]\]/g, ' ')   // [[playlist:..]]/[[track:..]]/[[album:..]]-shortcodes weg
     83    .replace(/\s+/g, ' ')
     84    .trim();
    8185}
    8286
  • src/services/CircleService.js

    r682d504 r62b899d  
    1414
    1515function stripHtml(s) {
    16   return String(s || '').replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();
     16  return String(s || '')
     17    .replace(/<[^>]+>/g, ' ')
     18    .replace(/\[\[[^\]]*\]\]/g, ' ')   // [[playlist:..]]/[[track:..]]/[[album:..]]-shortcodes weg
     19    .replace(/\s+/g, ' ')
     20    .trim();
    1721}
    1822function iso(d) {
  • src/views/pages/admin-circle.ejs

    r682d504 r62b899d  
    5252      <p class="set-help">Nog geen bronnen. Voeg er hierboven een toe.</p>
    5353    <% } else { %>
     54      <form method="post" action="/admin/circle/sync-all" style="margin:0 0 .9rem">
     55        <button type="submit" class="btn">&#8635; Alles nu synchroniseren</button>
     56      </form>
    5457      <ul class="circ-list">
    5558        <% links.forEach(function(l){ %>
Note: See TracChangeset for help on using the changeset viewer.