openvibers/openvibe.chat Commits

Pages name a crawlable icon (apple-touch-icon) and the installable app's manifest, both the shared set (search engines cannot use the data: favicon; there was no manifest) (#117)

OP OpenVibers committed 28 days ago · a6a68cd586 · 2 files, +12 −0

Changes

ddiff --git a/server/web/layout.js b/server/web/layout.js
iindex 8e93256..cc19efb 100644
---- a/server/web/layout.js
++++ b/server/web/layout.js
@@@ -11,6 +11,11 @@ const ovServe = require('openvibe-shared/serve');
const sharedSeo = require('openvibe-shared/seo');
const social = require('openvibe-shared/social');
const appIcon = require('openvibe-shared/app-icon');
++// A crawlable icon (search engines cannot use the data: favicon) and the installable app's manifest, both the shared set.
++const INSTALL_LINKS = [
++ `<link rel="apple-touch-icon" href="${require('openvibe-shared/app-icons').url('chat', 192)}">`,
++ `<link rel="manifest" href="${ovServe.manifestUrl('chat')}">`,
++].join('\n');
const frame = require('openvibe-shared/frame');
const SITE_NAME = 'OpenVibe.Chat';
@@@ -114,6 +119,7 @@ function renderPage(o) {
<meta name="viewport" content="width=device-width, initial-scale=1">
${head}
${appIcon.headTags({ site: 'network' })}
++${INSTALL_LINKS}
<link rel="stylesheet" href="${asset('chat.css')}">
<link rel="stylesheet" href="${ovServe.url('items.css')}">
${o.showcase ? `<link rel="stylesheet" href="${ovServe.url('showcase.css')}">` : ''}
ddiff --git a/test/web.test.js b/test/web.test.js
iindex c103673..3af3bbb 100644
---- a/test/web.test.js
++++ b/test/web.test.js
@@@ -176,6 +176,12 @@ t('sign-in, the Frame, robots, sitemap and /updates', async () => {
const up = await req('GET', '/updates');
assert.strictEqual(up.status, 200);
assert.match(up.text, /data-ov-shipped/);
++ // A crawlable icon and the installable app's manifest (the shared set, which this site serves).
++ const icon = /<link rel="apple-touch-icon" href="(\/shared\/icons\/[^"]+)">/.exec(up.text);
++ const manifest = /<link rel="manifest" href="(\/shared\/manifest\/chat\.webmanifest[^"]*)">/.exec(up.text);
++ assert.ok(icon && manifest, 'apple-touch-icon and manifest links');
++ assert.strictEqual((await req('GET', icon[1])).status, 200);
++ assert.strictEqual((await req('GET', manifest[1])).status, 200);
assert.strictEqual((await req('GET', '/api/nope')).status, 404, 'the API keeps its JSON 404');
});