π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[desktop] Include app version in X-Client-Package
Manav Rathi46a12ed698a8
diff --git a/web/packages/next/app.ts b/web/packages/next/app.tsindex 89cd492c09..3547357ddc 100644--- a/web/packages/next/app.ts+++ b/web/packages/next/app.ts@@ -34,6 +34,13 @@ export const appName: AppName = process.env.appName as AppName;*/export const isDesktop = process.env.isDesktop == "1";+/**+ * Version of the desktop app.+ *+ * This is only defined when {@link isDesktop} is true.+ */+export const desktopAppVersion = process.env.desktopAppVersion;+/*** Static (English) title for the app.*@@ -59,7 +66,9 @@ export const clientPackageName = (() => {if (isDesktop) {if (appName != "photos")throw new Error(`Unsupported desktop appName ${appName}`);- return "io.ente.photos.desktop";+ if (!desktopAppVersion)+ throw new Error(`desktopAppVersion is not defined`);+ return `io.ente.photos.desktop/${desktopAppVersion}`;}return {accounts: "io.ente.accounts.web",diff --git a/web/packages/next/next.config.base.js b/web/packages/next/next.config.base.jsindex b658089e11..f496bcb4e0 100644--- a/web/packages/next/next.config.base.js+++ b/web/packages/next/next.config.base.js@@ -13,6 +13,7 @@const cp = require("child_process");const os = require("os");const path = require("path");+const fs = require("fs");/*** Return the current commit ID if we're running inside a git repository.@@ -64,6 +65,16 @@ const appName = path.basename(process.cwd());*/const isDesktop = process.env._ENTE_IS_DESKTOP ? "1" : "";+/**+ * When we're running within the desktop app, also extract the version of the+ * desktop app for use in our "X-Client-Package" string.+ *+ * > The web app has continuous deployments, and doesn't have versions.+ */+const desktopAppVersion = isDesktop+ ? JSON.parse(fs.readFileSync("../../desktop/package.json", "utf-8")).version+ : undefined;+/*** Configuration for the Next.js build*@@ -84,6 +95,7 @@ const nextConfig = {gitSHA,appName,isDesktop,+ desktopAppVersion,},// Customize the webpack configuration used by Next.js.