From b39cad02feb65a452744aa34188687c36e97292c Mon Sep 17 00:00:00 2001 From: Brian Hursey Date: Tue, 1 Dec 2026 06:02:16 +0000 Subject: [PATCH] Read the app version from package.json everywhere The version was duplicated in the server, the About panel and the release scripts, and had already drifted once. The server health endpoint and the About panel now take it from package.json, and the help sheet gained an About section that shows the version alongside the guide details. --- server/index.mjs | 22 +++++++++++++++++++++- src/components/Shortcuts.tsx | 8 ++++++++ src/lib/about.ts | 9 ++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/server/index.mjs b/server/index.mjs index ed5c332..58dc132 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -127,7 +127,27 @@ import { startImmichImport, } from './immich.mjs'; -const VERSION = '0.5.2'; +/** + * The version is read from package.json rather than repeated here, so a release + * cannot report one version and ship another. Every bundle ships that file next + * to `server/`: the Docker image, the Linux and Windows bundles, and the macOS + * app all copy it alongside the source tree. + */ +function readVersion() { + const file = new URL('../package.json', import.meta.url); + let version; + try { + version = JSON.parse(fs.readFileSync(file, 'utf8')).version; + } catch (error) { + throw new Error(`server: cannot read the version from ${file.pathname}: ${error.message}`); + } + if (typeof version !== 'string' || !version) { + throw new Error(`server: ${file.pathname} has no "version"`); + } + return version; +} + +const VERSION = readVersion(); const COOKIE = 'lumen_session'; /** Self-only policy; must allow the wasm engines and React inline styles. */ diff --git a/src/components/Shortcuts.tsx b/src/components/Shortcuts.tsx index 68ab3a2..a4d8011 100644 --- a/src/components/Shortcuts.tsx +++ b/src/components/Shortcuts.tsx @@ -1,4 +1,5 @@ import { useEffect } from 'react'; +import { APP_VERSION, GUIDE_UPDATED, GUIDE_VERSION } from '../lib/about'; const GROUPS: { title: string; rows: [string, string][] }[] = [ { @@ -96,6 +97,13 @@ export default function Shortcuts({ onClose }: { onClose: () => void }) {

Hover a panel seam to reveal its collapse tab. Press Tab to move focus, or ? for this list.

⌘K / Ctrl+K searches the whole catalog without changing your current filters.

+
+

About Luminary

+

+ Version {APP_VERSION} · Beta · user guide {GUIDE_VERSION}, updated {GUIDE_UPDATED}. +

+

Click the Luminary name in the top bar for the full About panel and the PDF guide.

+
diff --git a/src/lib/about.ts b/src/lib/about.ts index 18902ce..c1e1342 100644 --- a/src/lib/about.ts +++ b/src/lib/about.ts @@ -1,7 +1,10 @@ /** - * Versions shown in the About panel. APP_VERSION mirrors package.json; the - * guide values are bumped when docs/user-guide/guide.html is republished. + * Versions shown in the About panel. APP_VERSION comes straight from + * package.json, so the UI cannot report a version the release did not ship. + * Bump the guide values when docs/user-guide/guide.html is republished. */ -export const APP_VERSION = '0.5.2'; +import { version as APP_VERSION } from '../../package.json'; + +export { APP_VERSION }; export const GUIDE_VERSION = '0.5'; export const GUIDE_UPDATED = 'November 2026';