openvibers/openvibe.mediahub Commits

Video: /updates — what shipped on openvibe.video (the shared update log) (#52)

OP OpenVibers committed 29 days ago · 09a363bd4f · 3 files, +21 −2

openvibe.video gets `/updates`: what shipped on the site, from the network's shared update log (`updatesBody` + `shipped.js`), as on openvibe.download and every other OpenVibe site. A site-wide crawl found openvibe.help linking it (404).

- It is MediaHub's log (`data-service="media-hub"`), since Video and Download ship together, titled "What shipped on OpenVibe.Video".
- One `<h1>`. The Video footer links it, and the video host's sitemap lists it.

`test/video-pages.test.js` adds a check for the page, the heading, the script and the sitemap. All pass.

Changes

ddiff --git a/server/video/layout.js b/server/video/layout.js
iindex 0cf915e..cf95b32 100644
---- a/server/video/layout.js
++++ b/server/video/layout.js
@@@ -83,7 +83,7 @@ ${render(o.body)}
logoutUrl: '/auth/logout?next={path}',
silentLogin: `${String(o.baseUrl).replace(/\/+$/, '')}/auth/login?silent=1&next={url}`,
},
-- footer: { service: 'media-hub', variant: 'compact', brandName: SITE_NAME },
++ footer: { service: 'media-hub', variant: 'compact', brandName: SITE_NAME, updates: '/updates' },
head,
body,
});
ddiff --git a/server/video/pages.js b/server/video/pages.js
iindex cb71586..309c4c9 100644
---- a/server/video/pages.js
++++ b/server/video/pages.js
@@@ -23,7 +23,8 @@ const seo = require('openvibe-shared/seo');
const ovServe = require('openvibe-shared/serve');
const { asyncRouter } = require('../http/router');
const { sameOrigin } = require('../http/principal');
--const { html, notice } = require('../render/html');
++const { html, raw, notice } = require('../render/html');
++const frame = require('openvibe-shared/frame');
const { send, asset, assetVersion, SITE_NAME } = require('./layout');
const { createLiveClient, LiveRefusedError } = require('./live-client');
const { createChatClient } = require('./chat-client');
@@@ -643,6 +644,14 @@ ${kind === 'vod' ? html`<label class="ovv-field"><span>Description</span><textar
});
});
++ // ── What shipped: the shared update log, as on every OpenVibe site (MediaHub's log: Video and Download ship together) ──
++ r.get('/updates', (req, res) => page(req, res, {
++ index: true,
++ title: 'What shipped on OpenVibe.Video',
++ description: 'Every change deployed to OpenVibe.Video, newest first.',
++ body: raw(frame.updatesBody({ service: 'media-hub', siteName: 'OpenVibe.Video' }) + `<script src="${ovServe.url('shipped.js')}" defer></script>`),
++ }));
++
// ── WebVTT tracks ───────────────────────────────────────
r.get('/v/:id/captions.vtt', async (req, res) => {
const id = String(req.params.id || '');
@@@ -1140,6 +1149,7 @@ ${isOwner ? html`<p class="ovv-fine">You can reorder items with the up and down
}
const urls = [
{ loc: `${base}/`, lastmod: newest(items.map((it) => it.created_at)) },
++ { loc: `${base}/updates` },
...items.map((it) => ({ loc: `${base}${it.kind === 'clip' ? '/c/' : '/v/'}${Number(it.id)}`, lastmod: day(it.created_at) })),
...[...channels].map(([u, d]) => ({ loc: `${base}/@${u}`, lastmod: d })),
].map((u) => (u.lastmod ? u : { loc: u.loc }));
ddiff --git a/test/video-pages.test.js b/test/video-pages.test.js
iindex 671eee9..4cffab6 100644
---- a/test/video-pages.test.js
++++ b/test/video-pages.test.js
@@@ -330,6 +330,15 @@ function countOccurrences(haystack, needle) {
assert.strictEqual(r.text, 'WEBVTT\n\n00:00:10.000 --> 00:00:30.000\nIntro &amp; setup\n\n00:00:30.000 --> 00:00:45.000\nThe &lt;main&gt; part\n');
});
++ await check('/updates: the shared update log on the video host, one heading, in the sitemap', async () => {
++ const r = await getVideo('/updates');
++ assert.strictEqual(r.status, 200);
++ assert.ok(r.text.includes('<h1>What shipped on OpenVibe.Video</h1>') && r.text.includes('data-ov-shipped="log" data-service="media-hub"'));
++ assert.strictEqual((r.text.match(/<h1[\s>]/g) || []).length, 1);
++ assert.match(r.text, /<script src="\/shared\/shipped\.js\?v=[0-9a-f]+" defer><\/script>/);
++ assert.match((await getVideo('/sitemap.xml')).text, /<loc>[^<]+\/updates<\/loc>/);
++ });
++
await check('the sitemap lists public items and leaves the unlisted VOD out', async () => {
const r = await getVideo('/sitemap.xml');
assert.match(r.text, /<loc>https:\/\/openvibe\.video\/<\/loc><lastmod>\d{4}-\d{2}-\d{2}<\/lastmod>/, 'the home, dated by the newest item');