Changeset 0b7ebbf in Klonkt
- Timestamp:
- 06/16/2026 01:12:00 AM (3 months ago)
- Branches:
- main
- Children:
- 57929aa
- Parents:
- 63edb0d (diff), efdde37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Files:
-
- 8 added
- 5 edited
-
docs/cirkels-v1-spec.md (added)
-
src/config/database.js (modified) (2 diffs)
-
src/routes/admin-circle.js (added)
-
src/routes/admin-settings.js (modified) (1 diff)
-
src/routes/circle.js (added)
-
src/routes/federation.js (added)
-
src/server.js (modified) (5 diffs)
-
src/services/CircleFederation.js (added)
-
src/services/CircleService.js (added)
-
src/services/SettingsService.js (modified) (1 diff)
-
src/views/pages/admin-circle.ejs (added)
-
src/views/pages/admin-settings.ejs (modified) (2 diffs)
-
src/views/pages/circle-feed.ejs (added)
Legend:
- Unmodified
- Added
- Removed
-
src/config/database.js
r63edb0d r0b7ebbf 47 47 // Per-site Prutter toggle: when off, DM endpoints/UI are hidden for that site. 48 48 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'); 49 51 50 52 // v9 audit additions ————————————————————————————————————————— … … 106 108 `); 107 109 db.prepare("INSERT OR IGNORE INTO app_settings (key, value) VALUES ('tenancy', 'solo')").run(); 110 111 // ── Cirkels (federatie) ───────────────────────────────────── 112 // Decentrale, asymmetrische verbindingen tussen solo-instances. 113 db.exec(` 114 CREATE TABLE IF NOT EXISTS circle_links ( 115 id TEXT PRIMARY KEY, 116 local_site_id TEXT NOT NULL, 117 remote_url TEXT NOT NULL, 118 remote_actor_id TEXT, 119 label TEXT, 120 status TEXT DEFAULT 'active', 121 added_at DATETIME DEFAULT CURRENT_TIMESTAMP, 122 last_synced DATETIME, 123 last_error TEXT, 124 UNIQUE(local_site_id, remote_url), 125 FOREIGN KEY (local_site_id) REFERENCES sites(id) 126 ); 127 CREATE TABLE IF NOT EXISTS remote_actors ( 128 id TEXT PRIMARY KEY, 129 url TEXT UNIQUE NOT NULL, 130 name TEXT, 131 summary TEXT, 132 avatar TEXT, 133 public_key TEXT NOT NULL, 134 fetched_at DATETIME DEFAULT CURRENT_TIMESTAMP 135 ); 136 CREATE TABLE IF NOT EXISTS remote_posts ( 137 id TEXT PRIMARY KEY, 138 actor_id TEXT NOT NULL, 139 published DATETIME, 140 title TEXT, 141 summary TEXT, 142 url TEXT, 143 media_json TEXT, 144 raw_json TEXT, 145 fetched_at DATETIME DEFAULT CURRENT_TIMESTAMP, 146 FOREIGN KEY (actor_id) REFERENCES remote_actors(id) 147 ); 148 `); 108 149 } 109 150 -
src/routes/admin-settings.js
r63edb0d r0b7ebbf 88 88 89 89 if (typeof req.body.tenancy !== 'undefined') { 90 setTenancy(req.body.tenancy === 'hub' ? 'hub' : 'solo');90 setTenancy(req.body.tenancy); // valideert naar solo | hub | circle 91 91 } 92 92 if (typeof req.body.hub_title !== 'undefined') { -
src/server.js
r63edb0d r0b7ebbf 43 43 import artistsRoutes from './routes/artists.js'; 44 44 import postsRoutes from './routes/posts.js'; 45 import federationRoutes from './routes/federation.js'; 46 import { startCircleSyncLoop } from './services/CircleService.js'; 47 import adminCircleRoutes from './routes/admin-circle.js'; 48 import circleRoutes from './routes/circle.js'; 45 49 46 50 if (!process.env.SESSION_SECRET) { … … 145 149 initializeDatabase(); 146 150 151 // Cirkels: periodieke achtergrond-sync van remote instances (no-op tenzij tenancy='circle'). 152 startCircleSyncLoop(); 153 147 154 // Bundle HTMX: copy from node_modules into our own assets dir so we can serve 148 155 // it locally (no third-party CDN). Idempotent — only copies if size differs. … … 165 172 const prutter = new PrutterService(db); 166 173 app.locals.prutter = prutter; 174 175 // Cirkels-federatie: publieke, site-agnostische endpoints (/.klonkt/*). 176 // Vóór resolveSite/theme — ze hebben geen site-context nodig. 177 app.use(federationRoutes); 167 178 168 179 app.use(resolveSite); … … 216 227 app.use('/admin/comments', adminCommentsRoutes); 217 228 app.use('/admin/settings', adminSettingsRoutes); 229 app.use('/admin/circle', adminCircleRoutes); 218 230 app.use('/admin', adminRoutes); 219 231 app.use('/prutter', prutterRoutes); … … 229 241 app.get('/artiesten', (req, res) => res.redirect(301, req.originalUrl.replace(/^\/artiesten/, '/leden'))); // oude URL -> /leden 230 242 app.use('/', hubRoutes); // hub-overview op '/' (solo: next() -> postsRoutes) 243 app.use('/', circleRoutes); // /cirkel-feed (solo/hub: next() -> postsRoutes) 231 244 app.use('/', postsRoutes); 232 245 -
src/services/SettingsService.js
r63edb0d r0b7ebbf 35 35 36 36 export function getTenancy() { 37 return getSetting('tenancy', 'solo') === 'hub' ? 'hub' : 'solo'; 37 const v = getSetting('tenancy', 'solo'); 38 return v === 'hub' ? 'hub' : v === 'circle' ? 'circle' : 'solo'; 38 39 } 39 40 40 41 export function setTenancy(mode) { 41 setSetting('tenancy', mode === 'hub' ? 'hub' : 'solo'); 42 const m = (mode === 'hub' || mode === 'circle') ? mode : 'solo'; 43 setSetting('tenancy', m); 42 44 } -
src/views/pages/admin-settings.ejs
r63edb0d r0b7ebbf 25 25 <strong>Hub</strong> — bedrijfssite met <code>/user/</code>. 26 26 <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> — solo + federatie. 33 <small>Eén eigen site die de publieke posts van andere Klonkt-sites toont. Asymmetrisch: jij bepaalt wie in jouw cirkel zit.</small> 27 34 </span> 28 35 </label> … … 80 87 </section> 81 88 <% } %> 89 90 <% if (tenancy === 'circle') { %> 91 <section class="set-card" style="margin-top:1rem"> 92 <h2>Cirkel</h2> 93 <p class="set-help"> 94 Beheer welke andere Klonkt-sites je in je cirkel toont, en of jouw site in 95 cirkels van anderen mag verschijnen. 96 </p> 97 <p><a href="/admin/circle" class="btn btn-primary">Beheer je cirkel →</a></p> 98 </section> 99 <% } %> 82 100 </div> 83 101
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)