openvibers/openvibe.connect Commits

The Space door is labelled with the site it opens, and legal pages keep the list (#123)

OP OpenVibers committed 1 days ago · ce6dec4c84 · 3 files, +59 −2

The one off-site row said "Sites" without naming OpenVibe.Space; it now says "Sites on Space". /terms, /privacy and /dmca showed the shared navbar's fallback and now send the same Connect / Sites on Space list as every other page.

Changes

ddiff --git a/server/app.js b/server/app.js
iindex 679ac9f..e4f4e17 100644
---- a/server/app.js
++++ b/server/app.js
@@@ -243,7 +243,15 @@ async function createApp(opts = {}) {
// ── Sign-in (OAuth2 + PKCE client of OpenVibe.Network) ──
app.use('/auth/', rateLimit({ windowMs: 15 * 60_000, limit: 60, skip: (req) => req.path === '/me' || req.path === '/navbar-token', standardHeaders: true, legacyHeaders: false }));
app.use('/auth', sso.routes());
-- { const legal = require('openvibe-shared/legal'); app.get(legal.PATHS, legal.handler({ id: 'connect', service: 'connect', host: 'connect.openvibe.link', name: 'OpenVibe Connect', profile: 'ugc' })); }
++ { const legal = require('openvibe-shared/legal');
++ // Shared's legal template starts the navbar without links, so /terms and /privacy showed its fallback
++ // (Home, My Account, Themes) instead of Connect's own pages. Add Connect's list to that init call.
++ const navLinks = JSON.stringify(require('./render/layout').NAV);
++ app.get(legal.PATHS, (req, res, next) => {
++ const send = res.send.bind(res);
++ res.send = (body) => send(String(body).replace('try{OpenVibeNavbar.init({service:', `try{OpenVibeNavbar.init({links:${navLinks},service:`));
++ next();
++ }, legal.handler({ id: 'connect', service: 'connect', host: 'connect.openvibe.link', name: 'OpenVibe Connect', profile: 'ugc' })); }
// ── Webhooks to a share's hooks, and Events' deliveries of them back (CON-15; /internal/ is loopback only) ──
app.use(createHookRoutes(ctx));
ddiff --git a/server/render/layout.js b/server/render/layout.js
iindex fe460fe..653dffe 100644
---- a/server/render/layout.js
++++ b/server/render/layout.js
@@@ -23,7 +23,7 @@ const TAGLINE = 'Your computer, on the web, privately.';
const PUBLIC_DIR = path.join(__dirname, '..', '..', 'public');
const NAV = [
{ label: 'Connect', href: '/', icon: 'fa-plug' },
-- { label: 'Sites', href: 'https://openvibe.space', icon: 'fa-globe' },
++ { label: 'Sites on Space', href: 'https://openvibe.space', icon: 'fa-globe' },
];
const API_BASE = 'https://connect.openvibe.link';
ddiff --git a/test/page-links.test.js b/test/page-links.test.js
nnew file mode 100644
iindex 0000000..53efa3a
---- /dev/null
++++ b/test/page-links.test.js
@@@ -0,0 +1,49 @@
++'use strict';
++// Every page of connect.openvibe.link gives the shared navbar Connect's own page list (the owner, 2026-11-12), and
++// the row that leaves for OpenVibe.Space is labelled with the site it opens.
++const assert = require('assert');
++const { boot } = require('./helpers/boot');
++const { check, done } = require('./helpers/check');
++const { NAV } = require('../server/render/layout');
++
++function initLinks(html) {
++ const at = html.indexOf('OpenVibeNavbar.init');
++ if (at < 0) return null;
++ const start = html.indexOf('links', at);
++ const open = html.indexOf('[', start);
++ let depth = 0, q = null, esc = false;
++ for (let i = open; i < html.length; i += 1) {
++ const c = html[i];
++ if (q) { if (esc) esc = false; else if (c === '\\') esc = true; else if (c === q) q = null; continue; }
++ if (c === '"' || c === "'") { q = c; continue; }
++ if (c === '[') depth += 1; else if (c === ']') { depth -= 1; if (!depth) return JSON.parse(html.slice(open, i + 1)); }
++ }
++ return null;
++}
++
++(async () => {
++ const t = await boot();
++ try {
++ const own = NAV.map(({ label, href }) => ({ label, href }));
++ await check('every page sends Connect\'s own list, and the Space row names Space', async () => {
++ for (const path of ['/', '/terms', '/privacy', '/dmca']) {
++ const r = await t.get(path);
++ assert.ok([200, 301, 302].includes(r.status), `${path} answered ${r.status}`);
++ if (r.status !== 200) continue;
++ const links = (initLinks(r.text) || []).map(({ label, href }) => ({ label, href }));
++ assert.deepStrictEqual(links, own, `${path} sends Connect's list`);
++ }
++ const space = own.find((l) => l.href.includes('openvibe.space'));
++ assert.ok(space && /space/i.test(space.label), 'the off-site row names OpenVibe.Space');
++ });
++ await check('every row is a route or a labelled door', async () => {
++ for (const { href } of own) {
++ if (!href.startsWith('/')) continue;
++ const r = await t.get(href);
++ assert.notStrictEqual(r.status, 404, `${href} is a route`);
++ assert.ok(r.status < 500, `${href} does not fail (${r.status})`);
++ }
++ });
++ } finally { await t.close(); }
++ done();
++})().catch((e) => { console.error(e); process.exit(1); });