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.
This commit is contained in:
+21
-1
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user