Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use static app name

Manav Rathif11960981a1f
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx
index af73ad8c61..b22a8e5533 100644
--- a/web/apps/accounts/src/pages/_app.tsx
+++ b/web/apps/accounts/src/pages/_app.tsx
@@ -1,7 +1,7 @@
import { CustomHead } from "@/next/components/Head";
import { setupI18n } from "@/next/i18n";
import { logUnhandledErrorsAndRejections } from "@/next/log-web";
-import { appTitle, type AppName } from "@/next/types/app";
+import { staticAppTitle } from "@/next/types/app";
import { PAGES } from "@ente/accounts/constants/pages";
import { accountLogout } from "@ente/accounts/services/logout";
import { Overlay } from "@ente/shared/components/Container";
@@ -24,8 +24,6 @@ import React, { useCallback, useEffect, useState } from "react";
import "styles/global.css";
const App: React.FC<AppProps> = ({ Component, pageProps }) => {
- const appName: AppName = "accounts";
-
const [isI18nReady, setIsI18nReady] = useState<boolean>(false);
const [showNavbar, setShowNavbar] = useState(false);
@@ -61,7 +59,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
}, [router]);
const appContext = {
- appName,
logout,
showNavBar: setShowNavbar,
isMobile,
@@ -70,7 +67,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
const title = isI18nReady
? t("title", { context: "accounts" })
- : appTitle[appName];
+ : staticAppTitle;
return (
<>
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 98e9295320..a8063a44ea 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -6,9 +6,9 @@ import {
logUnhandledErrorsAndRejections,
} from "@/next/log-web";
import {
+ appName,
appTitle,
clientPackageName,
- type AppName,
type BaseAppContextT,
} from "@/next/types/app";
import { ensure } from "@/utils/ensure";
@@ -59,8 +59,6 @@ export const AppContext = createContext<AppContextT | undefined>(undefined);
export const useAppContext = () => ensure(useContext(AppContext));
const App: React.FC<AppProps> = ({ Component, pageProps }) => {
- const appName: AppName = "auth";
-
const router = useRouter();
const [isI18nReady, setIsI18nReady] = useState<boolean>(false);
const [loading, setLoading] = useState(false);
@@ -83,7 +81,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
useEffect(() => {
void setupI18n().finally(() => setIsI18nReady(true));
const userID = (getData(LS_KEYS.USER) as User)?.id;
- logStartupBanner(appName, userID);
+ logStartupBanner(userID);
logUnhandledErrorsAndRejections(true);
setAppNameForAuthenticatedRequests(appName);
HTTPService.setHeaders({
@@ -159,9 +157,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
somethingWentWrong,
};
- const title = isI18nReady
- ? t("title", { context: "auth" })
- : appTitle[appName];
+ const title = isI18nReady ? t("title", { context: "auth" }) : staticAppTitle;
return (
<>
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 69302f8def..301797b3f8 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -7,9 +7,9 @@ import {
logUnhandledErrorsAndRejections,
} from "@/next/log-web";
import {
- appTitle,
+ appName,
clientPackageName,
- type AppName,
+ staticAppTitle,
type BaseAppContextT,
} from "@/next/types/app";
import { AppUpdate } from "@/next/types/ipc";
@@ -109,8 +109,6 @@ export const AppContext = createContext<AppContextT | undefined>(undefined);
export const useAppContext = () => ensure(useContext(AppContext));
export default function App({ Component, pageProps }: AppProps) {
- const appName: AppName = "photos";
-
const router = useRouter();
const [isI18nReady, setIsI18nReady] = useState<boolean>(false);
const [loading, setLoading] = useState(false);
@@ -149,7 +147,7 @@ export default function App({ Component, pageProps }: AppProps) {
useEffect(() => {
void setupI18n().finally(() => setIsI18nReady(true));
const userID = (getData(LS_KEYS.USER) as User)?.id;
- logStartupBanner(appName, userID);
+ logStartupBanner(userID);
logUnhandledErrorsAndRejections(true);
setAppNameForAuthenticatedRequests(appName);
HTTPService.setHeaders({
@@ -374,7 +372,7 @@ export default function App({ Component, pageProps }: AppProps) {
const title = isI18nReady
? t("title", { context: "photos" })
- : appTitle[appName];
+ : staticAppTitle;
return (
<>
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 197906cdbd..3cef94767e 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -27,7 +27,7 @@ import { Trans } from "react-i18next";
import { useAppContext } from "./_app";
export default function LandingPage() {
- const { appName, showNavBar, setDialogMessage } = useAppContext();
+ const { showNavBar, setDialogMessage } = useAppContext();
const [loading, setLoading] = useState(true);
const [showLogin, setShowLogin] = useState(true);
@@ -145,9 +145,9 @@ export default function LandingPage() {
<DesktopBox>
<SideBox>
{showLogin ? (
- <Login {...{ signUp, appName, host }} />
+ <Login {...{ signUp, host }} />
) : (
- <SignUp {...{ router, appName, login, host }} />
+ <SignUp {...{ router, login, host }} />
)}
</SideBox>
</DesktopBox>
diff --git a/web/packages/accounts/api/user.ts b/web/packages/accounts/api/user.ts
index 9269fe2e17..5ed4005cfc 100644
--- a/web/packages/accounts/api/user.ts
+++ b/web/packages/accounts/api/user.ts
@@ -1,5 +1,5 @@
import { apiURL } from "@/next/origins";
-import type { AppName } from "@/next/types/app";
+import { appName } from "@/next/types/app";
import type {
RecoveryKey,
TwoFactorRecoveryResponse,
@@ -14,7 +14,7 @@ import { getToken } from "@ente/shared/storage/localStorage/helpers";
import type { KeyAttributes } from "@ente/shared/user/types";
import { HttpStatusCode } from "axios";
-export const sendOtt = async (appName: AppName, email: string) => {
+export const sendOtt = async (email: string) => {
return HTTPService.post(await apiURL("/users/ott"), {
email,
client: appName == "auth" ? "totp" : "web",
diff --git a/web/packages/accounts/components/Login.tsx b/web/packages/accounts/components/Login.tsx
index 8d31b2bc4b..d02e7bf44c 100644
--- a/web/packages/accounts/components/Login.tsx
+++ b/web/packages/accounts/components/Login.tsx
@@ -1,5 +1,4 @@
import log from "@/next/log";
-import type { AppName } from "@/next/types/app";
import FormPaperFooter from "@ente/shared/components/Form/FormPaper/Footer";
import FormPaperTitle from "@ente/shared/components/Form/FormPaper/Title";
import LinkButton from "@ente/shared/components/LinkButton";
@@ -16,12 +15,11 @@ import { PAGES } from "../constants/pages";
interface LoginProps {
signUp: () => void;
- appName: AppName;
/** Reactive value of {@link customAPIHost}. */
host: string | undefined;
}
-export function Login({ appName, signUp, host }: LoginProps) {
+export const Login: React.FC<LoginProps> = ({ signUp, host }) => {
const router = useRouter();
const loginUser: SingleInputFormProps["callback"] = async (
@@ -33,7 +31,7 @@ export function Login({ appName, signUp, host }: LoginProps) {
const srpAttributes = await getSRPAttributes(email);
log.debug(() => ` srpAttributes: ${JSON.stringify(srpAttributes)}`);
if (!srpAttributes || srpAttributes.isEmailMFAEnabled) {
- await sendOtt(appName, email);
+ await sendOtt(email);
router.push(PAGES.VERIFY);
} else {
setData(LS_KEYS.SRP_ATTRIBUTES, srpAttributes);
@@ -79,4 +77,4 @@ export function Login({ appName, signUp, host }: LoginProps) {
</FormPaperFooter>
</>
);
-}
+};
diff --git a/web/packages/accounts/components/SignUp.tsx b/web/packages/accounts/components/SignUp.tsx
index 7d021812d9..0c36df4df8 100644
--- a/web/packages/accounts/components/SignUp.tsx
+++ b/web/packages/accounts/components/SignUp.tsx
@@ -1,5 +1,4 @@
import log from "@/next/log";
-import type { AppName } from "@/next/types/app";
import { sendOtt } from "@ente/accounts/api/user";
import { PasswordStrengthHint } from "@ente/accounts/components/PasswordStrength";
import { PAGES } from "@ente/accounts/constants/pages";
@@ -53,12 +52,11 @@ interface FormValues {
interface SignUpProps {
router: NextRouter;
login: () => void;
- appName: AppName;
/** Reactive value of {@link customAPIHost}. */
host: string | undefined;
}
-export function SignUp({ router, appName, login, host }: SignUpProps) {
+export const SignUp: React.FC<SignUpProps> = ({ router, login, host }) => {
const [acceptTerms, setAcceptTerms] = useState(false);
const [loading, setLoading] = useState(false);
const [showPassword, setShowPassword] = useState(false);
@@ -86,7 +84,7 @@ export function SignUp({ router, appName, login, host }: SignUpProps) {
try {
setData(LS_KEYS.USER, { email });
setLocalReferralSource(referral);
- await sendOtt(appName, email);
+ await sendOtt(email);
} catch (e) {
const message = e instanceof Error ? e.message : "";
setFieldError("confirm", `${t("UNKNOWN_ERROR")} ${message}`);
@@ -329,4 +327,4 @@ export function SignUp({ router, appName, login, host }: SignUpProps) {
</FormPaperFooter>
</>
);
-}
+};
diff --git a/web/packages/accounts/pages/change-email.tsx b/web/packages/accounts/pages/change-email.tsx
index d318fd81e6..e2e77382a9 100644
--- a/web/packages/accounts/pages/change-email.tsx
+++ b/web/packages/accounts/pages/change-email.tsx
@@ -1,4 +1,3 @@
-import type { AppName } from "@/next/types/app";
import { ensure } from "@/utils/ensure";
import { wait } from "@/utils/promise";
import { changeEmail, sendOTTForEmailChange } from "@ente/accounts/api/user";
@@ -20,9 +19,7 @@ import * as Yup from "yup";
import { appHomeRoute } from "../services/redirect";
import type { PageProps } from "../types/page";
-const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName } = appContext;
-
+const Page: React.FC<PageProps> = () => {
const router = useRouter();
useEffect(() => {
@@ -36,7 +33,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
<VerticallyCentered>
<FormPaper>
<FormPaperTitle>{t("CHANGE_EMAIL")}</FormPaperTitle>
- <ChangeEmailForm {...{ appName }} />
+ <ChangeEmailForm />
</FormPaper>
</VerticallyCentered>
);
@@ -49,11 +46,7 @@ interface formValues {
ott?: string;
}
-interface ChangeEmailFormProps {
- appName: AppName;
-}
-
-const ChangeEmailForm: React.FC<ChangeEmailFormProps> = ({ appName }) => {
+const ChangeEmailForm: React.FC = () => {
const [loading, setLoading] = useState(false);
const [ottInputVisible, setShowOttInputVisibility] = useState(false);
const [email, setEmail] = useState<string | null>(null);
@@ -101,7 +94,7 @@ const ChangeEmailForm: React.FC<ChangeEmailFormProps> = ({ appName }) => {
}
};
- const goToApp = () => router.push(appHomeRoute(appName));
+ const goToApp = () => router.push(appHomeRoute);
return (
<Formik<formValues>
diff --git a/web/packages/accounts/pages/change-password.tsx b/web/packages/accounts/pages/change-password.tsx
index 9f5ff006f7..2a28be7fce 100644
--- a/web/packages/accounts/pages/change-password.tsx
+++ b/web/packages/accounts/pages/change-password.tsx
@@ -39,9 +39,7 @@ import { useEffect, useState } from "react";
import { appHomeRoute } from "../services/redirect";
import type { PageProps } from "../types/page";
-const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName } = appContext;
-
+const Page: React.FC<PageProps> = () => {
const [token, setToken] = useState<string>();
const [user, setUser] = useState<User>();
@@ -137,7 +135,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
const redirectToAppHome = () => {
setData(LS_KEYS.SHOW_BACK_BUTTON, { value: true });
- router.push(appHomeRoute(appName));
+ router.push(appHomeRoute);
};
// TODO: Handle the case where user is not loaded yet.
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx
index 39e1c5135a..f24fbf1550 100644
--- a/web/packages/accounts/pages/credentials.tsx
+++ b/web/packages/accounts/pages/credentials.tsx
@@ -62,7 +62,7 @@ import type { PageProps } from "../types/page";
import type { SRPAttributes } from "../types/srp";
const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName, logout, setDialogBoxAttributesV2 } = appContext;
+ const { logout, setDialogBoxAttributesV2 } = appContext;
const [srpAttributes, setSrpAttributes] = useState<SRPAttributes>();
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
@@ -138,7 +138,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
}
const token = getToken();
if (key && token) {
- router.push(appHomeRoute(appName));
+ router.push(appHomeRoute);
return;
}
const kekEncryptedAttributes: B64EncryptionResult = getKey(
@@ -315,7 +315,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
}
const redirectURL = InMemoryStore.get(MS_KEYS.REDIRECT_URL);
InMemoryStore.delete(MS_KEYS.REDIRECT_URL);
- router.push(redirectURL ?? appHomeRoute(appName));
+ router.push(redirectURL ?? appHomeRoute);
} catch (e) {
log.error("useMasterPassword failed", e);
}
diff --git a/web/packages/accounts/pages/generate.tsx b/web/packages/accounts/pages/generate.tsx
index ff4085b67d..c5e1ef7e62 100644
--- a/web/packages/accounts/pages/generate.tsx
+++ b/web/packages/accounts/pages/generate.tsx
@@ -32,7 +32,7 @@ import { appHomeRoute } from "../services/redirect";
import type { PageProps } from "../types/page";
const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName, logout } = appContext;
+ const { logout } = appContext;
const [token, setToken] = useState<string>();
const [user, setUser] = useState<User>();
@@ -56,7 +56,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
setRecoveryModalView(true);
setLoading(false);
} else {
- router.push(appHomeRoute(appName));
+ router.push(appHomeRoute);
}
} else if (keyAttributes?.encryptedKey) {
router.push(PAGES.CREDENTIALS);
@@ -106,7 +106,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
show={recoverModalView}
onHide={() => {
setRecoveryModalView(false);
- router.push(appHomeRoute(appName));
+ router.push(appHomeRoute);
}}
/* TODO: Why is this error being ignored */
somethingWentWrong={() => {}}
diff --git a/web/packages/accounts/pages/recover.tsx b/web/packages/accounts/pages/recover.tsx
index b6120697d9..19b8499290 100644
--- a/web/packages/accounts/pages/recover.tsx
+++ b/web/packages/accounts/pages/recover.tsx
@@ -30,7 +30,7 @@ const bip39 = require("bip39");
bip39.setDefaultWordlist("english");
const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName } = appContext;
+ const { showNavBar, setDialogBoxAttributesV2 } = appContext;
const [keyAttributes, setKeyAttributes] = useState<
KeyAttributes | undefined
@@ -47,7 +47,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
return;
}
if (!user?.encryptedToken && !user?.token) {
- sendOtt(appName, user.email);
+ sendOtt(user.email);
InMemoryStore.set(MS_KEYS.REDIRECT_URL, PAGES.RECOVER);
router.push(PAGES.VERIFY);
return;
@@ -55,11 +55,11 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
if (!keyAttributes) {
router.push(PAGES.GENERATE);
} else if (key) {
- router.push(appHomeRoute(appName));
+ router.push(appHomeRoute);
} else {
setKeyAttributes(keyAttributes);
}
- appContext.showNavBar(true);
+ showNavBar(true);
}, []);
const recover: SingleInputFormProps["callback"] = async (
@@ -98,13 +98,12 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
}
};
- const showNoRecoveryKeyMessage = () => {
- appContext.setDialogBoxAttributesV2({
+ const showNoRecoveryKeyMessage = () =>
+ setDialogBoxAttributesV2({
title: t("SORRY"),
close: {},
content: t("NO_RECOVERY_KEY_MESSAGE"),
});
- };
return (
<VerticallyCentered>
diff --git a/web/packages/accounts/pages/two-factor/setup.tsx b/web/packages/accounts/pages/two-factor/setup.tsx
index 6bb8613a5c..b65faaee12 100644
--- a/web/packages/accounts/pages/two-factor/setup.tsx
+++ b/web/packages/accounts/pages/two-factor/setup.tsx
@@ -23,9 +23,7 @@ export enum SetupMode {
MANUAL_CODE,
}
-const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName } = appContext;
-
+const Page: React.FC<PageProps> = () => {
const [twoFactorSecret, setTwoFactorSecret] = useState<
TwoFactorSecret | undefined
>();
@@ -60,7 +58,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
...getData(LS_KEYS.USER),
isTwoFactorEnabled: true,
});
- router.push(appHomeRoute(appName));
+ router.push(appHomeRoute);
};
return (
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index 9f84964904..7b5ac424e7 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -39,7 +39,7 @@ import type { PageProps } from "../types/page";
import type { SRPSetupAttributes } from "../types/srp";
const Page: React.FC<PageProps> = ({ appContext }) => {
- const { appName, logout } = appContext;
+ const { logout } = appContext;
const [email, setEmail] = useState("");
const [resend, setResend] = useState(0);
@@ -95,11 +95,11 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
});
// TODO: This is not the first login though if they already have
// 2FA. Does this flag mean first login on this device?
+ //
+ // Update: This flag causes the interactive encryption key to be
+ // generated, so it has a functional impact we need.
setIsFirstLogin(true);
- const url = passkeyVerificationRedirectURL(
- appName,
- passkeySessionID,
- );
+ const url = passkeyVerificationRedirectURL(passkeySessionID);
setPasskeyVerificationData({ passkeySessionID, url });
openPasskeyVerificationURL({ passkeySessionID, url });
} else if (twoFactorSessionID) {
@@ -161,7 +161,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
const resendEmail = async () => {
setResend(1);
- await sendOtt(appName, email);
+ await sendOtt(email);
setResend(2);
setTimeout(() => setResend(0), 3000);
};
diff --git a/web/packages/accounts/services/passkey.ts b/web/packages/accounts/services/passkey.ts
index 772b463772..2b3837ba4f 100644
--- a/web/packages/accounts/services/passkey.ts
+++ b/web/packages/accounts/services/passkey.ts
@@ -1,8 +1,7 @@
import { clientPackageHeaderIfPresent } from "@/next/http";
import log from "@/next/log";
import { accountsAppOrigin, apiURL } from "@/next/origins";
-import type { AppName } from "@/next/types/app";
-import { clientPackageName } from "@/next/types/app";
+import { appName, clientPackageName } from "@/next/types/app";
import { TwoFactorAuthorizationResponse } from "@/next/types/credentials";
import { ensure } from "@/utils/ensure";
import ComlinkCryptoWorker from "@ente/shared/crypto";
@@ -24,15 +23,10 @@ import { getToken } from "@ente/shared/storage/localStorage/helpers";
* On successful verification, the accounts app will redirect back to our
* `/passkeys/finish` page.
*
- * @param appName The {@link AppName} of the app which is calling this function.
- *
* @param passkeySessionID An identifier provided by museum for this passkey
* verification session.
*/
-export const passkeyVerificationRedirectURL = (
- appName: AppName,
- passkeySessionID: string,
-) => {
+export const passkeyVerificationRedirectURL = (passkeySessionID: string) => {
const clientPackage = clientPackageName(appName);
// Using `window.location.origin` will work both when we're running in a web
// browser, and in our desktop app. See: [Note: Using deeplinks to navigate
diff --git a/web/packages/accounts/services/redirect.ts b/web/packages/accounts/services/redirect.ts
index b4b0322335..bee96ae423 100644
--- a/web/packages/accounts/services/redirect.ts
+++ b/web/packages/accounts/services/redirect.ts
@@ -1,4 +1,4 @@
-import type { AppName } from "@/next/types/app";
+import { appName } from "@/next/types/app";
import { AUTH_PAGES, PHOTOS_PAGES } from "@ente/shared/constants/pages";
/**
@@ -6,13 +6,8 @@ import { AUTH_PAGES, PHOTOS_PAGES } from "@ente/shared/constants/pages";
*
* This is where we redirect to after successful authentication.
*/
-export const appHomeRoute = (appName: AppName): string => {
- switch (appName) {
- case "accounts":
- return "/passkeys";
- case "auth":
- return AUTH_PAGES.AUTH;
- case "photos":
- return PHOTOS_PAGES.GALLERY;
- }
-};
+export const appHomeRoute = {
+ accounts: "/passkeys",
+ auth: AUTH_PAGES.AUTH,
+ photos: PHOTOS_PAGES.GALLERY,
+}[appName];
diff --git a/web/packages/next/log-web.ts b/web/packages/next/log-web.ts
index 043d342cab..54e2dd4b78 100644
--- a/web/packages/next/log-web.ts
+++ b/web/packages/next/log-web.ts
@@ -1,16 +1,15 @@
import { isDevBuild } from "@/next/env";
import log from "@/next/log";
-import { appName, appNames, type AppName } from "./types/app";
+import { appName, appNames } from "./types/app";
/**
* Log a standard startup banner.
*
* This helps us identify app starts and other environment details in the logs.
*
- * @param appName The {@link AppName} of the app that is starting.
* @param userID The uid for the currently logged in user, if any.
*/
-export const logStartupBanner = (_: AppName, userID?: number) => {
+export const logStartupBanner = (userID?: number) => {
// Log a warning if appName isn't what it claims to be. See the
// documentation of `appName` for why this is needed.
if (!appNames.includes(appName)) {
diff --git a/web/packages/next/types/app.ts b/web/packages/next/types/app.ts
index 79d70be7d0..dec4e5e510 100644
--- a/web/packages/next/types/app.ts
+++ b/web/packages/next/types/app.ts
@@ -9,7 +9,10 @@ export const appNames = ["accounts", "auth", "photos"] as const;
export type AppName = (typeof appNames)[number];
/**
- * The name of the Ente app which we're currently running as.
+ * The unique key for the app.
+ *
+ * This is the name of the Ente app which we're currently running as. It is used
+ * as a key for various properties that are different across apps.
*
* Parts of our code are shared across apps. Some parts of them also run in
* non-main thread execution contexts like web workers. So there isn't always an
@@ -25,15 +28,15 @@ export type AppName = (typeof appNames)[number];
export const appName: AppName = process.env.appName as AppName;
/**
- * Static title for the app.
+ * Static (English) title for the app.
*
* This is shown until we have the localized version.
*/
-export const appTitle: Record<AppName, string> = {
+export const staticAppTitle = {
accounts: "Ente Accounts",
auth: "Ente Auth",
photos: "Ente Photos",
-};
+}[appName];
/**
* Client "package names" for each of our apps.
@@ -67,8 +70,6 @@ export const clientPackageNamePhotosDesktop = "io.ente.photos.desktop";
* listed in {@link AppName}.
*/
export interface BaseAppContextT {
- /** The unique key for the app. */
- appName: AppName;
/** Perform the (possibly app specific) logout sequence. */
logout: () => void;
/** Show or hide the app's navigation bar. */