π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
remove(appLock):hide-content-onblur
Aswin Asok447029b296cc
diff --git a/web/apps/photos/docs/APP_LOCK_ARCHITECTURE.md b/web/apps/photos/docs/APP_LOCK_ARCHITECTURE.mdindex bba08bed55..87e404026f 100644--- a/web/apps/photos/docs/APP_LOCK_ARCHITECTURE.md+++ b/web/apps/photos/docs/APP_LOCK_ARCHITECTURE.md@@ -141,8 +141,6 @@ export interface AppLockState {cooldownExpiresAt: number;/** Auto-lock delay in milliseconds */autoLockTimeMs: number;- /** Whether to blur content when tab/window is hidden */- hideContentOnBlur: boolean;}```@@ -169,7 +167,6 @@ export function attemptUnlock(input: string): Promise<boolean>;export function setAppLockEnabled(enabled: boolean): void;export function setLockType(type: "pin" | "password"): void;export function setAutoLockTime(ms: number): void;-export function setHideContentOnBlur(enabled: boolean): void;export function setupPin(pin: string): Promise<void>;export function setupPassword(password: string): Promise<void>;export function logoutAppLock(): void;@@ -188,7 +185,6 @@ Three categories, each using the appropriate existing storage mechanism:| Lock type | `localStorage` | Synchronous read needed on cold start | `"appLock.lockType"` || Enabled flag | `localStorage` | Synchronous read needed on cold start | `"appLock.enabled"` || Auto-lock time (ms) | `localStorage` | Non-sensitive preference | `"appLock.autoLockTimeMs"` |-| Hide content on blur | `localStorage` | Non-sensitive preference | `"appLock.hideContentOnBlur"` || Invalid attempt count | IndexedDB via `setKV` | Harder to tamper than localStorage | `"appLock.invalidAttempts"` || Cooldown expiry timestamp | IndexedDB via `setKV` | Harder to tamper than localStorage | `"appLock.cooldownExpiresAt"` |@@ -343,11 +339,9 @@ Full-viewport fixed-position overlay. Uses MUI z-index convention: `calc(var(--m3. **Cooldown timer:** Shows "Too many attempts. Try again in Xm Ys" with a `setInterval` countdown.-4. **Privacy screen:** When `hideContentOnBlur` is enabled and `document.hidden` is true, apply `filter: blur(30px)` on the main content container. Prevents content from appearing in tab previews and Alt+Tab thumbnails.+4. **No dismiss:** Cannot be closed except through authentication or logout. No Escape key handling. No click-outside dismiss.-5. **No dismiss:** Cannot be closed except through authentication or logout. No Escape key handling. No click-outside dismiss.--6. **Logout link:** Calls the existing `logout()` from `BaseContext`. Shows a confirmation dialog before proceeding (matching the existing `handleLogout` pattern in `Sidebar.tsx:266-278`).+5. **Logout link:** Calls the existing `logout()` from `BaseContext`. Shows a confirmation dialog before proceeding (matching the existing `handleLogout` pattern in `Sidebar.tsx:266-278`).---diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex 9732ea5353..7a16cb66dc 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -192,30 +192,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {};}, [appLock.enabled, appLock.isLocked, appLock.autoLockTimeMs]);- // Blur main content when tab is hidden to prevent content from appearing- // in tab previews and Alt+Tab thumbnails (desktop only).- useEffect(() => {- if (!isDesktop || !appLock.hideContentOnBlur) return;-- const el = document.getElementById("__next");- if (!el) return;-- const handleVisibilityChange = () => {- el.style.filter = document.hidden ? "blur(30px)" : "";- };-- handleVisibilityChange();-- document.addEventListener("visibilitychange", handleVisibilityChange);- return () => {- document.removeEventListener(- "visibilitychange",- handleVisibilityChange,- );- el.style.filter = "";- };- }, [appLock.hideContentOnBlur]);-// On Electron, clear the auto-lock timer when the main window regains focus.useEffect(() => {if (!appLock.enabled) return;diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.jsonindex 9751c7c490..2706e27bc5 100644--- a/web/packages/base/locales/en-US/translation.json+++ b/web/packages/base/locales/en-US/translation.json@@ -826,7 +826,6 @@"lock_type": "Lock type","auto_lock": "Auto-lock","auto_lock_hint": "Automatically lock the app after a period of inactivity",- "hide_content_on_blur": "Hide content when switching apps","pin_mismatch": "PINs don't match","password_mismatch": "Passwords don't match","app_lock_password": "App lock password",diff --git a/web/packages/new/photos/components/sidebar/AppLockSettings.tsx b/web/packages/new/photos/components/sidebar/AppLockSettings.tsxindex 390ff0dff3..3391140a21 100644--- a/web/packages/new/photos/components/sidebar/AppLockSettings.tsx+++ b/web/packages/new/photos/components/sidebar/AppLockSettings.tsx@@ -27,7 +27,6 @@ import {setupPassword,disableAppLock,setAutoLockTime,- setHideContentOnBlur,} from "../../services/app-lock";import { t } from "i18next";import React, { useCallback, useEffect, useRef, useState } from "react";@@ -81,10 +80,6 @@ export const AppLockSettings: React.FC<setPasswordDialogOpen(false);}, []);- const handleToggleHideContent = useCallback(() => {- setHideContentOnBlur(!state.hideContentOnBlur);- }, [state.hideContentOnBlur]);-return (<><TitledNestedSidebarDrawer@@ -156,14 +151,6 @@ export const AppLockSettings: React.FC<</Stack></>)}-- <RowButtonGroup>- <RowSwitch- label={t("hide_content_on_blur")}- checked={state.hideContentOnBlur}- onClick={handleToggleHideContent}- />- </RowButtonGroup></Stack></TitledNestedSidebarDrawer>diff --git a/web/packages/new/photos/services/app-lock.ts b/web/packages/new/photos/services/app-lock.tsindex 422b344baf..f4a01cbb91 100644--- a/web/packages/new/photos/services/app-lock.ts+++ b/web/packages/new/photos/services/app-lock.ts@@ -33,8 +33,6 @@ export interface AppLockState {cooldownExpiresAt: number;/** Auto-lock delay in milliseconds. */autoLockTimeMs: number;- /** Whether to blur content when tab/window is hidden. */- hideContentOnBlur: boolean;}const createDefaultState = (): AppLockState => ({@@ -44,7 +42,6 @@ const createDefaultState = (): AppLockState => ({invalidAttemptCount: 0,cooldownExpiresAt: 0,autoLockTimeMs: 0,- hideContentOnBlur: false,});/**@@ -102,7 +99,6 @@ const setSnapshot = (snapshot: AppLockState) => {const lsKeyEnabled = "appLock.enabled";const lsKeyLockType = "appLock.lockType";const lsKeyAutoLockTimeMs = "appLock.autoLockTimeMs";-const lsKeyHideContentOnBlur = "appLock.hideContentOnBlur";// -- KV DB keys (IndexedDB, async) --@@ -154,8 +150,9 @@ export const initAppLock = () => {const autoLockTimeMs = Number(localStorage.getItem(lsKeyAutoLockTimeMs) ?? "0",);- const hideContentOnBlur =- localStorage.getItem(lsKeyHideContentOnBlur) === "true";++ // Remove stale key from removed "hide content when switching apps" setting.+ localStorage.removeItem("appLock.hideContentOnBlur");const isLocked = enabled && haveMasterKeyInSession();@@ -165,7 +162,6 @@ export const initAppLock = () => {lockType,isLocked,autoLockTimeMs,- hideContentOnBlur,});// Restore brute-force state from KV DB (async) so cooldowns survive@@ -364,7 +360,6 @@ export const logoutAppLock = async () => {localStorage.removeItem(lsKeyEnabled);localStorage.removeItem(lsKeyLockType);localStorage.removeItem(lsKeyAutoLockTimeMs);- localStorage.removeItem(lsKeyHideContentOnBlur);await removeKV(kvKeyHash);await removeKV(kvKeySalt);@@ -384,18 +379,6 @@ export const setAutoLockTime = (ms: number) => {setSnapshot({ ..._state.snapshot, autoLockTimeMs: ms });};-/**- * Update the hide-content-on-blur preference.- */-export const setHideContentOnBlur = (enabled: boolean) => {- if (enabled) {- localStorage.setItem(lsKeyHideContentOnBlur, "true");- } else {- localStorage.removeItem(lsKeyHideContentOnBlur);- }- setSnapshot({ ..._state.snapshot, hideContentOnBlur: enabled });-};-/*** Disable app lock entirely.*