openvibers/openvibe.locker Commits
Passwords: the lock card talks about logins, not files (#9)
Changes
@@@ -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;@@@ -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`/);++});
@@ -25,7 +25,9 @@
@@ -25,7 +25,9 @@
function state() {
function state() {
const unlocked = L.state().unlocked;
const unlocked = L.state().unlocked;
if ($('#lock-state')) $('#lock-state').textContent = unlocked ? 'Your locker is unlocked' : 'Your locker is locked';
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; });
document.querySelectorAll('[data-action=lock]').forEach((b) => { b.disabled = !unlocked; });
}
}
async function ownKeys() {
async function ownKeys() {
@@ -138,7 +140,7 @@
@@ -138,7 +140,7 @@
progress('Verified and opened.');
progress('Verified and opened.');
}
}
function showStorage() {
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() {
async function refresh() {
if (!me) return;
if (!me) return;
@@ -15,3 +15,10 @@ test('public pages ask the session before the account API', () => {
@@ -15,3 +15,10 @@ test('public pages ask the session before the account API', () => {
assert.match(before, /fetch\('\/auth\/me'/);
assert.match(before, /fetch\('\/auth\/me'/);
assert.match(before, /if \(who && who\.user === null\) return;/, 'only an explicit "nobody" skips the account call');
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`/);
+});