openvibers/openvibe.inventory Commits

Restore silent sign-in on mounted Inventory pages (#254)

OP OpenVibers committed 3 days ago · 932fe3166e · 2 files, +3 −1

Changes

ddiff --git a/server/render/layout.js b/server/render/layout.js
iindex 92016f4..66fb4b7 100644
---- a/server/render/layout.js
++++ b/server/render/layout.js
@@@ -68,7 +68,7 @@ function renderPage(o) {
? [{ label: 'My', href: new URL('/', absolute('/')).href, icon: 'fa-house' }, { label: 'Yours', href: url('/me'), icon: 'fa-shirt' }, { label: 'Items', href: url('/items'), icon: 'fa-tag' }, { label: 'Workshop', href: url('/workshop'), icon: 'fa-screwdriver-wrench' }]
: [{ label: 'Home', href: url('/'), icon: 'fa-house' }, { label: 'Items', href: url('/items'), icon: 'fa-tag' }, { label: 'Yours', href: url('/me'), icon: 'fa-shirt' }, { label: 'Workshop', href: url('/workshop'), icon: 'fa-screwdriver-wrench' }], // phones: the bottom tab bar (Shared 4.20)
history: { type: 'page', title: o.title || SITE_NAME },
-- silentLogin: urls(o.config).prefix ? null : absolute('/auth/login') + '?silent=1&next={url}',
++ silentLogin: absolute('/auth/login') + '?silent=1&next={url}',
sessionUrl: url('/auth/me'),
tokenUrl: url('/auth/navbar-token'),
fedcmLogin: url('/auth/fedcm'),
ddiff --git a/test/base-path.test.js b/test/base-path.test.js
iindex ab4cd88..c3ccf6b 100644
---- a/test/base-path.test.js
++++ b/test/base-path.test.js
@@@ -101,6 +101,8 @@ const cookieHeader = (r) => r.headers.getSetCookie().map((c) => c.split(';')[0])
assert.strictEqual((await t.get('/inventory/auth/me', { cookie: 'ov_token=invalid' })).json().user, null);
});
await check('silent PKCE callback uses isolated host-only Inventory cookies', async () => {
++ const page = await t.get('/inventory');
++ assert.match(page.text, /"silentLogin":"https:\/\/openvibe\.my\/inventory\/auth\/login\?silent=1&next=\{url\}"/);
const hub = `ov_token=${t.network.userToken(user)}; ov_refresh=hub-refresh; ov_oauth_state=hub-state`;
assert.strictEqual((await t.get('/inventory/auth/me', { cookie: hub })).json().user.username, user.username);
const login = await t.get('/inventory/auth/login?silent=1&next=' + encodeURIComponent('https://openvibe.my/inventory'), { cookie: 'ov_refresh=hub-refresh; ov_oauth_state=hub-state' });