Changeset e27b8db in Klonkt for test/gated-settings.test.js
- Timestamp:
- 07/29/2026 10:04:36 AM (6 weeks ago)
- Branches:
- main
- Children:
- 329873e
- Parents:
- 88d7c8f
- File:
-
- 1 edited
-
test/gated-settings.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
test/gated-settings.test.js
r88d7c8f re27b8db 134 134 'two of three agreed, so the ward may see link previews'); 135 135 }); 136 137 // Playback is the heavier sibling of the preview (5.6): seeing that a video 138 // exists is one decision, letting a third party's player run inside the app is 139 // another. The hole this closes: the web Krant built the YouTube iframe from 140 // the note's content on a path that never touched the gate, so a ward whose 141 // guardians had allowed nothing still got the full player, while the app 142 // showed nothing at all. The heavy thing open, the light thing shut. 143 test('a player URL rides only when the playback gate is open', async () => { 144 const AP2 = (await import('../src/services/ActivityPubService.js')).default; 145 const yt = JSON.stringify({ url: 'https://www.youtube.com/watch?v=HetoL4XpHwY', title: 'x', media: [] }); 146 147 const shut = AP2.timelineEmbed(yt); 148 assert.ok(shut && shut.url, 'the card itself still travels'); 149 assert.equal(shut['shaer:playerUrl'], undefined, 'no player without the gate'); 150 151 const open = AP2.timelineEmbed(yt, { playback: true }); 152 assert.match(open['shaer:playerUrl'], /^https:\/\/www\.youtube-nocookie\.com\/embed\/HetoL4XpHwY/, 153 'privacy-enhanced only: nocookie, no related videos'); 154 assert.match(open['shaer:playerUrl'], /rel=0/); 155 }); 156 157 test('a page we will not frame simply stays a thumbnail', async () => { 158 const AP2 = (await import('../src/services/ActivityPubService.js')).default; 159 const page = JSON.stringify({ url: 'https://yougubrands.com/about', title: 'About', media: [] }); 160 assert.equal(AP2.timelineEmbed(page, { playback: true })['shaer:playerUrl'], undefined); 161 assert.equal(AP2.playerUrlFor('https://nos.nl/artikel/1'), null); 162 // PeerTube is decentralised, so it is matched by shape, not by a host list. 163 assert.equal(AP2.playerUrlFor('https://tilvids.com/w/abc123def'), 'https://tilvids.com/videos/embed/abc123def'); 164 }); 165 166 test('playback needs the preview gate: you cannot play what you may not see', async () => { 167 const G2 = await import('../src/services/guardianship/index.js'); 168 // Both auto (a ward): both shut. 169 assert.equal(G2.externalEmbedsAllowed(null, true), false); 170 assert.equal(G2.externalPlaybackAllowed(null, true), false); 171 // Guardians opened previews only: playback stays a separate decision. 172 assert.equal(G2.externalEmbedsAllowed(1, true), true); 173 assert.equal(G2.externalPlaybackAllowed(null, true), false); 174 // An adult account has nothing gated. 175 assert.equal(G2.externalPlaybackAllowed(null, false), true); 176 });
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)