openvibers/openvibe.mediahub Commits
Pics: load ov-upload.js from Shared, not as a site file (#409)
Changes
@@@ -282,7 +282,9 @@ ${signedIn(req) ? html`<label>Who can open it <select name="audience">${audienceseo.jsonLd.faq(faq),],styles: ['kit.css', 'showcase.css'],-- scripts: ['js/pics.js', 'js/pics-gallery.js', 'ov-upload.js'],++ scripts: ['js/pics.js', 'js/pics-gallery.js'],++ // pics.js's duplicate check hashes with window.OVUpload: Shared's file, served from /shared/, not the site's.++ sharedScripts: ['ov-upload.js'],body: html`${raw(showcase.hero({title: 'Share pictures.', accent: 'Discover something new.',lede: 'Drop a picture, get a link to share or embed anywhere: on a forum, in a chat, on your site. Browse what people chose to publish, or keep yours unlisted. Location and camera details are removed from every file.',@@@ -82,6 +82,10 @@ function multipart(fields, file) {const home = (await t.get('/', { headers: PICS })).text;assert.strictEqual((home.match(/<h1[\s>]/g) || []).length, 1, 'one h1');assert.match(home, /<title>OpenVibe\.Pics: share and embed pictures with a link<\/title>/);++ // The duplicate check's hasher is Shared's ov-upload.js, from /shared/; the site never serves its own (a 404++ // the 11-11 browser sweep found).++ assert.ok(!/src="[^"]*\/ov-upload\.js\?v=dev"/.test(home) && !home.includes('src="/ov-upload.js'), 'not loaded as a site file');++ assert.match(home, /<script src="[^"]*\/shared\/[^"]*ov-upload[^"]*\.js[^"]*" defer><\/script>/, 'loaded from Shared');const sections = ['How it works', 'The links a picture gets', 'Upload from your own app', 'What a free account gets', 'Questions', 'More on OpenVibe'];// The showcase kit puts every section title in a span inside its heading.assert.deepStrictEqual(sections.filter((h) => !home.includes(`${h}</span></h2>`)), [], 'every section is there');
@@ -282,7 +282,9 @@ ${signedIn(req) ? html`<label>Who can open it <select name="audience">${audience
@@ -282,7 +282,9 @@ ${signedIn(req) ? html`<label>Who can open it <select name="audience">${audience
seo.jsonLd.faq(faq),
seo.jsonLd.faq(faq),
],
],
styles: ['kit.css', 'showcase.css'],
styles: ['kit.css', 'showcase.css'],
- scripts: ['js/pics.js', 'js/pics-gallery.js', 'ov-upload.js'],
+ scripts: ['js/pics.js', 'js/pics-gallery.js'],
+ // pics.js's duplicate check hashes with window.OVUpload: Shared's file, served from /shared/, not the site's.
+ sharedScripts: ['ov-upload.js'],
body: html`${raw(showcase.hero({
body: html`${raw(showcase.hero({
title: 'Share pictures.', accent: 'Discover something new.',
title: 'Share pictures.', accent: 'Discover something new.',
lede: 'Drop a picture, get a link to share or embed anywhere: on a forum, in a chat, on your site. Browse what people chose to publish, or keep yours unlisted. Location and camera details are removed from every file.',
lede: 'Drop a picture, get a link to share or embed anywhere: on a forum, in a chat, on your site. Browse what people chose to publish, or keep yours unlisted. Location and camera details are removed from every file.',
@@ -82,6 +82,10 @@ function multipart(fields, file) {
@@ -82,6 +82,10 @@ function multipart(fields, file) {
const home = (await t.get('/', { headers: PICS })).text;
const home = (await t.get('/', { headers: PICS })).text;
assert.strictEqual((home.match(/<h1[\s>]/g) || []).length, 1, 'one h1');
assert.strictEqual((home.match(/<h1[\s>]/g) || []).length, 1, 'one h1');
assert.match(home, /<title>OpenVibe\.Pics: share and embed pictures with a link<\/title>/);
assert.match(home, /<title>OpenVibe\.Pics: share and embed pictures with a link<\/title>/);
+ // The duplicate check's hasher is Shared's ov-upload.js, from /shared/; the site never serves its own (a 404
+ // the 11-11 browser sweep found).
+ assert.ok(!/src="[^"]*\/ov-upload\.js\?v=dev"/.test(home) && !home.includes('src="/ov-upload.js'), 'not loaded as a site file');
+ assert.match(home, /<script src="[^"]*\/shared\/[^"]*ov-upload[^"]*\.js[^"]*" defer><\/script>/, 'loaded from Shared');
const sections = ['How it works', 'The links a picture gets', 'Upload from your own app', 'What a free account gets', 'Questions', 'More on OpenVibe'];
const sections = ['How it works', 'The links a picture gets', 'Upload from your own app', 'What a free account gets', 'Questions', 'More on OpenVibe'];
// The showcase kit puts every section title in a span inside its heading.
// The showcase kit puts every section title in a span inside its heading.
assert.deepStrictEqual(sections.filter((h) => !home.includes(`${h}</span></h2>`)), [], 'every section is there');
assert.deepStrictEqual(sections.filter((h) => !home.includes(`${h}</span></h2>`)), [], 'every section is there');