openvibers/openvibe.mediahub Commits
Upload watch pages: Ask your agent chip beside Share (#320)
Changes
@@@ -22,7 +22,7 @@const express = require('express');const cache = require('openvibe-shared/cache-policy');const { sameOrigin } = require('../http/principal');--const { html, raw, notice } = require('../render/html');++const { html, raw, notice, askAgent } = require('../render/html');const { UploadError } = require('./uploads');const REASON_TEXT = {@@@ -363,7 +363,7 @@ ${what}${channel ? html`<a class="ovv-avatar" href="/@${channel}" aria-hidden="true" tabindex="-1">${channel.slice(0, 1).toUpperCase()}${/^[A-Za-z0-9_]{1,32}$/.test(channel) ? html`<img src="${ctx.config.networkUrl}/avatar/${channel}" alt="" loading="lazy">` : ''}</a>` : ''}<div class="ovv-byline-text">${channel ? html`<a class="ovv-channel-name" href="/@${channel}">@${channel}</a>` : ''}</div>--<div class="ovv-byline-actions">${saveForm}${raw(shareButton({ cls: 'ovv-btn', url: `${ctx.config.video.url}${watchPath}`, title: row.title, text: about, image: thumb || '', timeFrom: ready && vod ? '.ovv-player' : null }))}</div>++<div class="ovv-byline-actions">${saveForm}${raw(shareButton({ cls: 'ovv-btn', url: `${ctx.config.video.url}${watchPath}`, title: row.title, text: about, image: thumb || '', timeFrom: ready && vod ? '.ovv-player' : null }))}${raw(askAgent({ text: `About the video “${row.title}” on OpenVibe.Video (${ctx.config.video.url}${watchPath}): ` }))}</div></div>${row.description ? html`<section class="ovv-panel ovv-description"><p>${row.description}</p></section>` : ''}${aiDone && ai.overview ? html`<section class="ovv-panel" aria-labelledby="h-ai"><h2 id="h-ai">About this video</h2><p>${ai.overview}</p><p class="ovv-fine">Written by AI from the video's sound and pictures (OpenVibe.AI, run on OpenVibe's own servers).</p>@@@ -107,6 +107,11 @@ function vreq(base, path, { method = 'GET', cookie, form, json, body, same = truassert.ok(page.text.includes('src="https://openvibe.media/v/vod-1.mp4"') && page.text.includes('data-ovv-hls="https://openvibe.media/o/med_vod1/master.m3u8"'), 'the file, and HLS on the same origin');assert.ok(page.text.includes('Line one\nLine two'));assert.ok(page.text.includes('<a class="ovv-channel-name" href="/@kim">@kim</a>'));++ // The upload's watch page carries the Ask your agent chip beside Share too.++ const asks = page.text.match(/<button[^>]*data-ov-ask[^>]*>/g) || [];++ assert.strictEqual(asks.length, 1, 'one Ask your agent chip: ' + asks.join(' | '));++ assert.match(asks[0], /data-ov-ask="About the video “Trip to the coast” on OpenVibe\.Video \(https:\/\/openvibe\.video\/watch\?v=[A-Za-z0-9_-]+\): "/);++ assert.ok(asks[0].includes('class="ovk-ask ovk-btn'), 'the shared kit chip');assert.ok(page.text.includes('Report this video'), 'others may report it');assert.ok(!page.text.includes('Manage this video'));const wid = [...t.media.vods.values()][0].watch_id;
@@ -22,7 +22,7 @@
@@ -22,7 +22,7 @@
const express = require('express');
const express = require('express');
const cache = require('openvibe-shared/cache-policy');
const cache = require('openvibe-shared/cache-policy');
const { sameOrigin } = require('../http/principal');
const { sameOrigin } = require('../http/principal');
-const { html, raw, notice } = require('../render/html');
+const { html, raw, notice, askAgent } = require('../render/html');
const { UploadError } = require('./uploads');
const { UploadError } = require('./uploads');
const REASON_TEXT = {
const REASON_TEXT = {
@@ -363,7 +363,7 @@ ${what}
@@ -363,7 +363,7 @@ ${what}
${channel ? html`<a class="ovv-avatar" href="/@${channel}" aria-hidden="true" tabindex="-1">${channel.slice(0, 1).toUpperCase()}${/^[A-Za-z0-9_]{1,32}$/.test(channel) ? html`<img src="${ctx.config.networkUrl}/avatar/${channel}" alt="" loading="lazy">` : ''}</a>` : ''}
${channel ? html`<a class="ovv-avatar" href="/@${channel}" aria-hidden="true" tabindex="-1">${channel.slice(0, 1).toUpperCase()}${/^[A-Za-z0-9_]{1,32}$/.test(channel) ? html`<img src="${ctx.config.networkUrl}/avatar/${channel}" alt="" loading="lazy">` : ''}</a>` : ''}
<div class="ovv-byline-text">${channel ? html`<a class="ovv-channel-name" href="/@${channel}">@${channel}</a>` : ''}
<div class="ovv-byline-text">${channel ? html`<a class="ovv-channel-name" href="/@${channel}">@${channel}</a>` : ''}
</div>
</div>
-<div class="ovv-byline-actions">${saveForm}${raw(shareButton({ cls: 'ovv-btn', url: `${ctx.config.video.url}${watchPath}`, title: row.title, text: about, image: thumb || '', timeFrom: ready && vod ? '.ovv-player' : null }))}</div>
+<div class="ovv-byline-actions">${saveForm}${raw(shareButton({ cls: 'ovv-btn', url: `${ctx.config.video.url}${watchPath}`, title: row.title, text: about, image: thumb || '', timeFrom: ready && vod ? '.ovv-player' : null }))}${raw(askAgent({ text: `About the video “${row.title}” on OpenVibe.Video (${ctx.config.video.url}${watchPath}): ` }))}</div>
</div>
</div>
${row.description ? html`<section class="ovv-panel ovv-description"><p>${row.description}</p></section>` : ''}
${row.description ? html`<section class="ovv-panel ovv-description"><p>${row.description}</p></section>` : ''}
${aiDone && ai.overview ? html`<section class="ovv-panel" aria-labelledby="h-ai"><h2 id="h-ai">About this video</h2><p>${ai.overview}</p><p class="ovv-fine">Written by AI from the video's sound and pictures (OpenVibe.AI, run on OpenVibe's own servers).</p>
${aiDone && ai.overview ? html`<section class="ovv-panel" aria-labelledby="h-ai"><h2 id="h-ai">About this video</h2><p>${ai.overview}</p><p class="ovv-fine">Written by AI from the video's sound and pictures (OpenVibe.AI, run on OpenVibe's own servers).</p>
@@ -107,6 +107,11 @@ function vreq(base, path, { method = 'GET', cookie, form, json, body, same = tru
@@ -107,6 +107,11 @@ function vreq(base, path, { method = 'GET', cookie, form, json, body, same = tru
assert.ok(page.text.includes('src="https://openvibe.media/v/vod-1.mp4"') && page.text.includes('data-ovv-hls="https://openvibe.media/o/med_vod1/master.m3u8"'), 'the file, and HLS on the same origin');
assert.ok(page.text.includes('src="https://openvibe.media/v/vod-1.mp4"') && page.text.includes('data-ovv-hls="https://openvibe.media/o/med_vod1/master.m3u8"'), 'the file, and HLS on the same origin');
assert.ok(page.text.includes('Line one\nLine two'));
assert.ok(page.text.includes('Line one\nLine two'));
assert.ok(page.text.includes('<a class="ovv-channel-name" href="/@kim">@kim</a>'));
assert.ok(page.text.includes('<a class="ovv-channel-name" href="/@kim">@kim</a>'));
+ // The upload's watch page carries the Ask your agent chip beside Share too.
+ const asks = page.text.match(/<button[^>]*data-ov-ask[^>]*>/g) || [];
+ assert.strictEqual(asks.length, 1, 'one Ask your agent chip: ' + asks.join(' | '));
+ assert.match(asks[0], /data-ov-ask="About the video “Trip to the coast” on OpenVibe\.Video \(https:\/\/openvibe\.video\/watch\?v=[A-Za-z0-9_-]+\): "/);
+ assert.ok(asks[0].includes('class="ovk-ask ovk-btn'), 'the shared kit chip');
assert.ok(page.text.includes('Report this video'), 'others may report it');
assert.ok(page.text.includes('Report this video'), 'others may report it');
assert.ok(!page.text.includes('Manage this video'));
assert.ok(!page.text.includes('Manage this video'));
const wid = [...t.media.vods.values()][0].watch_id;
const wid = [...t.media.vods.values()][0].watch_id;