π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move
Manav Rathi5e4ad6e6a406
diff --git a/web/apps/photos/src/services/logout.ts b/web/apps/photos/src/services/logout.tsindex c70f3a8b54..47c069be0e 100644--- a/web/apps/photos/src/services/logout.ts+++ b/web/apps/photos/src/services/logout.ts@@ -5,6 +5,7 @@ import {import log from "ente-base/log";import { logoutFileViewerDataSource } from "ente-gallery/components/viewer/data-source";import { downloadManager } from "ente-gallery/services/download";+import { clearFilesDB } from "ente-gallery/services/files-db";import { resetUploadState } from "ente-gallery/services/upload";import { resetVideoState } from "ente-gallery/services/video";import exportService from "ente-new/photos/services/export";@@ -44,6 +45,12 @@ export const photosLogout = async () => {log.info("logout (photos)");+ try {+ await clearFilesDB();+ } catch (e) {+ ignoreError("Files DB", e);+ }+try {logoutSettings();} catch (e) {@@ -120,6 +127,12 @@ export const photosLogout = async () => {await logoutClearStateAgain();+ try {+ await clearFilesDB();+ } catch (e) {+ ignoreError("Files DB", e);+ }+// [Note: Full reload on logout]//// Do a full reload to discard any in-flight requests that might stilldiff --git a/web/packages/accounts/services/logout.ts b/web/packages/accounts/services/logout.tsindex 5ea2c41fa3..8b860d5707 100644--- a/web/packages/accounts/services/logout.ts+++ b/web/packages/accounts/services/logout.ts@@ -3,7 +3,6 @@ import { clearKVDB } from "ente-base/kv";import { clearLocalStorage } from "ente-base/local-storage";import log from "ente-base/log";import { clearSessionStorage } from "ente-base/session";-import localForage from "ente-shared/storage/localForage";import { clearStashedRedirect } from "./redirect";import { remoteLogoutIfNeeded } from "./user";@@ -43,11 +42,6 @@ export const accountLogout = async () => {} catch (e) {ignoreError("Local storage", e);}- try {- await localForage.clear();- } catch (e) {- ignoreError("Local forage", e);- }try {await clearBlobCaches();} catch (e) {@@ -79,11 +73,6 @@ export const logoutClearStateAgain = async () => {} catch (e) {ignoreError("Local storage", e);}- try {- await localForage.clear();- } catch (e) {- ignoreError("Local forage", e);- }try {await clearKVDB();} catch (e) {diff --git a/web/packages/gallery/services/files-db.ts b/web/packages/gallery/services/files-db.tsindex e9f2afd9fe..86f89e10d3 100644--- a/web/packages/gallery/services/files-db.ts+++ b/web/packages/gallery/services/files-db.ts@@ -15,6 +15,9 @@* It stored more than files though - files, collections, trash, their* corresponding sync times, and other bits and bobs related to them.*+ * > Note: File contents themselves are not stored in IndexedDB, only+ * > {@link EnteFile}s.+ ** Since we've now switched to idb as our preferred IndexedDB library, the data* stored in this files table could be considered legacy in a sense. But such* would be an incorrect characterization - this code has no issues, and it@@ -73,9 +76,6 @@ import { z } from "zod/v4";* This is used as a pre-flight check, to notify the user if they're using a* browser or extension that is preventing the app from using IndexedDB (which* is necessary for local storage of collections and files metadata).- *- * > File contents themselves are not stored in IndexedDB, only- * > {@link EnteFile}s.*/export const canAccessIndexedDB = async () => {try {@@ -87,6 +87,13 @@ export const canAccessIndexedDB = async () => {}};+/**+ * Clear any data stored in files DB.+ *+ * This is meant to be called during the logout sequence.+ */+export const clearFilesDB = () => localForage.clear();+/*** Return a Zod schema suitable for being used with the various magic metadata* fields of a file or a collection.