openvibers/openvibe.mediahub Commits

Guide the picture upload step (#392)

OP OpenVibers committed 2 days ago · 06fc85e502 · 2 files, +3 −1

Changes

ddiff --git a/server/pics/pages.js b/server/pics/pages.js
iindex bbf6853..4f77d2f 100644
---- a/server/pics/pages.js
++++ b/server/pics/pages.js
@@@ -223,7 +223,7 @@ function createPicsRoutes(ctx) {
<span class="ovp-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" width="40" height="40"><path fill="currentColor" d="M19 5v14H5V5h14m0-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2Zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14Z"/></svg></span>
<p class="ovp-drop-title">Drop pictures here, paste one, or choose files</p>
<p class="ovp-drop-hint">JPEG, PNG, GIF, WebP or AVIF, up to ${formatBytes(max)} each. Location and camera details are removed.</p>
--<label class="ovp-btn ovp-btn--primary ovp-file"><input type="file" name="file" accept="image/jpeg,image/png,image/gif,image/webp,image/avif" required data-pics-input> Choose a picture</label>
++<label class="ovp-btn ovp-btn--primary ovp-file" data-ov-guide="pics.upload"><input type="file" name="file" accept="image/jpeg,image/png,image/gif,image/webp,image/avif" required data-pics-input> Choose a picture</label>
<div class="ovp-drop-fields"><label for="up-title">Title (optional)</label><input id="up-title" name="title" type="text" maxlength="120" placeholder="What is it?"></div>
<button class="ovp-btn ovp-btn--primary ovp-nojs-submit" type="submit">Upload</button>
</div>
ddiff --git a/test/pics.test.js b/test/pics.test.js
iindex dff9d1b..efad4d6 100644
---- a/test/pics.test.js
++++ b/test/pics.test.js
@@@ -70,6 +70,8 @@ function multipart(fields, file) {
const home = await t.get('/', { headers: PICS });
assert.strictEqual(home.status, 200);
assert.ok(home.text.includes('Share pictures.') && home.text.includes('Sign in to upload'));
++ const signedInHome = await t.get('/', { headers: PICS, as: kim });
++ assert.ok(signedInHome.text.includes('data-ov-guide="pics.upload"'), 'the signed-in upload page has the guide target');
assert.ok(/<script type="application\/ld\+json">[^<]*"@type":"WebSite"/.test(home.text), 'the home says what the site is (JSON-LD)');
assert.strictEqual((await t.get('/files', { headers: PICS, as: kim })).status, 404, 'no drive pages on the pics host');
assert.ok((await t.get('/', { headers: { Host: 'openvibe.download' } })).text.indexOf('Share pictures.') === -1, 'the drive host is not Pics');