openvibers/openvibe.inventory Commits
Restore silent sign-in on mounted Inventory pages (#254)
Changes
@@@ -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'),@@@ -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' });
@@ -68,7 +68,7 @@ function renderPage(o) {
@@ -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: '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)
: [{ 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 },
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'),
sessionUrl: url('/auth/me'),
tokenUrl: url('/auth/navbar-token'),
tokenUrl: url('/auth/navbar-token'),
fedcmLogin: url('/auth/fedcm'),
fedcmLogin: url('/auth/fedcm'),
@@ -101,6 +101,8 @@ const cookieHeader = (r) => r.headers.getSetCookie().map((c) => c.split(';')[0])
@@ -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);
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 () => {
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`;
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);
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' });
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' });