openvibers/openvibe.surf Commits

Use OpenVibe Link for Surf desks (#117)

OP OpenVibers committed 4 days ago · a5e9f32962 · 5 files, +15 −5

Changes

ddiff --git a/server/http/api.js b/server/http/api.js
iindex b129989..330b871 100644
---- a/server/http/api.js
++++ b/server/http/api.js
@@@ -136,7 +136,7 @@ function createApi(ctx) {
const deskUrl = (value) => {
try {
const u = new URL(String(value || ''));
-- return u.origin === 'https://openvibe.bot' && /^\/machines\/dev_[0-9A-HJKMNP-TV-Z]{26}\/screen$/.test(u.pathname) ? u.href : null;
++ return u.origin === 'https://openvibe.link' && /^\/machines\/dev_[0-9A-HJKMNP-TV-Z]{26}\/screen$/.test(u.pathname) ? u.href : null;
} catch { return null; }
};
for (const action of ['takeover', 'giveback']) {
ddiff --git a/server/views/index.js b/server/views/index.js
iindex 9b6cff4..a6c5ead 100644
---- a/server/views/index.js
++++ b/server/views/index.js
@@@ -296,7 +296,7 @@ const safeWebUrl = (value) => {
};
const deskUrl = (value) => {
const url = safeWebUrl(value);
-- return url && new URL(url).origin === 'https://openvibe.bot' && /^\/machines\/dev_[0-9A-HJKMNP-TV-Z]{26}\/screen$/.test(new URL(url).pathname) ? url : null;
++ return url && new URL(url).origin === 'https://openvibe.link' && /^\/machines\/dev_[0-9A-HJKMNP-TV-Z]{26}\/screen$/.test(new URL(url).pathname) ? url : null;
};
// The words a person reads for each state (the same in surf.js).
ddiff --git a/test/computer.test.js b/test/computer.test.js
iindex 5f0d13c..6122340 100644
---- a/test/computer.test.js
++++ b/test/computer.test.js
@@@ -9,7 +9,7 @@ const assert = require('assert');
const { boot, check, done } = require('./helpers/boot');
const ORIGIN = 'https://openvibe.surf';
--const DESK = `https://openvibe.bot/machines/dev_${'A'.repeat(26)}/screen?desk=desk-surf`;
++const DESK = `https://openvibe.link/machines/dev_${'A'.repeat(26)}/screen?desk=desk-surf`;
const COMPUTER = { session_id: 'ses_01JAB2C3D4E5F6G7H8J9K0MNPQR', machine: 'a shared desk host', where: 'network', cost_hint: 'a desk host, metered by the minute', driving: false };
(async () => {
ddiff --git a/test/link-brand.test.js b/test/link-brand.test.js
nnew file mode 100644
iindex 0000000..eaa904f
---- /dev/null
++++ b/test/link-brand.test.js
@@@ -0,0 +1,10 @@
++'use strict';
++const assert = require('node:assert/strict');
++const { spawnSync } = require('node:child_process');
++const path = require('node:path');
++const root = path.resolve(__dirname, '..');
++const oldName = ['OpenVibe[ .-]No' + 'de', 'openvibe-' + 'node', 'no' + 'd_', 'node[.]openvibe[.]network', 'node:lnk_', 'openvibe[.](bot|my|network)/mach' + 'ines'].join('|');
++const result = spawnSync('git', ['grep', '-n', '-I', '-i', '-E', oldName, '--', '.', ':!migrations/**', ':!test/link-brand.test.js'], { cwd: root, encoding: 'utf8' });
++assert.ok(result.status === 0 || result.status === 1, result.stderr || 'git grep failed');
++assert.equal(result.status, 1, `Old Link brand or principal returned:\n${(result.stdout || '').split('\n').slice(0, 10).join('\n')}`);
++console.log(' ok old Link brand and principal IDs are absent');
ddiff --git a/test/web.test.js b/test/web.test.js
iindex 2a0ddde..bf32cd5 100644
---- a/test/web.test.js
++++ b/test/web.test.js
@@@ -135,7 +135,7 @@ const ORIGIN = 'https://openvibe.surf';
});
await check('the Surf task page shows the private desk link, cited sources and report', async () => {
-- const desk = `https://openvibe.bot/machines/dev_${'A'.repeat(26)}/screen?desk=desk-surf`;
++ const desk = `https://openvibe.link/machines/dev_${'A'.repeat(26)}/screen?desk=desk-surf`;
t.upstreams.state.actor.task = {
id: t.upstreams.state.actor.id, state: 'succeeded', task: '<find a flight>',
desk: { url: desk, kind: 'browser' }, needs_you: { what: 'Sign in on the desk.' },
@@@ -149,7 +149,7 @@ const ORIGIN = 'https://openvibe.surf';
assert.match(r.text, /https:\/\/example.com\/flight/);
assert.doesNotMatch(r.text, /javascript:alert/);
assert.match(r.text, /Take over/);
-- assert.match(r.text, /openvibe\.bot\/machines/);
++ assert.match(r.text, /openvibe\.link\/machines/);
assert.match(r.text, /openvibe\.actor\/tasks/);
assert.ok(!r.text.includes(token));
// The result page (Opus, 11-07): the answer carries Copy and a follow-up that starts a new ask about this task.