openvibers/openvibe.watch Commits

Point Watch machine setup to OpenVibe Link (#249)

OP OpenVibers committed 4 days ago · d09228d20e · 6 files, +22 −12

* Point Watch machine setup to OpenVibe Link

* Point the network template test at openvibe.link/machines

The page now names the Link machines hub in both its hint and its validation
message; the test asserted the old openvibe.bot address.

* Merge remote-tracking branch 'origin/main' into rename/link-1109-Watch

* Merge main and pin openvibe-contracts v0.372.0

Keeps the Link machine wording in the network template and moves the Contracts
pin to the released Link tag.

Changes

ddiff --git a/package-lock.json b/package-lock.json
iindex c27668c..4b9fd2a 100644
---- a/package-lock.json
++++ b/package-lock.json
@@@ -12,7 +12,7 @@
"dotenv": "^16.4.7",
"express": "^4.21.2",
"fast-xml-parser": "^4.5.3",
-- "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.338.0",
++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.372.0",
"openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.123.0",
"openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.173.0",
"pg": "^8.23.0"
@@@ -1044,9 +1044,9 @@
}
},
"node_modules/openvibe-contracts": {
-- "version": "0.338.0",
-- "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.338.0",
-- "integrity": "sha512-75FD6IxMsXoud3NFXKDs0/D0rhJtF2D+WL8M92ArIyabkUnM/sZvw6E6L97EqwQ3O7M/kB+uwsNSxGudbil+ng==",
++ "version": "0.372.0",
++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.372.0",
++ "integrity": "sha512-HnfBnkhfMXYNbW4NnpTAMqZc0uV9d4XvwA20VaZXZFbBTPZiClYfoZ0/TWWWh24BFANx9TSzC+4jE0WDHKuNhA==",
"license": "AGPL-3.0-only",
"dependencies": {
"ajv": "^8.17.1",
ddiff --git a/package.json b/package.json
iindex ab4cc02..caf0330 100644
---- a/package.json
++++ b/package.json
@@@ -24,7 +24,7 @@
"dotenv": "^16.4.7",
"express": "^4.21.2",
"fast-xml-parser": "^4.5.3",
-- "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.338.0",
++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.372.0",
"openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.123.0",
"openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.173.0",
"pg": "^8.23.0"
ddiff --git a/server/http/pages.js b/server/http/pages.js
iindex 7946c81..ef0c84b 100644
---- a/server/http/pages.js
++++ b/server/http/pages.js
@@@ -320,7 +320,7 @@ function createPageRoutes(ctx) {
const name = String(fields.name == null ? '' : fields.name).trim();
if (name.length > 120) errors.name = 'A name can be at most 120 characters.';
const machine = String(fields.machine || '').trim();
-- if (!/^dev_[0-9A-HJKMNP-TV-Z]{26}$/.test(machine)) errors.machine = 'Give your machine\'s id from openvibe.bot/machines (dev_ followed by 26 characters).';
++ if (!/^dev_[0-9A-HJKMNP-TV-Z]{26}$/.test(machine)) errors.machine = 'Give your machine\'s id from openvibe.link/machines (dev_ followed by 26 characters).';
const address = String(fields.lan_address || '').trim();
if (!/^(\[[0-9A-Fa-f:.]+\]|[A-Za-z0-9.-]{1,253}):\d{1,5}$/.test(address) || Number(address.split(':').pop()) > 65535) errors.lan_address = 'Give the device\'s address and port, for example 192.168.1.20:80 or nas.local:5000.';
const cadenceSec = INT(fields.cadence, 3600);
@@@ -494,7 +494,7 @@ ${field('Value path', html`<input type="text" id="${idOf('value_path')}" name="v
const whatBlock = template === 'lan'
? html`<fieldset><legend>What to watch</legend>
${field('Name', html`<input type="text" id="${idOf('name')}" name="name" value="${fields.name}" maxlength="120" placeholder="e.g. The NAS">`, { name: 'name', error: errors.name, hint: 'Optional. Without one, Watch names it after the address.' })}
--${field('Your machine', html`<input type="text" id="${idOf('machine')}" name="machine" value="${fields.machine}" maxlength="30" placeholder="dev_…" required>`, { name: 'machine', error: errors.machine, hint: html`A computer on that network with OpenVibe Link and its computer plugin: copy its id from <a href="https://openvibe.bot/machines">openvibe.bot/machines</a>, where you also turn on “Let my watches check things from this computer”.` })}
++${field('Your machine', html`<input type="text" id="${idOf('machine')}" name="machine" value="${fields.machine}" maxlength="30" placeholder="dev_…" required>`, { name: 'machine', error: errors.machine, hint: html`A computer on that network with OpenVibe Link and its computer plugin: copy its id from <a href="https://openvibe.link/machines">openvibe.link/machines</a>, where you also turn on “Let my watches check things from this computer”.` })}
${field('Address and port', html`<input type="text" id="${idOf('lan_address')}" name="lan_address" value="${fields.lan_address}" maxlength="260" placeholder="192.168.1.20:80" required>`, { name: 'lan_address', error: errors.lan_address, hint: 'On your own network only (a private or local address): your machine checks that it accepts a connection.' })}
</fieldset>`
: template === 'event'
@@@ -524,7 +524,7 @@ ${checkbox('Notify me when it fires', { name: 'notify', checked: fields.notify =
${checkbox('Run one of my agents on OpenVibe.Actor', { name: 'agent_on', checked: fields.agent_on === 'on', hint: 'When the condition fires, Watch gives your agent the before and after values, the source address, the time it was fetched and a link to this watch.' })}
${field('Agent id', html`<input type="text" id="${idOf('agent_id')}" name="agent_id" value="${fields.agent_id}" maxlength="30" placeholder="agt_…">`, { name: 'agent_id', error: errors.agent_id, hint: 'Find the id on your agent’s OpenVibe.Actor page. Required when running an agent.' })}
${field('Note for the agent (optional)', html`<textarea id="${idOf('agent_note')}" name="agent_note" maxlength="2000" rows="3">${fields.agent_note}</textarea>`, { name: 'agent_note', error: errors.agent_note })}
--${checkbox('Start a coding task on my own machine (OpenVibe.Codes)', { name: 'codes_on', checked: fields.codes_on === 'on', hint: 'When the condition fires, OpenVibe.Codes runs the task on your machine (add it on openvibe.bot/machines and start one task on openvibe.codes/run first), with the before and after values, the source address, the time it was fetched and a link to this watch. You get the summary and the patch on its page.' })}
++${checkbox('Start a coding task on my own machine (OpenVibe.Codes)', { name: 'codes_on', checked: fields.codes_on === 'on', hint: 'When the condition fires, OpenVibe.Codes runs the task on your machine (add it on openvibe.link/machines and start one task on openvibe.codes/run first), with the before and after values, the source address, the time it was fetched and a link to this watch. You get the summary and the patch on its page.' })}
${field('Repository', html`<input type="url" id="${idOf('codes_repo')}" name="codes_repo" value="${fields.codes_repo}" maxlength="300" placeholder="https://github.com/you/project">`, { name: 'codes_repo', error: errors.codes_repo })}
${field('The coding task', html`<textarea id="${idOf('codes_brief')}" name="codes_brief" maxlength="6000" rows="3" placeholder="The dependency in the value changed: update it and run the tests.">${fields.codes_brief}</textarea>`, { name: 'codes_brief', error: errors.codes_brief })}
</fieldset>
@@@ -548,7 +548,7 @@ ${field('The coding task', html`<textarea id="${idOf('codes_brief')}" name="code
const newWatch = (q) => `/watches/new?${new URLSearchParams(q)}`;
// Feeds anyone may watch, each checked to answer with a feed: what a person most often wants told about.
const FEEDS = [
-- { title: 'New releases of the OpenVibe Link', detail: 'The agent that runs on robots and computers, from GitHub.', url: 'https://github.com/OpenVibers/OpenVibe.Node/releases.atom', where: 'GitHub' },
++ { title: 'New releases of the OpenVibe Link', detail: 'The agent that runs on robots and computers, from GitHub.', url: 'https://github.com/OpenVibers/OpenVibe.Link/releases.atom', where: 'GitHub' },
{ title: 'New Node.js releases', detail: 'Every Node.js release, current and LTS.', url: 'https://nodejs.org/en/feed/releases.xml', where: 'nodejs.org' },
{ title: 'New remote jobs on OpenVibe.Work', detail: 'Every new remote listing OpenVibe.Work gathers.', url: 'https://openvibe.work/jobs.atom?remote=true', where: 'OpenVibe.Work' },
];
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/node-carrier.test.js b/test/node-carrier.test.js
iindex c854cdf..3d55428 100644
---- a/test/node-carrier.test.js
++++ b/test/node-carrier.test.js
@@@ -40,7 +40,7 @@ t('the source is checked when it is saved', async () => {
const bad = async (source, re) => {
await assert.rejects(create(source), (e) => re.test(e.message));
};
-- await bad({ kind: 'node', node_id: 'nod_01J0000000000000000000000', probe: { target: 'http://192.168.1.20/' } }, /node_id/);
++ await bad({ kind: 'node', node_id: 'lnk_01J0000000000000000000000', probe: { target: 'http://192.168.1.20/' } }, /node_id/);
await bad({ kind: 'node', node_id: MACHINE, probe: { target: 'ftp://192.168.1.20/' } }, /target/);
await bad({ kind: 'node', node_id: MACHINE, probe: { target: 'http://192.168.1.20/', method: 'POST' } }, /method is not known/);
await bad({ kind: 'node', node_id: MACHINE, probe: { target: 'tcp://192.168.1.20:22', timeout_s: 99 } }, /timeout_s/);
ddiff --git a/test/site.test.js b/test/site.test.js
iindex 5a4a937..c2f5bfd 100644
---- a/test/site.test.js
++++ b/test/site.test.js
@@@ -283,7 +283,7 @@ t('the network template: a device at home stops answering, checked from the pers
assert.strictEqual(form.status, 200);
assert.match(form.text, /name="machine"/);
assert.match(form.text, /name="lan_address"/);
-- assert.match(form.text, /openvibe\.bot\/machines/);
++ assert.match(form.text, /openvibe\.link\/machines/);
const made = await create({ template: 'lan', name: 'The NAS', machine: 'dev_01M4XTHNFFAWWZQHB4XTMSN1YB', lan_address: '192.168.1.20:5000', cadence: '3600', notify: 'on' });
assert.strictEqual(made.status, 303, made.text);
const w = (await request(svc.base, 'GET', `/api/v1/watches/${indexOf(made)}`, { token: ME })).body.watch;
@@@ -295,7 +295,7 @@ t('the network template: a device at home stops answering, checked from the pers
assert.match(edit.text, /value="192\.168\.1\.20:5000"/);
const bad = await create({ template: 'lan', machine: 'nope', lan_address: 'not an address', cadence: '3600' });
assert.strictEqual(bad.status, 422);
-- assert.match(bad.text, /openvibe\.bot\/machines \(dev_/);
++ assert.match(bad.text, /openvibe\.link\/machines \(dev_/);
assert.match(bad.text, /address and port/);
});