openvibers/openvibe.space Commits

OpenVibe.Space has its own update log at /updates (it sent readers to the community's log, which lists the community's changes); the navbar and footer link it (#71)

OP OpenVibers committed 27 days ago · b2aea1549b · 3 files, +19 −4

Changes

ddiff --git a/server/app.js b/server/app.js
iindex d30e81f..1f1bf23 100644
---- a/server/app.js
++++ b/server/app.js
@@@ -139,8 +139,14 @@ async function createApp(opts = {}) {
app.use('/auth', createAuthRoutes(config, auth));
{ const legal = require('openvibe-shared/legal'); app.get(legal.PATHS, legal.handler({ id: 'space', service: 'space', host: 'openvibe.space', name: 'OpenVibe.Space', profile: 'ugc' })); app.get('/tos', (_req, res) => res.redirect(301, '/terms')); }
-- // /updates: Space ships with the community's log until it has one of its own.
-- app.get('/updates', (_req, res) => res.redirect(302, `${config.communityUrl}/updates`));
++ // /updates: what shipped on OpenVibe.Space, the shared update log every OpenVibe site has (it pointed at the
++ // community's log, which lists the community's changes, not this site's).
++ app.get('/updates', (req, res) => {
++ const { renderPage } = require('./render/layout');
++ const frame = require('openvibe-shared/frame');
++ const body = frame.updatesBody({ service: 'space', siteName: 'OpenVibe.Space' }) + `<script src="${require('openvibe-shared/serve').url('shipped.js')}" defer></script>`;
++ res.type('html').send(renderPage({ title: 'What shipped on OpenVibe.Space', description: 'Every change deployed to OpenVibe.Space, newest first, from the OpenVibe network\'s shared update log.', canonicalPath: '/updates', body, viewer: req.viewer, config, path: req.originalUrl, indexable: true }));
++ });
app.get('/api/health', (_req, res) => res.json({ status: 'ok', service: 'openvibe-space', version: VERSION }));
// GET /release.json (ADR-016) and POST /release-metrics: open tabs' update reports (a same-origin
ddiff --git a/server/render/layout.js b/server/render/layout.js
iindex da2d301..cfb45e7 100644
---- a/server/render/layout.js
++++ b/server/render/layout.js
@@@ -87,7 +87,7 @@ function footerInit(opts) {
variant: opts.footerVariant || 'full',
mount: '#ov-footer',
brandName: SITE_NAME,
-- updates: `${config.communityUrl}/updates`, // this site ships with the community's log for now
++ updates: '/updates',
tagline: 'Static hosting for the people of OpenVibe.',
legalBase: config.liveUrl,
links: [{
@@@ -130,7 +130,7 @@ function renderPage(o) {
jsonLd: o.jsonLd, alternates: o.alternates,
summary: description, url: canonical, updated: o.modified,
navbar: nav, home: '/', navLinks: nav.links.map(({ label, href }) => ({ label, href })),
-- footer: { service: 'space', variant: 'full', updates: `${config.communityUrl}/updates` },
++ footer: { service: 'space', variant: 'full', updates: '/updates' },
head: [
o.published ? `<meta property="article:published_time" content="${escapeHtml(o.published)}">` : '',
o.modified ? `<meta property="article:modified_time" content="${escapeHtml(o.modified)}">` : '',
ddiff --git a/test/home.test.js b/test/home.test.js
iindex 5283199..b72ce44 100644
---- a/test/home.test.js
++++ b/test/home.test.js
@@@ -37,6 +37,15 @@ const { boot, check, done } = require('./helpers/app');
assert.doesNotMatch(r.text, /href="\/s"/, 'nothing links a /s that only redirects');
});
++ await check('/updates is this site\'s own update log, and the footer links it', async () => {
++ const r = await t.get('/updates');
++ assert.strictEqual(r.status, 200);
++ assert.ok(r.text.includes('What shipped on OpenVibe.Space'));
++ assert.ok(r.text.includes('data-ov-shipped') && r.text.includes('data-service="space"'), 'the shared log, for space');
++ const home = await t.get('/');
++ assert.ok(!home.text.includes('openvibe.community/updates'), 'the footer no longer sends readers to the community\'s log');
++ });
++
await check('robots.txt points at the sitemap and keeps the private paths out', async () => {
const r = await t.get('/robots.txt');
assert.strictEqual(r.status, 200);