Add setting to re-enable the lock-screen web-server warning

- Settings dialog gains a 'Show web-server warning' toggle that maps to the
  persisted dismissedLocalWarning flag, letting the user re-show the banner
  after dismissing it (or hide it proactively).
This commit is contained in:
hermes-explorigin 2026-08-27 01:22:06 +00:00
parent 59d903fbd7
commit 982567acf9
2 changed files with 43 additions and 5 deletions

25
dist/index.html vendored
View File

@ -7658,11 +7658,12 @@ delegate(["click", "change"]);
//#endregion
//#region src/components/SettingsDialog.svelte
var root_1$2 = /* @__PURE__ */ from_html(`<option> </option>`);
var root$1 = /* @__PURE__ */ from_html(`<div class="settings-panel svelte-1koizbb"><form class="form-card svelte-1koizbb"><h3 class="svelte-1koizbb">Settings</h3> <div class="form-group"><label for="auto-lock-minutes">Auto-lock after</label> <select id="auto-lock-minutes"></select> <p class="text-muted text-xs mt-1"> </p></div> <div class="form-group"><label class="toggle-label svelte-1koizbb" for="lock-tab-switch"><input id="lock-tab-switch" type="checkbox" class="svelte-1koizbb"/> <span class="toggle-track svelte-1koizbb"><span class="toggle-thumb svelte-1koizbb"></span></span> <span class="toggle-text svelte-1koizbb">Lock when tab loses focus</span></label> <p class="text-muted text-xs mt-1"> </p></div> <div class="form-actions svelte-1koizbb"><button type="submit" class="btn btn-primary"> </button> <button type="button" class="btn btn-ghost">Cancel</button></div></form></div>`);
var root$1 = /* @__PURE__ */ from_html(`<div class="settings-panel svelte-1koizbb"><form class="form-card svelte-1koizbb"><h3 class="svelte-1koizbb">Settings</h3> <div class="form-group"><label for="auto-lock-minutes">Auto-lock after</label> <select id="auto-lock-minutes"></select> <p class="text-muted text-xs mt-1"> </p></div> <div class="form-group"><label class="toggle-label svelte-1koizbb" for="lock-tab-switch"><input id="lock-tab-switch" type="checkbox" class="svelte-1koizbb"/> <span class="toggle-track svelte-1koizbb"><span class="toggle-thumb svelte-1koizbb"></span></span> <span class="toggle-text svelte-1koizbb">Lock when tab loses focus</span></label> <p class="text-muted text-xs mt-1"> </p></div> <div class="form-group"><label class="toggle-label svelte-1koizbb" for="show-local-warning"><input id="show-local-warning" type="checkbox" class="svelte-1koizbb"/> <span class="toggle-track svelte-1koizbb"><span class="toggle-thumb svelte-1koizbb"></span></span> <span class="toggle-text svelte-1koizbb">Show web-server warning</span></label> <p class="text-muted text-xs mt-1"> </p></div> <div class="form-actions svelte-1koizbb"><button type="submit" class="btn btn-primary"> </button> <button type="button" class="btn btn-ghost">Cancel</button></div></form></div>`);
function SettingsDialog($$anchor, $$props) {
push($$props, true);
let minutes = /* @__PURE__ */ state(proxy(settings.autoLockMinutes));
let lockOnTabSwitch = /* @__PURE__ */ state(proxy(settings.lockOnTabSwitch));
let showLocalWarning = /* @__PURE__ */ state(!settings.dismissedLocalWarning);
let saving = /* @__PURE__ */ state(false);
const minuteOptions = [
1,
@ -7677,6 +7678,7 @@ function SettingsDialog($$anchor, $$props) {
try {
settings.autoLockMinutes = get(minutes);
settings.lockOnTabSwitch = get(lockOnTabSwitch);
settings.dismissedLocalWarning = !get(showLocalWarning);
await settings.save();
startAutoLock();
} catch (e) {
@ -7688,6 +7690,7 @@ function SettingsDialog($$anchor, $$props) {
user_effect(() => {
set(minutes, settings.autoLockMinutes, true);
set(lockOnTabSwitch, settings.lockOnTabSwitch, true);
set(showLocalWarning, !settings.dismissedLocalWarning);
});
var div = root$1();
var form = child(div);
@ -7720,18 +7723,29 @@ function SettingsDialog($$anchor, $$props) {
reset(p_1);
reset(div_2);
var div_3 = sibling(div_2, 2);
var button = child(div_3);
var text_3 = child(button, true);
var label_1 = child(div_3);
var input_1 = child(label_1);
remove_input_defaults(input_1);
next(4);
reset(label_1);
var p_2 = sibling(label_1, 2);
var text_3 = child(p_2, true);
reset(p_2);
reset(div_3);
var div_4 = sibling(div_3, 2);
var button = child(div_4);
var text_4 = child(button, true);
reset(button);
var button_1 = sibling(button, 2);
reset(div_3);
reset(div_4);
reset(form);
reset(div);
template_effect(() => {
set_text(text_1, `Vault locks after ${get(minutes) ?? ""} ${get(minutes) === 1 ? "minute" : "minutes"} of inactivity.`);
set_text(text_2, get(lockOnTabSwitch) ? "The vault locks immediately when you switch to another tab." : "The vault stays unlocked even when you switch tabs.");
set_text(text_3, get(showLocalWarning) ? "Shows a reminder on the lock screen to use the vault from a downloaded local file." : "The lock-screen web-server warning banner is hidden.");
button.disabled = get(saving);
set_text(text_3, get(saving) ? "Saving..." : "Save");
set_text(text_4, get(saving) ? "Saving..." : "Save");
});
event("submit", form, (e) => {
e.preventDefault();
@ -7739,6 +7753,7 @@ function SettingsDialog($$anchor, $$props) {
});
bind_select_value(select, () => get(minutes), ($$value) => set(minutes, $$value));
bind_checked(input, () => get(lockOnTabSwitch), ($$value) => set(lockOnTabSwitch, $$value));
bind_checked(input_1, () => get(showLocalWarning), ($$value) => set(showLocalWarning, $$value));
delegated("click", button_1, function(...$$args) {
$$props.onBack?.apply(this, $$args);
});

View File

@ -7,6 +7,8 @@
// Local copies so the user can cancel without losing values
let minutes = $state(settings.autoLockMinutes)
let lockOnTabSwitch = $state(settings.lockOnTabSwitch)
// Inverse of dismissedLocalWarning: on = show the web-server security banner.
let showLocalWarning = $state(!settings.dismissedLocalWarning)
let saving = $state(false)
const minuteOptions = [1, 5, 10, 15, 30, 60]
@ -16,6 +18,7 @@
try {
settings.autoLockMinutes = minutes
settings.lockOnTabSwitch = lockOnTabSwitch
settings.dismissedLocalWarning = !showLocalWarning
await settings.save()
startAutoLock()
} catch (e) {
@ -29,6 +32,7 @@
$effect(() => {
minutes = settings.autoLockMinutes
lockOnTabSwitch = settings.lockOnTabSwitch
showLocalWarning = !settings.dismissedLocalWarning
})
</script>
@ -67,6 +71,25 @@
</p>
</div>
<div class="form-group">
<label class="toggle-label" for="show-local-warning">
<input
id="show-local-warning"
type="checkbox"
bind:checked={showLocalWarning}
/>
<span class="toggle-track">
<span class="toggle-thumb"></span>
</span>
<span class="toggle-text">Show web-server warning</span>
</label>
<p class="text-muted text-xs mt-1">
{showLocalWarning
? 'Shows a reminder on the lock screen to use the vault from a downloaded local file.'
: 'The lock-screen web-server warning banner is hidden.'}
</p>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" disabled={saving}>
{saving ? 'Saving...' : 'Save'}