openvibers/openvibe.bot Commits

Fix silent sign-in on first visits (Bot) (#337)

OP OpenVibers committed 5 days ago · e01e4a2c24 · 2 files, +3 −0

Changes

ddiff --git a/server/web/home.js b/server/web/home.js
iindex 77221cf..46cfc75 100644
---- a/server/web/home.js
++++ b/server/web/home.js
@@@ -277,6 +277,7 @@ function framePage({ config, title, description, canonicalPath = '/', body, head
history: { type: 'page', title },
sessionUrl: '/auth/me',
loginUrl: '/auth/login?next={path}',
++ silentLogin: '/auth/login?silent=1&next={url}',
logoutUrl: '/auth/logout?next={path}',
notificationsRealtime: true,
};
@@@ -338,6 +339,7 @@ function renderHome({ config, signedIn = false, models = [], robots = [], kit =
history: { type: 'page', title: SITE_NAME },
sessionUrl: '/auth/me',
loginUrl: '/auth/login?next={path}',
++ silentLogin: '/auth/login?silent=1&next={url}',
logoutUrl: '/auth/logout?next={path}',
notificationsRealtime: true,
};
ddiff --git a/test/home.test.js b/test/home.test.js
iindex 7c384d5..135c15e 100644
---- a/test/home.test.js
++++ b/test/home.test.js
@@@ -21,6 +21,7 @@ const { boot, check, done } = require('./helpers/app');
assert.match(csp, /connect-src 'self' https:\/\/openvibe\.network https:\/\/openvibe\.events/);
assert.match(csp, /frame-ancestors 'none'/);
const html = await r.text();
++ assert.ok(html.includes('"silentLogin":"/auth/login?silent=1&next={url}"'), 'first visits use the existing SDK OAuth route');
assert.match(html, /<h1>Drive your robot<span class="sc-accent"> from any browser\.<\/span><\/h1>/);
assert.match(html, /<meta name="robots" content="index, follow">/);
assert.match(html, /<link rel="canonical" href="http:\/\/bot\.test\/">/);