openvibers/openvibe.mediahub Commits

MediaHub: openvibe.video answers /release.json (the shared release check and the browser watch read it) (#50)

OP OpenVibers committed 29 days ago · dcd1507ac6 · 2 files, +11 −1

**openvibe.video answers `/release.json`, as every other OpenVibe site does.**

**Why:** `/release.json` was mounted after MediaHub's host routing, and on the video host that routing answers only the video pages. So `https://openvibe.video/release.json` was a 404.
- The shared release check (openvibe-shared's release-update) reads its own origin's `/release.json` to tell an open tab that a new release is out, so it never fired on openvibe.video.
- The host's browser watch reads the same file before it checks a site, so OpenVibe.Video (manifest `publicOrigin` https://openvibe.video) could not be watched.

**Change (`server/app.js`):** `release.mount()` (`/release.json`, plus `/metrics` on loopback only, as before) now comes ahead of the host routing, so both openvibe.download and openvibe.video answer it. Nothing else of the drive answers on the video host.

**Test:** `video-pages.test.js` asks the video host for `/release.json` and gets the release JSON. `auth-ops` (`/release.json` and loopback `/metrics`) and `caller-limits` pass.

Changes

ddiff --git a/server/app.js b/server/app.js
iindex 3297e0d..87f53f7 100644
---- a/server/app.js
++++ b/server/app.js
@@@ -122,6 +122,10 @@ async function createApp(opts = {}) {
app.use('/auth/', rateLimit({ windowMs: 15 * 60_000, limit: 60, standardHeaders: true, legacyHeaders: false }));
app.use('/auth', sso.routes());
++ // /release.json (and loopback /metrics) answer on both hosts: the shared release check on openvibe.video reads its own
++ // origin's /release.json, and so does the host's browser watch.
++ release.mount(app, { registry: metrics.registry });
++
// ── Host routing: openvibe.video is OpenVibe.Video; every other host (openvibe.download) stays
// the drive. On the video host the drive's pages, API and legal pages never answer.
const videoHost = (() => { try { return new URL(config.video.url).hostname; } catch { return null; } })();
@@@ -133,7 +137,6 @@ async function createApp(opts = {}) {
// ── Machine endpoints ───────────────────────────────────
app.get('/api/health', (_req, res) => res.json({ status: 'ok', service: 'openvibe-media-hub', version: VERSION }));
-- release.mount(app, { registry: metrics.registry });
const readiness = createServiceReadiness({ s, config, release: release.release, valkey });
app.get('/api/ready', readiness.handler);
ddiff --git a/test/video-pages.test.js b/test/video-pages.test.js
iindex 2deced5..671eee9 100644
---- a/test/video-pages.test.js
++++ b/test/video-pages.test.js
@@@ -221,6 +221,13 @@ function countOccurrences(haystack, needle) {
live.setChatDown(false);
});
++ await check('the video host answers /release.json too (the shared release check reads its own origin)', async () => {
++ const r = await getVideo('/release.json');
++ assert.strictEqual(r.status, 200);
++ const j = JSON.parse(r.text);
++ assert.ok(j.release && j.service, JSON.stringify(j).slice(0, 200));
++ });
++
await check('the video home shows both latest grids and links the watch pages', async () => {
const r = await getVideo('/');
assert.strictEqual(r.status, 200);