Changeset c06816e in Klonkt for src/routes/posts.js
- Timestamp:
- 07/01/2026 09:49:52 PM (2 months ago)
- Branches:
- main
- Children:
- 5a27ba4
- Parents:
- 8cf8b5f
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r8cf8b5f rc06816e 212 212 // attachment). NB: the file gate is per file, so opening a track in one post makes its file 213 213 // fetchable for every post that reuses it. 214 // ONE-WAY: opening is permanent. Once the file has federated it's out there — re-gating 215 // would be false security (remote copies keep the URL), so we never write fedi_open back to 0. 214 216 function setAudioFediOpen(siteId, content, open) { 215 const val = open ? 1 : 0;217 if (!open) return; // never close — see one-way note above 216 218 const c = content || ''; 217 219 try { 218 for (const m of c.matchAll(/\[\[track:([A-Za-z0-9_-]+)\]\]/g)) db.prepare('UPDATE audio_tracks SET fedi_open = ? WHERE id = ? AND site_id = ?').run(val,m[1], siteId);219 for (const m of c.matchAll(/\[\[album:([^\]]+)\]\]/g)) db.prepare('UPDATE audio_tracks SET fedi_open = ? WHERE site_id = ? AND album = ?').run(val,siteId, m[1].trim());220 for (const m of c.matchAll(/\[\[playlist:([A-Za-z0-9_-]+)\]\]/g)) db.prepare('UPDATE audio_tracks SET fedi_open = ? WHERE id IN (SELECT track_id FROM playlist_tracks WHERE playlist_id = ?)').run(val,m[1]);220 for (const m of c.matchAll(/\[\[track:([A-Za-z0-9_-]+)\]\]/g)) db.prepare('UPDATE audio_tracks SET fedi_open = 1 WHERE id = ? AND site_id = ?').run(m[1], siteId); 221 for (const m of c.matchAll(/\[\[album:([^\]]+)\]\]/g)) db.prepare('UPDATE audio_tracks SET fedi_open = 1 WHERE site_id = ? AND album = ?').run(siteId, m[1].trim()); 222 for (const m of c.matchAll(/\[\[playlist:([A-Za-z0-9_-]+)\]\]/g)) db.prepare('UPDATE audio_tracks SET fedi_open = 1 WHERE id IN (SELECT track_id FROM playlist_tracks WHERE playlist_id = ?)').run(m[1]); 221 223 } catch { /* non-fatal */ } 222 224 }
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)