Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rem

Manav Rathi1d182d4ed6e2
diff --git a/web/apps/accounts/src/pages/passkeys/flow/index.tsx b/web/apps/accounts/src/pages/passkeys/flow/index.tsx
index 404f4e2cb2..aa62e96f16 100644
--- a/web/apps/accounts/src/pages/passkeys/flow/index.tsx
+++ b/web/apps/accounts/src/pages/passkeys/flow/index.tsx
@@ -1,5 +1,5 @@
import log from "@/next/log";
-import { APPS, CLIENT_PACKAGE_NAMES } from "@ente/shared/apps/constants";
+import { clientPackageName } from "@/next/types/app";
import {
CenteredFlex,
VerticallyCentered,
@@ -51,11 +51,11 @@ const PasskeysFlow = () => {
}
}
- let pkg = CLIENT_PACKAGE_NAMES.get(APPS.PHOTOS);
+ let pkg = clientPackageName["photos"];
if (redirectURL.protocol === "enteauth:") {
- pkg = CLIENT_PACKAGE_NAMES.get(APPS.AUTH);
+ pkg = clientPackageName["auth"];
} else if (redirectURL.hostname.startsWith("accounts")) {
- pkg = CLIENT_PACKAGE_NAMES.get(APPS.ACCOUNTS);
+ pkg = clientPackageName["accounts"];
}
setData(LS_KEYS.CLIENT_PACKAGE, { name: pkg });
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 7ca9717420..b858719fca 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -4,10 +4,15 @@ import {
logStartupBanner,
logUnhandledErrorsAndRejections,
} from "@/next/log-web";
-import { appTitle, type AppName, type BaseAppContextT } from "@/next/types/app";
+import {
+ appTitle,
+ clientPackageName,
+ type AppName,
+ type BaseAppContextT,
+} from "@/next/types/app";
import { ensure } from "@/utils/ensure";
import { accountLogout } from "@ente/accounts/services/logout";
-import { APPS, CLIENT_PACKAGE_NAMES } from "@ente/shared/apps/constants";
+import { APPS } from "@ente/shared/apps/constants";
import { Overlay } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
@@ -75,7 +80,7 @@ export default function App({ Component, pageProps }: AppProps) {
logStartupBanner(APPS.AUTH, userId);
logUnhandledErrorsAndRejections(true);
HTTPService.setHeaders({
- "X-Client-Package": CLIENT_PACKAGE_NAMES.get(APPS.AUTH),
+ "X-Client-Package": clientPackageName[appName],
});
return () => logUnhandledErrorsAndRejections(false);
}, []);
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index f75d93a283..4a085b4a7f 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -1,10 +1,10 @@
import log from "@/next/log";
import { savedLogs } from "@/next/log-web";
+import { clientPackageName } from "@/next/types/app";
import {
configurePasskeyRecovery,
isPasskeyRecoveryEnabled,
} from "@ente/accounts/services/passkey";
-import { APPS, CLIENT_PACKAGE_NAMES } from "@ente/shared/apps/constants";
import { SpaceBetweenFlex } from "@ente/shared/components/Container";
import { EnteLogo } from "@ente/shared/components/EnteLogo";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
@@ -512,9 +512,7 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({ closeSidebar }) => {
window.open(
`${getAccountsURL()}${
ACCOUNTS_PAGES.ACCOUNT_HANDOFF
- }?package=${CLIENT_PACKAGE_NAMES.get(
- APPS.PHOTOS,
- )}&token=${accountsToken}`,
+ }?package=${clientPackageName["photos"]}&token=${accountsToken}`,
);
} catch (e) {
log.error("failed to redirect to accounts page", e);
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index d9f34e3f40..fc970c955d 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -6,10 +6,15 @@ import {
logStartupBanner,
logUnhandledErrorsAndRejections,
} from "@/next/log-web";
-import { appTitle, type AppName, type BaseAppContextT } from "@/next/types/app";
+import {
+ appTitle,
+ clientPackageName,
+ type AppName,
+ type BaseAppContextT,
+} from "@/next/types/app";
import { AppUpdate } from "@/next/types/ipc";
import { ensure } from "@/utils/ensure";
-import { APPS, CLIENT_PACKAGE_NAMES } from "@ente/shared/apps/constants";
+import { APPS } from "@ente/shared/apps/constants";
import { Overlay } from "@ente/shared/components/Container";
import DialogBox from "@ente/shared/components/DialogBox";
import {
@@ -152,7 +157,7 @@ export default function App({ Component, pageProps }: AppProps) {
logStartupBanner(APPS.PHOTOS, userId);
logUnhandledErrorsAndRejections(true);
HTTPService.setHeaders({
- "X-Client-Package": CLIENT_PACKAGE_NAMES.get(APPS.PHOTOS),
+ "X-Client-Package": clientPackageName[appName],
});
return () => logUnhandledErrorsAndRejections(false);
}, []);
diff --git a/web/apps/photos/src/services/face/mlWorkManager.ts b/web/apps/photos/src/services/face/mlWorkManager.ts
index 3e25864bae..1a89dc1575 100644
--- a/web/apps/photos/src/services/face/mlWorkManager.ts
+++ b/web/apps/photos/src/services/face/mlWorkManager.ts
@@ -1,8 +1,8 @@
import { FILE_TYPE } from "@/media/file-type";
import { ensureElectron } from "@/next/electron";
import log from "@/next/log";
+import { clientPackageNamePhotosDesktop } from "@/next/types/app";
import { ComlinkWorker } from "@/next/worker/comlink-worker";
-import { clientPackageNamePhotosDesktop } from "@ente/shared/apps/constants";
import { eventBus, Events } from "@ente/shared/events";
import { getToken, getUserID } from "@ente/shared/storage/localStorage/helpers";
import debounce from "debounce";
diff --git a/web/packages/next/types/app.ts b/web/packages/next/types/app.ts
index 40a01481f2..6afbda4cbc 100644
--- a/web/packages/next/types/app.ts
+++ b/web/packages/next/types/app.ts
@@ -17,6 +17,21 @@ export const appTitle: Record<AppName, string> = {
photos: "Ente Photos",
};
+/**
+ * Client "package names" for each of the apps.
+ *
+ * These are used as the identifier in the user agent strings that we send to
+ * our own servers.
+ */
+export const clientPackageName: Record<AppName, string> = {
+ accounts: "io.ente.accounts.web",
+ auth: "io.ente.auth.web",
+ photos: "io.ente.photos.web",
+};
+
+/** Client package name for the Photos desktop app */
+export const clientPackageNamePhotosDesktop = "io.ente.photos.desktop";
+
/**
* Properties guaranteed to be present in the AppContext types for apps that are
* listed in {@link AppName}.
diff --git a/web/packages/shared/apps/constants.ts b/web/packages/shared/apps/constants.ts
index ae7756ae96..3332c81ef1 100644
--- a/web/packages/shared/apps/constants.ts
+++ b/web/packages/shared/apps/constants.ts
@@ -16,11 +16,3 @@ export const appNameToAppNameOld = (appName: AppName): APPS => {
return APPS.AUTH;
}
};
-
-export const CLIENT_PACKAGE_NAMES = new Map([
- [APPS.PHOTOS, "io.ente.photos.web"],
- [APPS.AUTH, "io.ente.auth.web"],
- [APPS.ACCOUNTS, "io.ente.accounts.web"],
-]);
-
-export const clientPackageNamePhotosDesktop = "io.ente.photos.desktop";