openvibers/openvibe.live Commits

Test: the public channel route lists a live stream's viewer_places (OpenVibe, then its restream with count and link) and keeps the restream key private (#376)

OP OpenVibers committed 18 days ago · 4097c0168f · 1 file, +16 −0

Changes

ddiff --git a/test/public-serializers.test.js b/test/public-serializers.test.js
iindex e1d86078..8155bbaf 100644
---- a/test/public-serializers.test.js
++++ b/test/public-serializers.test.js
@@@ -89,6 +89,22 @@ async function check(name, fn) {
assert.strictEqual(r.body.managed_streams[0].title, 'Main slot');
});
++ await check('a live stream lists where it is watched (viewer_places): OpenVibe, then its restreams, no ingest key', async () => {
++ const dest = await db.createRestreamDestination(901, {
++ platform: 'twitch', name: 'my twitch', server_url: 'rtmp://live.twitch.tv/app', stream_key: 'T'.repeat(30),
++ channel_url: 'https://www.twitch.tv/keyowner', managed_stream_id: ms.id, enabled: 1,
++ });
++ require('../server/streaming/restream-manager').setViewerCount(dest.id, 12, true);
++ const r = await getJson('/api/streams/channel/keyowner?pollOnly=1');
++ const live = r.body.streams.find((s) => s.is_live);
++ assert.deepStrictEqual(live.viewer_places.places.map((p) => [p.key, p.count, p.url]),
++ [['openvibe', 0, null], ['twitch', 12, 'https://www.twitch.tv/keyowner']]);
++ assert.strictEqual(live.viewer_places.total, 12);
++ assert.strictEqual(live.total_viewer_count, 12);
++ assert.ok(!r.text.includes('T'.repeat(30)), 'the restream key stays private');
++ assert.deepStrictEqual(findSecrets(r.body), []);
++ });
++
await check('stream detail keeps the channel but not its ZIP', async () => {
const live = await raw.prepare('SELECT id FROM streams WHERE user_id = 901').get();
const r = await getJson(`/api/streams/${live.id}`);