openvibers/openvibe.live Commits

The channel's OpenVibe profile pill says 'OpenVibe profile' (#561)

OP OpenVibers committed 11 days ago · bf17bff81d · 2 files, +34 −1

The offline header read 'JapaneseOldGuy · @JapaneseOldGuy · @JapaneseOldGuy':
the automatic OpenVibe profile pill repeated the channel's own handle,
written just above it. It now says what it is; the handle stays in its
title, other platforms keep their @handle, and a label the streamer typed
wins.

Changes

ddiff --git a/public/js/channel-socials.js b/public/js/channel-socials.js
iindex 0e6eebe5..ccfb80ab 100644
---- a/public/js/channel-socials.js
++++ b/public/js/channel-socials.js
@@@ -18,7 +18,10 @@
/** Pills: one line of links (the offline screen). */
function pills(host, links) {
if (!host) return;
-- host.innerHTML = (links || []).map((l) => `<a class="ch-social-pill" style="--sc:${escH(l.color)}" href="${escH(l.url)}" target="_blank" rel="noopener me" title="${escH(l.name)}${l.auto ? ' (connected)' : ''}"><i class="${escH(l.icon)}" aria-hidden="true"></i><span>${escH(label(l))}</span></a>`).join('');
++ // The OpenVibe profile pill says what it is: its @handle is the channel's own, already written just above it
++ // (the header read "JapaneseOldGuy · @JapaneseOldGuy · @JapaneseOldGuy", 2026-11-02).
++ const text = (l) => (l.kind === 'openvibe' && !l.label ? 'OpenVibe profile' : label(l));
++ host.innerHTML = (links || []).map((l) => `<a class="ch-social-pill" style="--sc:${escH(l.color)}" href="${escH(l.url)}" target="_blank" rel="noopener me" title="${escH(l.name)}${l.auto ? ' (connected)' : ''}${l.kind === 'openvibe' ? ` ${escH(label(l))}` : ''}"><i class="${escH(l.icon)}" aria-hidden="true"></i><span>${escH(text(l))}</span></a>`).join('');
host.hidden = !(links || []).length;
}
ddiff --git a/test/channel-socials-pills.test.js b/test/channel-socials-pills.test.js
nnew file mode 100644
iindex 00000000..fa499321
---- /dev/null
++++ b/test/channel-socials-pills.test.js
@@@ -0,0 +1,30 @@
++'use strict';
++/**
++ * The offline screen's social pills (public/js/channel-socials.js pills): the OpenVibe profile pill says "OpenVibe
++ * profile", since its @handle is the channel's own and is already written just above it (the header read
++ * "JapaneseOldGuy · @JapaneseOldGuy · @JapaneseOldGuy" on 2026-11-02); other platforms keep their @handle, and a label
++ * the streamer typed wins.
++ *
++ * node test/channel-socials-pills.test.js
++ */
++const assert = require('assert');
++const fs = require('fs');
++const path = require('path');
++const vm = require('vm');
++
++const src = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'channel-socials.js'), 'utf8');
++const sandbox = { window: {}, document: {}, console };
++vm.runInNewContext(src, sandbox);
++const { pills } = sandbox.window.ChannelSocials;
++
++const host = { innerHTML: '', hidden: true };
++pills(host, [
++ { kind: 'openvibe', url: 'https://openvibe.network/@JapaneseOldGuy', handle: 'JapaneseOldGuy', name: 'OpenVibe', icon: 'fa-solid fa-id-card', color: '#3b82f6', auto: true },
++ { kind: 'x', url: 'https://x.com/jog', handle: 'jog', name: 'X', icon: 'fa-brands fa-x-twitter', color: '#000' },
++ { kind: 'openvibe', url: 'https://openvibe.network/@other', handle: 'other', label: 'My other channel', name: 'OpenVibe', icon: 'fa-solid fa-id-card', color: '#3b82f6' },
++]);
++const spans = [...host.innerHTML.matchAll(/<span>([^<]*)<\/span>/g)].map((m) => m[1]);
++assert.deepStrictEqual(spans, ['OpenVibe profile', '@jog', 'My other channel']);
++assert.match(host.innerHTML, /href="https:\/\/openvibe\.network\/@JapaneseOldGuy"/, 'the link is unchanged');
++assert.match(host.innerHTML, /title="OpenVibe \(connected\) @JapaneseOldGuy"/, 'the handle stays in its title');
++console.log('channel social pills: the OpenVibe profile pill says what it is; other handles and typed labels stay');