openvibers/openvibe.chat Commits
A stream chat row names the channel by its @handle (#492)
Changes
@@@ -128,10 +128,10 @@ const listSection = (id, title, more, rows) => `<section class="oc-home-sec oc-hfunction streamsSection(a, app) {if (!a.streams.length) return '';if (app) {-- return listSection('oc-h-streams', 'Stream chats', `<a href="${LIVE}/">Who is live</a>`, a.streams.map((s) => row(`${LIVE}/@${esc(s.username)}`, s.display_name, ui.initials(s.display_name), s.live ? '<span class="oc-badge oc-badge-live">Live</span>' : '',++ return listSection('oc-h-streams', 'Stream chats', `<a href="${LIVE}/">Who is live</a>`, a.streams.map((s) => row(`${LIVE}/@${esc(s.username)}`, '@' + s.username, ui.initials(s.display_name || s.username), s.live ? '<span class="oc-badge oc-badge-live">Live</span>' : '',s.live && s.title ? esc(s.title) : `${s.messages ? `${plural(s.messages, 'message', 'messages')} this week` : ''}${s.last ? `${s.messages ? ' · ' : ''}last ${esc(ago(s.last))}` : ''}`)));}-- const item = (s) => `<li><a class="oc-stream" href="${LIVE}/@${esc(s.username)}"><span class="oc-stream-name"><strong>${esc(s.display_name)}</strong>${s.live ? ' <span class="oc-badge oc-badge-live">Live now</span>' : ''}</span>++ const item = (s) => `<li><a class="oc-stream" href="${LIVE}/@${esc(s.username)}"><span class="oc-stream-name"><strong>@${esc(s.username)}</strong>${s.live ? ' <span class="oc-badge oc-badge-live">Live now</span>' : ''}</span><span class="oc-muted">${s.live && s.title ? `${esc(s.title)}${s.messages ? ' · ' : ''}` : ''}${s.messages ? `${plural(s.messages, 'message', 'messages')} from ${plural(s.people, 'person', 'people')} this week` : ''}${s.last && !s.live ? ` · last ${esc(ago(s.last))}` : ''}</span></a></li>`;return `<section class="oc-home-sec" aria-labelledby="oc-h-streams"><div class="oc-home-head"><h2 id="oc-h-streams">Stream chats on OpenVibe.Live</h2><a href="${LIVE}/">Who is live</a></div><p class="oc-muted">Every channel on OpenVibe.Live has its own chat, run by OpenVibe.Chat. The busiest this week:</p>@@@ -25,6 +25,8 @@ t('the home is one pick block: a chip per section, the first picked, every secticonst streamer = await db.get("SELECT id FROM ctx_users WHERE username = 'streamer_x'");await db.run("INSERT INTO ctx_streams (user_id, title, is_live, started_at) VALUES (?, 'Live from the studio', 1, ?)", [streamer.id, stamp]);const page = await fetch(`${h.base}/`).then((r) => r.text());++ // A stream row opens the maker's /@username address, so it is named by its @handle.++ assert.ok(page.includes('>@streamer_x</'), 'the live stream row is named @streamer_x');const start = page.indexOf('<div class="pick" id="pick-explore">');assert.ok(start > 0, 'the pick block is on the home');const block = page.slice(start, page.indexOf('<div class="pick" id="pick-', start + 10) > 0 ? page.indexOf('<div class="pick" id="pick-', start + 10) : start + 60000);
@@ -128,10 +128,10 @@ const listSection = (id, title, more, rows) => `<section class="oc-home-sec oc-h
@@ -128,10 +128,10 @@ const listSection = (id, title, more, rows) => `<section class="oc-home-sec oc-h
function streamsSection(a, app) {
function streamsSection(a, app) {
if (!a.streams.length) return '';
if (!a.streams.length) return '';
if (app) {
if (app) {
- return listSection('oc-h-streams', 'Stream chats', `<a href="${LIVE}/">Who is live</a>`, a.streams.map((s) => row(`${LIVE}/@${esc(s.username)}`, s.display_name, ui.initials(s.display_name), s.live ? '<span class="oc-badge oc-badge-live">Live</span>' : '',
+ return listSection('oc-h-streams', 'Stream chats', `<a href="${LIVE}/">Who is live</a>`, a.streams.map((s) => row(`${LIVE}/@${esc(s.username)}`, '@' + s.username, ui.initials(s.display_name || s.username), s.live ? '<span class="oc-badge oc-badge-live">Live</span>' : '',
s.live && s.title ? esc(s.title) : `${s.messages ? `${plural(s.messages, 'message', 'messages')} this week` : ''}${s.last ? `${s.messages ? ' · ' : ''}last ${esc(ago(s.last))}` : ''}`)));
s.live && s.title ? esc(s.title) : `${s.messages ? `${plural(s.messages, 'message', 'messages')} this week` : ''}${s.last ? `${s.messages ? ' · ' : ''}last ${esc(ago(s.last))}` : ''}`)));
}
}
- const item = (s) => `<li><a class="oc-stream" href="${LIVE}/@${esc(s.username)}"><span class="oc-stream-name"><strong>${esc(s.display_name)}</strong>${s.live ? ' <span class="oc-badge oc-badge-live">Live now</span>' : ''}</span>
+ const item = (s) => `<li><a class="oc-stream" href="${LIVE}/@${esc(s.username)}"><span class="oc-stream-name"><strong>@${esc(s.username)}</strong>${s.live ? ' <span class="oc-badge oc-badge-live">Live now</span>' : ''}</span>
<span class="oc-muted">${s.live && s.title ? `${esc(s.title)}${s.messages ? ' · ' : ''}` : ''}${s.messages ? `${plural(s.messages, 'message', 'messages')} from ${plural(s.people, 'person', 'people')} this week` : ''}${s.last && !s.live ? ` · last ${esc(ago(s.last))}` : ''}</span></a></li>`;
<span class="oc-muted">${s.live && s.title ? `${esc(s.title)}${s.messages ? ' · ' : ''}` : ''}${s.messages ? `${plural(s.messages, 'message', 'messages')} from ${plural(s.people, 'person', 'people')} this week` : ''}${s.last && !s.live ? ` · last ${esc(ago(s.last))}` : ''}</span></a></li>`;
return `<section class="oc-home-sec" aria-labelledby="oc-h-streams"><div class="oc-home-head"><h2 id="oc-h-streams">Stream chats on OpenVibe.Live</h2><a href="${LIVE}/">Who is live</a></div>
return `<section class="oc-home-sec" aria-labelledby="oc-h-streams"><div class="oc-home-head"><h2 id="oc-h-streams">Stream chats on OpenVibe.Live</h2><a href="${LIVE}/">Who is live</a></div>
<p class="oc-muted">Every channel on OpenVibe.Live has its own chat, run by OpenVibe.Chat. The busiest this week:</p>
<p class="oc-muted">Every channel on OpenVibe.Live has its own chat, run by OpenVibe.Chat. The busiest this week:</p>
@@ -25,6 +25,8 @@ t('the home is one pick block: a chip per section, the first picked, every secti
@@ -25,6 +25,8 @@ t('the home is one pick block: a chip per section, the first picked, every secti
const streamer = await db.get("SELECT id FROM ctx_users WHERE username = 'streamer_x'");
const streamer = await db.get("SELECT id FROM ctx_users WHERE username = 'streamer_x'");
await db.run("INSERT INTO ctx_streams (user_id, title, is_live, started_at) VALUES (?, 'Live from the studio', 1, ?)", [streamer.id, stamp]);
await db.run("INSERT INTO ctx_streams (user_id, title, is_live, started_at) VALUES (?, 'Live from the studio', 1, ?)", [streamer.id, stamp]);
const page = await fetch(`${h.base}/`).then((r) => r.text());
const page = await fetch(`${h.base}/`).then((r) => r.text());
+ // A stream row opens the maker's /@username address, so it is named by its @handle.
+ assert.ok(page.includes('>@streamer_x</'), 'the live stream row is named @streamer_x');
const start = page.indexOf('<div class="pick" id="pick-explore">');
const start = page.indexOf('<div class="pick" id="pick-explore">');
assert.ok(start > 0, 'the pick block is on the home');
assert.ok(start > 0, 'the pick block is on the home');
const block = page.slice(start, page.indexOf('<div class="pick" id="pick-', start + 10) > 0 ? page.indexOf('<div class="pick" id="pick-', start + 10) : start + 60000);
const block = page.slice(start, page.indexOf('<div class="pick" id="pick-', start + 10) > 0 ? page.indexOf('<div class="pick" id="pick-', start + 10) : start + 60000);