Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fin

Manav Rathi6c4d2e8a9e92
diff --git a/web/packages/accounts/pages/change-password.tsx b/web/packages/accounts/pages/change-password.tsx
index 5b193e8e31..7135caa3bd 100644
--- a/web/packages/accounts/pages/change-password.tsx
+++ b/web/packages/accounts/pages/change-password.tsx
@@ -13,7 +13,6 @@ import {
convertBase64ToBuffer,
convertBufferToBase64,
} from "@ente/accounts/utils";
-import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import FormPaper from "@ente/shared/components/Form/FormPaper";
import FormPaperFooter from "@ente/shared/components/Form/FormPaper/Footer";
@@ -39,8 +38,6 @@ import type { PageProps } from "../types/page";
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName } = appContext;
- const appNameOld = appNameToAppNameOld(appName);
-
const [token, setToken] = useState<string>();
const [user, setUser] = useState<User>();
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx
index e69ee75bba..28b908b28a 100644
--- a/web/packages/accounts/pages/credentials.tsx
+++ b/web/packages/accounts/pages/credentials.tsx
@@ -1,7 +1,6 @@
import { isDevBuild } from "@/next/env";
import log from "@/next/log";
import { ensure } from "@/utils/ensure";
-import { APP_HOMES, appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import FormPaper from "@ente/shared/components/Form/FormPaper";
@@ -45,6 +44,7 @@ import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { getSRPAttributes } from "../api/srp";
import { PAGES } from "../constants/pages";
+import { appHomeRoute } from "../services/redirect";
import {
configureSRP,
generateSRPSetupAttributes,
@@ -56,8 +56,6 @@ import type { SRPAttributes } from "../types/srp";
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName, logout } = appContext;
- const appNameOld = appNameToAppNameOld(appName);
-
const [srpAttributes, setSrpAttributes] = useState<SRPAttributes>();
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
const [user, setUser] = useState<User>();
@@ -89,8 +87,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
}
const token = getToken();
if (key && token) {
- // TODO: Refactor the type of APP_HOMES to not require the ??
- router.push(APP_HOMES.get(appNameOld) ?? "/");
+ router.push(appHomeRoute(appName));
return;
}
const kekEncryptedAttributes: B64EncryptionResult = getKey(
@@ -250,7 +247,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
}
const redirectURL = InMemoryStore.get(MS_KEYS.REDIRECT_URL);
InMemoryStore.delete(MS_KEYS.REDIRECT_URL);
- router.push(redirectURL ?? APP_HOMES.get(appNameOld));
+ router.push(redirectURL ?? appHomeRoute(appName));
} catch (e) {
log.error("useMasterPassword failed", e);
}
diff --git a/web/packages/accounts/pages/generate.tsx b/web/packages/accounts/pages/generate.tsx
index 7062f3373d..ff4085b67d 100644
--- a/web/packages/accounts/pages/generate.tsx
+++ b/web/packages/accounts/pages/generate.tsx
@@ -7,7 +7,6 @@ import SetPasswordForm, {
import { PAGES } from "@ente/accounts/constants/pages";
import { configureSRP } from "@ente/accounts/services/srp";
import { generateKeyAndSRPAttributes } from "@ente/accounts/utils/srp";
-import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import FormPaper from "@ente/shared/components/Form/FormPaper";
@@ -35,8 +34,6 @@ import type { PageProps } from "../types/page";
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName, logout } = appContext;
- const appNameOld = appNameToAppNameOld(appName);
-
const [token, setToken] = useState<string>();
const [user, setUser] = useState<User>();
const [recoverModalView, setRecoveryModalView] = useState(false);
diff --git a/web/packages/accounts/pages/two-factor/setup.tsx b/web/packages/accounts/pages/two-factor/setup.tsx
index 635047d740..6bb8613a5c 100644
--- a/web/packages/accounts/pages/two-factor/setup.tsx
+++ b/web/packages/accounts/pages/two-factor/setup.tsx
@@ -6,7 +6,6 @@ import VerifyTwoFactor, {
} from "@ente/accounts/components/two-factor/VerifyForm";
import { TwoFactorSetup } from "@ente/accounts/components/two-factor/setup";
import type { TwoFactorSecret } from "@ente/accounts/types/user";
-import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import LinkButton from "@ente/shared/components/LinkButton";
import { encryptWithRecoveryKey } from "@ente/shared/crypto/helpers";
@@ -27,8 +26,6 @@ export enum SetupMode {
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName } = appContext;
- const appNameOld = appNameToAppNameOld(appName);
-
const [twoFactorSecret, setTwoFactorSecret] = useState<
TwoFactorSecret | undefined
>();
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index d5c004d9ae..87a954979e 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -1,6 +1,5 @@
import { ensure } from "@/utils/ensure";
import type { UserVerificationResponse } from "@ente/accounts/types/user";
-import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import FormPaper from "@ente/shared/components/Form/FormPaper";
diff --git a/web/packages/shared/apps/constants.ts b/web/packages/shared/apps/constants.ts
index cd780312ef..ae7756ae96 100644
--- a/web/packages/shared/apps/constants.ts
+++ b/web/packages/shared/apps/constants.ts
@@ -1,5 +1,4 @@
import type { AppName } from "@/next/types/app";
-import { ACCOUNTS_PAGES, AUTH_PAGES, PHOTOS_PAGES } from "../constants/pages";
export enum APPS {
PHOTOS = "PHOTOS",
@@ -25,9 +24,3 @@ export const CLIENT_PACKAGE_NAMES = new Map([
]);
export const clientPackageNamePhotosDesktop = "io.ente.photos.desktop";
-
-export const APP_HOMES = new Map([
- [APPS.PHOTOS, PHOTOS_PAGES.GALLERY as string],
- [APPS.AUTH, AUTH_PAGES.AUTH],
- [APPS.ACCOUNTS, ACCOUNTS_PAGES.PASSKEYS],
-]);