π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[desktop] Don't add version to x-client-package
Manav Rathia9edcead06fb
diff --git a/web/packages/base/app.ts b/web/packages/base/app.tsindex 74b891a9c0..18f5100244 100644--- a/web/packages/base/app.ts+++ b/web/packages/base/app.ts@@ -62,8 +62,7 @@ export const staticAppTitle = {/*** Client "package names" for our app.*- * The package name is used as the (a) "X-Client-Package" header in API- * requests, and (b) as the identifier in inline user agent strings in payloads.+ * The package name is used as the "X-Client-Package" header in API requests.** In cases where this code works for both a web and a desktop app for the same* app (currently only photos), this will be the platform specific package name.@@ -72,9 +71,7 @@ export const clientPackageName = (() => {if (isDesktop) {if (appName != "photos")throw new Error(`Unsupported desktop appName ${appName}`);- if (!desktopAppVersion)- throw new Error(`desktopAppVersion is not defined`);- return `io.ente.photos.desktop/${desktopAppVersion}`;+ return `io.ente.photos.desktop`;}return {accounts: "io.ente.accounts.web",@@ -83,3 +80,23 @@ export const clientPackageName = (() => {photos: "io.ente.photos.web",}[appName];})();++/**+ * The client package name, augmented with the client version where applicable.+ *+ * This string is used as the "client identifier" in payloads (e.g. ML data+ * generated by a client).+ *+ * For the desktop app, it will be client package name and version. Otherwise,+ * it'll just be the same as {@link clientPackageName}.+ */+export const clientIdentifier = (() => {+ if (isDesktop) {+ if (appName != "photos")+ throw new Error(`Unsupported desktop appName ${appName}`);+ if (!desktopAppVersion)+ throw new Error(`desktopAppVersion is not defined`);+ return `io.ente.photos.desktop/${desktopAppVersion}`;+ }+ return clientPackageName;+})();diff --git a/web/packages/new/photos/services/ml/worker.ts b/web/packages/new/photos/services/ml/worker.tsindex 7ddaeeb659..28ecbd09a8 100644--- a/web/packages/new/photos/services/ml/worker.ts+++ b/web/packages/new/photos/services/ml/worker.ts@@ -1,5 +1,5 @@import { expose, wrap } from "comlink";-import { clientPackageName } from "ente-base/app";+import { clientIdentifier } from "ente-base/app";import { assertionFailed } from "ente-base/assert";import { isHTTP4xxError, isHTTPErrorWithStatus } from "ente-base/http";import log from "ente-base/log";@@ -590,13 +590,13 @@ const index = async (const remoteFaceIndex = existingRemoteFaceIndex ?? {version: faceIndexingVersion,- client: clientPackageName,+ client: clientIdentifier,...faceIndex,};const remoteCLIPIndex = existingRemoteCLIPIndex ?? {version: clipIndexingVersion,- client: clientPackageName,+ client: clientIdentifier,...clipIndex,};