Changeset e27b8db in Klonkt for src/routes/posts.js
- Timestamp:
- 07/29/2026 10:04:36 AM (6 weeks ago)
- Branches:
- main
- Children:
- 329873e
- Parents:
- 88d7c8f
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r88d7c8f re27b8db 1084 1084 function gateEmbeds(site, rows) { 1085 1085 if (!site || !rows.length) return rows; 1086 let isWard = false; 1087 try { isWard = Guardianship.listGuardians(site.slug).length > 0; } catch { /* no relations yet */ } 1088 if (Guardianship.externalEmbedsAllowed(site.external_embeds, isWard)) return rows; 1086 if (embedsAllowedFor(site)) return rows; 1089 1087 return rows.map((r) => (r && r.embed_json ? { ...r, embed_json: null } : r)); 1088 } 1089 1090 function isWardSite(site) { 1091 try { return !!site && Guardianship.listGuardians(site.slug).length > 0; } catch { return false; } 1092 } 1093 function embedsAllowedFor(site) { 1094 return !site || Guardianship.externalEmbedsAllowed(site.external_embeds, isWardSite(site)); 1095 } 1096 /** 1097 * May a third-party PLAYER run inside this page? (FEP-633c 5.6, the heavier 1098 * sibling of the preview gate.) This was the hole: the player iframe is built 1099 * from the note's content by timelineEmbedHtml, on a path that never touched 1100 * gateEmbeds. A ward whose guardians had allowed nothing still got the full 1101 * YouTube player on the web, while the app showed nothing at all: the heavy 1102 * thing open, the light thing shut. Playback also requires the preview gate, 1103 * because you cannot play what you may not see. 1104 */ 1105 function playbackAllowedFor(site) { 1106 if (!site) return true; 1107 if (!embedsAllowedFor(site)) return false; 1108 return Guardianship.externalPlaybackAllowed(site.external_playback, isWardSite(site)); 1090 1109 } 1091 1110 … … 1098 1117 const rows = gateEmbeds(site, site ? ActivityPubService.getTimeline(site.slug, FEED_PAGE + 1, offset) : []); 1099 1118 const hasMore = rows.length > FEED_PAGE; 1119 // Players (a third party's engine inside our page) ride the playback gate; 1120 // a Klonkt site's own audio embed is ours and stays. 1121 const mayPlay = playbackAllowedFor(site); 1100 1122 const timeline = rows.slice(0, FEED_PAGE).map((p) => { 1101 let embedHtml = timelineEmbedHtml(p.content);1123 let embedHtml = mayPlay ? timelineEmbedHtml(p.content) : null; 1102 1124 let content = p.content; 1103 1125 let embedUrl = null;
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)