openvibers/openvibe.surf Commits
Use OpenVibe Link for Surf desks (#117)
Changes
@@@ -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']) {@@@ -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).@@@ -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 () => {nnew file mode 100644@@@ -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');@@@ -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.
@@ -136,7 +136,7 @@ function createApi(ctx) {
@@ -136,7 +136,7 @@ function createApi(ctx) {
const deskUrl = (value) => {
const deskUrl = (value) => {
try {
try {
const u = new URL(String(value || ''));
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; }
} catch { return null; }
};
};
for (const action of ['takeover', 'giveback']) {
for (const action of ['takeover', 'giveback']) {
@@ -296,7 +296,7 @@ const safeWebUrl = (value) => {
@@ -296,7 +296,7 @@ const safeWebUrl = (value) => {
};
};
const deskUrl = (value) => {
const deskUrl = (value) => {
const url = safeWebUrl(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).
// The words a person reads for each state (the same in surf.js).
@@ -9,7 +9,7 @@ const assert = require('assert');
@@ -9,7 +9,7 @@ const assert = require('assert');
const { boot, check, done } = require('./helpers/boot');
const { boot, check, done } = require('./helpers/boot');
const ORIGIN = 'https://openvibe.surf';
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 };
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 () => {
(async () => {
new file mode 100644
new file mode 100644
@@ -0,0 +1,10 @@
@@ -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');
@@ -135,7 +135,7 @@ const ORIGIN = 'https://openvibe.surf';
@@ -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 () => {
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 = {
t.upstreams.state.actor.task = {
id: t.upstreams.state.actor.id, state: 'succeeded', task: '<find a flight>',
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.' },
desk: { url: desk, kind: 'browser' }, needs_you: { what: 'Sign in on the desk.' },
@@ -149,7 +149,7 @@ const ORIGIN = 'https://openvibe.surf';
@@ -149,7 +149,7 @@ const ORIGIN = 'https://openvibe.surf';
assert.match(r.text, /https:\/\/example.com\/flight/);
assert.match(r.text, /https:\/\/example.com\/flight/);
assert.doesNotMatch(r.text, /javascript:alert/);
assert.doesNotMatch(r.text, /javascript:alert/);
assert.match(r.text, /Take over/);
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.match(r.text, /openvibe\.actor\/tasks/);
assert.ok(!r.text.includes(token));
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.
// The result page (Opus, 11-07): the answer carries Copy and a follow-up that starts a new ask about this task.