openvibers/openvibe.bot Commits

Bot: /try's description fits a search result (152 characters) (#122)

OP OpenVibers committed 29 days ago · a9ccb57d11 · 2 files, +3 −2

openvibe.bot/try's meta description was 217 characters, cut off in search results (a metadata audit of every site). It is now 152, keeping the point: a simulated rover in the browser with no account or hardware, and the same panel, safety gate and e-stop as a real robot. `test/try-sim.test.js` checks it stays between 50 and 160.

Changes

ddiff --git a/server/web/render.js b/server/web/render.js
iindex 4281064..42b64f2 100644
---- a/server/web/render.js
++++ b/server/web/render.js
@@@ -467,8 +467,7 @@ ${tryIt ? tryOutro(profile) : ''}${role === 'owner' && !embed && !tryIt ? `<div
});
}
--const TRY_DESCRIPTION = 'Drive a simulated rover from your browser, no account and no hardware: the same OpenVibe.Bot panel, '
-- + 'safety gate and e-stop a real robot gets, with a live camera, a distance sensor, line sensors, headlights and a horn.';
++const TRY_DESCRIPTION = 'Drive a simulated rover from your browser with no account or hardware: the same Bot panel, safety gate and e-stop a real robot gets, with a live camera.';
/** /try's opening lines: what this is, and that nothing here is real hardware. */
function tryIntro() {
ddiff --git a/test/try-sim.test.js b/test/try-sim.test.js
iindex a039e09..dd5528b 100644
---- a/test/try-sim.test.js
++++ b/test/try-sim.test.js
@@@ -46,6 +46,8 @@ const { loadProfiles } = require('../server/profiles');
assert.strictEqual(r.headers.get('set-cookie'), null);
assert.doesNotMatch(r.headers.get('content-security-policy') || '', /esm\.sh|openre/, 'no outside script or socket');
const html = await r.text();
++ // The description fits a search result (at most 160 characters).
++ { const d = (/<meta name="description" content="([^"]*)"/.exec(html) || [])[1] || ''; assert.ok(d.length >= 50 && d.length <= 160, `description ${d.length}: ${d}`); }
assert.ok(html.includes('data-transport="local"') && html.includes('data-role="owner"') && html.includes('data-sim-camera'));
const scripts = [...html.matchAll(/<script src="([^"]+)" defer><\/script>/g)].map((m) => m[1]);
assert.deepStrictEqual(scripts, ['/panel/sim-world.js', '/panel/try-device.js', '/panel/panel.js', '/panel/sim-view.js'], 'the rover and its socket before the panel, the camera after');