π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix Ensu desktop version display
Manav Rathi9b5a9df1402f
diff --git a/rust/apps/ensu/changes/02-desktop-version.md b/rust/apps/ensu/changes/02-desktop-version.mdnew file mode 100644index 0000000000..181c2a5e1d--- /dev/null+++ b/rust/apps/ensu/changes/02-desktop-version.md@@ -0,0 +1 @@+- Fixed the desktop app version shown in settings.diff --git a/rust/apps/ensu/scripts/tauri-build-web.mjs b/rust/apps/ensu/scripts/tauri-build-web.mjsindex 37248d4e57..a51ab27366 100644--- a/rust/apps/ensu/scripts/tauri-build-web.mjs+++ b/rust/apps/ensu/scripts/tauri-build-web.mjs@@ -1,4 +1,5 @@import { spawn } from "node:child_process";+import fs from "node:fs";import path from "node:path";import { fileURLToPath } from "node:url";@@ -7,6 +8,11 @@ const __dirname = path.dirname(__filename);const rootDir = path.resolve(__dirname, "..");const webDir = path.resolve(rootDir, "..", "..", "..", "web");+const tauriConfigPath = path.join(rootDir, "src-tauri", "tauri.conf.json");+const desktopVersion = JSON.parse(+ fs.readFileSync(tauriConfigPath, "utf8"),+).package?.version;+if (!desktopVersion) throw new Error("Missing Ensu desktop version");const yarnBin = process.platform === "win32" ? "yarn.cmd" : "yarn";@@ -18,6 +24,7 @@ const child = spawn(yarnBin, ["build:ensu"], {...process.env,ENTE_TAURI: "1",_ENTE_IS_DESKTOP: "1",+ NEXT_PUBLIC_ENSU_DESKTOP_VERSION: desktopVersion,},});diff --git a/rust/apps/ensu/scripts/tauri-dev.mjs b/rust/apps/ensu/scripts/tauri-dev.mjsindex 4930a8d081..b5bf5fa657 100644--- a/rust/apps/ensu/scripts/tauri-dev.mjs+++ b/rust/apps/ensu/scripts/tauri-dev.mjs@@ -14,10 +14,12 @@ const port = process.env.ENSU_TAURI_PORT || process.env.PORT || "3010";const rawConfig = await fs.readFile(tauriConfigPath, "utf8");const config = JSON.parse(rawConfig);+const desktopVersion = config.package?.version;+if (!desktopVersion) throw new Error("Missing Ensu desktop version");config.build = config.build || {};config.build.beforeDevCommand =- `cd ../../../web && yarn build:wasm && yarn workspace ensu next dev -p ${port}`;+ `cd ../../../web && yarn build:wasm && NEXT_PUBLIC_ENSU_DESKTOP_VERSION=${desktopVersion} yarn workspace ensu next dev -p ${port}`;config.build.devPath = `http://localhost:${port}`;await fs.writeFile(devConfigPath, JSON.stringify(config, null, 2));diff --git a/web/apps/ensu/next.config.mjs b/web/apps/ensu/next.config.mjsindex 604c951b2a..51c6e90472 100644--- a/web/apps/ensu/next.config.mjs+++ b/web/apps/ensu/next.config.mjs@@ -1,12 +1,10 @@/* eslint-env node */import nextConfig from "ente-base/next.config.base.js";-import packageJson from "./package.json" with { type: "json" };/** @type {{ process?: { env?: Record<string, string> } }} */const globalWithProcess = globalThis;const env = globalWithProcess.process?.env;-const { version } = packageJson;const isTauriBuild = env?.ENTE_TAURI === "1";const rawBasePath = env?.ENTE_BASE_PATH ?? "";const normalizedBasePath = rawBasePath@@ -19,7 +17,6 @@ export default {...nextConfig,eslint: { ignoreDuringBuilds: true },typescript: { ignoreBuildErrors: true },- env: { ...(nextConfig.env ?? {}), NEXT_PUBLIC_ENSU_VERSION: version },...(isTauriBuild ? { output: "export" } : {}),...(normalizedBasePath? {diff --git a/web/apps/ensu/package.json b/web/apps/ensu/package.jsonindex 6d0e9c271d..0c01270d56 100644--- a/web/apps/ensu/package.json+++ b/web/apps/ensu/package.json@@ -1,6 +1,6 @@{"name": "ensu",- "version": "0.1.15",+ "version": "0.0.0","private": true,"dependencies": {"@fontsource/cormorant-garamond": "^5.2.7",diff --git a/web/apps/ensu/src/components/chat/ChatDialogs.tsx b/web/apps/ensu/src/components/chat/ChatDialogs.tsxindex 38c5ca9d2c..89d4cb540c 100644--- a/web/apps/ensu/src/components/chat/ChatDialogs.tsx+++ b/web/apps/ensu/src/components/chat/ChatDialogs.tsx@@ -78,7 +78,7 @@ export interface ChatDialogsProps {openLoginFromChat: () => void;openPasskeysFromChat: () => void;advancedUnlocked: boolean;- buildVersion: string;+ buildVersion?: string;handleBuildVersionTap: () => void;openModelSettings: () => void;openSystemPromptSettings: () => void;@@ -774,19 +774,21 @@ export const ChatDialogs = memo(</Stack>)}- <Typography- variant="mini"- onClick={handleBuildVersionTap}- sx={{- color: "text.muted",- textAlign: "center",- cursor: "pointer",- userSelect: "none",- py: 1,- }}- >- Build {buildVersion}- </Typography>+ {buildVersion && (+ <Typography+ variant="mini"+ onClick={handleBuildVersionTap}+ sx={{+ color: "text.muted",+ textAlign: "center",+ cursor: "pointer",+ userSelect: "none",+ py: 1,+ }}+ >+ Build {buildVersion}+ </Typography>+ )}</Stack></DialogContent></Dialog>diff --git a/web/apps/ensu/src/pages/chat.tsx b/web/apps/ensu/src/pages/chat.tsxindex 303849b506..7e0cdbb4db 100644--- a/web/apps/ensu/src/pages/chat.tsx+++ b/web/apps/ensu/src/pages/chat.tsx@@ -674,10 +674,9 @@ const Page: React.FC = () => {if (Array.isArray(value)) return value[0];return typeof value === "string" ? value : undefined;}, [router.isReady, router.query.session]);-- const buildVersion = process.env.NEXT_PUBLIC_ENSU_VERSION- ? `v${process.env.NEXT_PUBLIC_ENSU_VERSION}`- : "dev";+ const buildVersion = process.env.NEXT_PUBLIC_ENSU_DESKTOP_VERSION+ ? `v${process.env.NEXT_PUBLIC_ENSU_DESKTOP_VERSION}`+ : undefined;const lastRouteUpdateRef = useRef<{ sessionId?: string; at: number }>({sessionId: undefined,