openvibers/openvibe.bot Commits

Bot: a community model's page shows the Node command that checks its signature (#101)

OP OpenVibers committed 30 days ago · a4d744a994 · 2 files, +3 −1

A community model's page on openvibe.bot now tells its owner how to check the profile on their machine before installing its driver: `openvibe-node profile verify community.<name> --key-id <Bot's key>`. This is the Node side added in OpenVibe.Node#40 (v0.6.0).

**Tests:** `community` asserts the line is on the model page.

Changes

ddiff --git a/server/web/directory.js b/server/web/directory.js
iindex 87cef8a..acd213c 100644
---- a/server/web/directory.js
++++ b/server/web/directory.js
@@@ -197,7 +197,8 @@ ${model.setup.length ? `<ol>${model.setup.map((s) => `<li>${esc(s)}</li>`).join(
${parts}
${model.community ? `<section class="dir-sec card"><h2>From the community</h2><p>Submitted by ${esc(ownerName(model.community.by))} and reviewed by an OpenVibe admin.${model.community.license ? ` Licence: ${esc(model.community.license)}.` : ''}</p>
<ul>${model.community.driver_url ? `<li>Driver: ${link(model.community.driver_url, model.community.driver_url)}</li>` : ''}${model.community.guide_url ? `<li>Setup guide: ${link(model.community.guide_url, model.community.guide_url)}</li>` : ''}
--<li>Signed by OpenVibe.Bot (Ed25519, key <code>${esc(model.community.key_id || '')}</code>): ${link(`/api/v1/profiles/${model.id}`, 'the profile and its signature')} · ${link('/api/v1/profiles/signing-key', 'the public key')}</li></ul>
++<li>Signed by OpenVibe.Bot (Ed25519, key <code>${esc(model.community.key_id || '')}</code>): ${link(`/api/v1/profiles/${model.id}`, 'the profile and its signature')} · ${link('/api/v1/profiles/signing-key', 'the public key')}</li>
++<li>Check it on your machine before you install the driver (OpenVibe Node v0.6.0 or later): <code>openvibe-node profile verify ${esc(model.id)}${model.community.key_id ? ` --key-id ${esc(model.community.key_id)}` : ''}</code></li></ul>
<p class="muted">Install the driver from its source on the robot's computer; OpenVibe.Bot never runs it.</p></section>` : ''}
<section class="dir-sec card"><h2>Safety</h2><p class="muted">Every command passes Bot's gate: roles, the owner's limits and cooldowns, and a latched e-stop only the owner clears. The device stops the motors by itself when commands stop arriving, without asking the network.</p></section>`;
return shell({ config, path: `/models/${model.id}`, title: model.name, description: `${model.name} on OpenVibe.Bot: how it connects, the panel it gets and how to set it up.`, body });
ddiff --git a/test/community.test.js b/test/community.test.js
iindex 88ef897..e0ce61f 100644
---- a/test/community.test.js
++++ b/test/community.test.js
@@@ -104,6 +104,7 @@ const PROFILE = {
assert.ok(models.includes('From the community') && models.includes('href="/models/community.ballbot"'));
const page = await (await get('/models/community.ballbot')).text();
assert.ok(page.includes('Submitted by @mia') && page.includes('https://github.com/mia/ballbot-driver') && page.includes(key.key_id));
++ assert.ok(page.includes(`openvibe-node profile verify community.ballbot --key-id ${key.key_id}`), 'the model page says how to check it on a machine');
assert.match(await (await get('/robots/new?profile=community.ballbot', sam)).text(), /value="community\.ballbot" checked/);
const made = await t.call('POST', '/api/v1/robots', { user: sam, body: { name: 'My ballbot', profile_id: 'community.ballbot' } });
assert.strictEqual(made.status, 201, made.text);