openvibers/openvibe.network Commits

Motion follows the account: display 'motion' takes auto, full, reduced or off (#747)

OP OpenVibers committed 3 days ago · b9c60b27ab · 3 files, +12 −2

openvibe-shared 4.183.0 makes motion four choices (Automatic, Full, Calm, Off). Network's display allow-list kept only auto and reduced, so a save of full or off was dropped. The list now keeps all four, and a test saves each value and reads it back.

Changes

ddiff --git a/docs/shared-contracts.md b/docs/shared-contracts.md
iindex b20d462f..69d56bf6 100644
---- a/docs/shared-contracts.md
++++ b/docs/shared-contracts.md
@@@ -161,7 +161,8 @@ One mark for every site, tinted per site (`SITES`): `svg({ site, maskable })`, `
## 10. Display preferences (in `theme-loader.js`)
--`OpenVibeThemeLoader.display.get()` / `.set({ motion: 'auto'|'reduced', text: '100'|'112'|'125' })`.
++`OpenVibeThemeLoader.display.get()` / `.set({ motion: 'auto'|'full'|'reduced'|'off', text: '100'|'112'|'125' })`
++(motion's four choices, openvibe-shared 4.183.0).
Applied before first paint as `<html data-ov-motion>` and `--ov-text-scale` / `data-ov-text`; stored
in `localStorage.ov_display`, synced across tabs, saved to the account through
`PUT /api/themes/me/display` and returned by `GET /api/themes/me/active` (`display`). Emits
ddiff --git a/server/themes/routes.js b/server/themes/routes.js
iindex 9ce6c099..31c1326b 100644
---- a/server/themes/routes.js
++++ b/server/themes/routes.js
@@@ -180,7 +180,9 @@ router.get('/me/active', (req, res, next) => {
// oled: use pure black backgrounds on OLED displays.
// icons: the person's icon style (openvibe-shared 4.71.0, plan L56): auto (line; solid when small or for the tab you are
// on), line or solid, on every OpenVibe site.
--const DISPLAY = { motion: ['auto', 'reduced'], text: ['100', '112', '125'], seasonal: ['on', 'off'], scheme: ['manual', 'auto'], contrast: ['normal', 'more'], font: ['default', 'readable'], colors: ['default', 'cb-safe'], oled: ['off', 'on'], icons: ['auto', 'line', 'solid'] };
++// motion: auto, full, reduced or off (openvibe-shared 4.183.0): full plays everything even when the device asks for
++// less, reduced is calm, and only off stops motion. The account keeps the choice; the shared theme loader applies it.
++const DISPLAY = { motion: ['auto', 'full', 'reduced', 'off'], text: ['100', '112', '125'], seasonal: ['on', 'off'], scheme: ['manual', 'auto'], contrast: ['normal', 'more'], font: ['default', 'readable'], colors: ['default', 'cb-safe'], oled: ['off', 'on'], icons: ['auto', 'line', 'solid'] };
function cleanDisplay(d) {
if (!d || typeof d !== 'object') return null;
const out = {};
ddiff --git a/test/themes-review.test.js b/test/themes-review.test.js
iindex b2dd68ae..7abc6b9a 100644
---- a/test/themes-review.test.js
++++ b/test/themes-review.test.js
@@@ -119,6 +119,13 @@ const token = async (id) => signToken(await db.prepare('SELECT * FROM users WHER
assert.strictEqual(r.body.display.icons, 'solid', 'a person who prefers solid icons keeps that on every site');
assert.strictEqual((await call('GET', '/api/themes/me/active', { as: 2 })).body.display.icons, 'solid');
assert.strictEqual((await call('PUT', '/api/themes/me/display', { as: 2, body: { icons: 'outline' } })).body.display.icons, undefined, 'only auto, line or solid');
++ // Motion (openvibe-shared 4.183.0): auto, full, reduced or off follows the account, and each one reads back.
++ for (const motion of ['auto', 'full', 'reduced', 'off']) {
++ r = await call('PUT', '/api/themes/me/display', { as: 2, body: { motion } });
++ assert.strictEqual(r.body.display.motion, motion, `motion ${motion} is kept`);
++ assert.strictEqual((await call('GET', '/api/themes/me/active', { as: 2 })).body.display.motion, motion, `motion ${motion} reads back`);
++ }
++ assert.strictEqual((await call('PUT', '/api/themes/me/display', { as: 2, body: { motion: 'calm' } })).body.display.motion, undefined, 'only auto, full, reduced or off');
// ── The site switcher's pinned and recent sites follow the account (migration 0029) ──
r = await call('GET', '/api/themes/me/sites', { as: 2 });