openvibers/openvibe.codes Commits

Pair-it-first lands on the pairing act (#395)

OP OpenVibers committed 2 days ago · 725200d206 · 2 files, +14 −1

Changes

ddiff --git a/server/http/chat.js b/server/http/chat.js
iindex a6e5bce..31eaed7 100644
---- a/server/http/chat.js
++++ b/server/http/chat.js
@@@ -531,7 +531,7 @@ function createChatRoutes(ctx) {
function whereAgents(list) {
const tail = '<span class="ch-where-tail">in a fresh copy of the code, with a pull request at the end</span>';
if (list == null) return `${ico('machines')}<span>Runs on your computer ${tail}</span>`;
-- if (!list.length) return `${ico('machines')}<span>Runs on your computer. <a href="https://openvibe.my/#machines">Pair it first</a>: it takes a minute, and the task waits for it.</span>`;
++ if (!list.length) return `${ico('machines')}<span>Runs on your computer. <a href="https://openvibe.link/machines#pair">Pair it first</a>: it takes a minute, and the task waits for it.</span>`;
const on = list.find((m) => m.state === 'online');
const m = on || list[0];
const name = esc(m.name || m.node_id || 'your computer');
ddiff --git a/test/chat-pair-link.test.js b/test/chat-pair-link.test.js
nnew file mode 100644
iindex 0000000..01aafe3
---- /dev/null
++++ b/test/chat-pair-link.test.js
@@@ -0,0 +1,13 @@
++'use strict';
++// Codes points a person with no machines at the Link hub's pairing act, not the old hub anchor.
++const assert = require('assert');
++const fs = require('fs');
++const path = require('path');
++
++const CHAT = fs.readFileSync(path.join(__dirname, '..', 'server/http/chat.js'), 'utf8');
++const m = CHAT.match(/<a href="([^"]+)">Pair it first<\/a>/);
++assert.ok(m, 'the Pair-it-first link exists');
++assert.strictEqual(m[1], 'https://openvibe.link/machines#pair', 'it lands on the pairing act');
++assert.ok(!CHAT.includes('openvibe.my/#machines'), 'no stale hub anchor remains in chat.js');
++
++console.log('chat-pair-link.test.js: all assertions passed');