π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Conv
Manav Rathi22354823457d
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 93b0ebae30..ef7db03a6e 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -33,6 +33,7 @@ import {haveCredentialsInSession,masterKeyFromSession,} from "ente-base/session";+import { getAuthToken } from "ente-base/token";import { FullScreenDropZone } from "ente-gallery/components/FullScreenDropZone";import { type UploadTypeSelectorIntent } from "ente-gallery/components/Upload";import { type Collection } from "ente-media/collection";@@ -110,7 +111,6 @@ import {import { usePhotosAppContext } from "ente-new/photos/types/context";import { getData } from "ente-shared/storage/localStorage";import {- getToken,isFirstLogin,justSignedUp,setIsFirstLogin,@@ -277,23 +277,30 @@ const Page: React.FC = () => {const router = useRouter();useEffect(() => {- const token = getToken();- if (!haveCredentialsInSession() || !token) {- stashRedirect("/gallery");- router.push("/");- return;- }- preloadImage("/images/subscription-card-background");-const electron = globalThis.electron;let syncIntervalID: ReturnType<typeof setInterval> | undefined;void (async () => {+ if (!haveCredentialsInSession() || !(await getAuthToken())) {+ // If we don't have master key or auth token, reauthenticate.+ stashRedirect("/gallery");+ router.push("/");+ return;+ }+if (!(await validateKey())) {+ // If we have credentials but they can't be decrypted, reset.+ //+ // This code is never expected to run, it is only kept as a+ // safety valve.logout();return;}++ // We are logged in and everything looks fine. Proceed with page+ // load initialization.initSettings();+ preloadImage("/images/subscription-card-background");await initUserDetailsOrTriggerPull();setupSelectAllKeyBoardShortcutHandler();dispatch({ type: "showAll" });