openvibers/openvibe.locker Commits

Passwords: the lock card talks about logins, not files (#9)

OP OpenVibers committed 4 days ago · 072fbb4707 · 2 files, +11 −2

On openvibe.locker/passwords the locked card said "Unlock to open your files" and the storage line listed the
2 GiB per-file upload limit. On Passwords it now says "Unlock to see and save your logins" and leaves the per-file
limit to Drive.

Changes

ddiff --git a/public/js/app.js b/public/js/app.js
iindex dbbee31..4a094c4 100644
---- a/public/js/app.js
++++ b/public/js/app.js
@@@ -25,7 +25,9 @@
function state() {
const unlocked = L.state().unlocked;
if ($('#lock-state')) $('#lock-state').textContent = unlocked ? 'Your locker is unlocked' : 'Your locker is locked';
-- if ($('#fingerprint')) $('#fingerprint').textContent = unlocked ? L.state().fingerprint : 'Unlock to open your files. Your keys stay here.';
++ // Say what unlocking is for on this page (the card said "your files" on Passwords too).
++ const what = page.mode === 'passwords' ? 'see and save your logins' : 'open your files';
++ if ($('#fingerprint')) $('#fingerprint').textContent = unlocked ? L.state().fingerprint : `Unlock to ${what}. Your keys stay here.`;
document.querySelectorAll('[data-action=lock]').forEach((b) => { b.disabled = !unlocked; });
}
async function ownKeys() {
@@@ -138,7 +140,7 @@
progress('Verified and opened.');
}
function showStorage() {
-- if ($('#account') && me) $('#account').textContent = `${size(me.used_bytes)} of ${size(me.quota_bytes)} used${me.reserved_bytes ? ` · ${size(me.reserved_bytes)} uploading` : ''} · Up to ${size(me.max_file_bytes)} per file${me.eligible ? '' : ` · ${me.reason}`}`;
++ if ($('#account') && me) $('#account').textContent = `${size(me.used_bytes)} of ${size(me.quota_bytes)} used${me.reserved_bytes ? ` · ${size(me.reserved_bytes)} uploading` : ''} ${page.mode === 'passwords' ? '' : ` · Up to ${size(me.max_file_bytes)} per file`}${me.eligible ? '' : ` · ${me.reason}`}`; // logins are small: no per-file limit on Passwords
}
async function refresh() {
if (!me) return;
ddiff --git a/test/public-pages.test.js b/test/public-pages.test.js
iindex a9e5af3..697fd13 100644
---- a/test/public-pages.test.js
++++ b/test/public-pages.test.js
@@@ -15,3 +15,10 @@ test('public pages ask the session before the account API', () => {
assert.match(before, /fetch\('\/auth\/me'/);
assert.match(before, /if \(who && who\.user === null\) return;/, 'only an explicit "nobody" skips the account call');
});
++
++// 11-09: the lock card said "Unlock to open your files" on Passwords, and Passwords listed the per-file upload limit.
++test('the lock card and the storage line fit the page', () => {
++ const js = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'app.js'), 'utf8');
++ assert.match(js, /page\.mode === 'passwords' \? 'see and save your logins' : 'open your files'/);
++ assert.match(js, /page\.mode === 'passwords' \? '' : ` · Up to \$\{size\(me\.max_file_bytes\)\} per file`/);
++});