Files
Strata/apps/host/server/app-version.mjs
T
Niko1221 31030b170a storage and version: one Downloaded models list from the real files, Check folder unloads nothing, app version shown as Strata
- tools/strata_mcp.py: disk usage from the files a model really uses (every part of a multi-part GGUF, the picture reader, packs, draft layer),
  a file named by several flags or shared by several models counted once; Delete's plan stays separate (removable_gb)
- Settings > Storage: one list and one total (optimized models and other local models), shared files as a line of their own
- Check folder on the same folder no longer unloads the loaded models (O01); an actual change still asks first
- Settings shows the app version (0.2.0-beta) as Strata with the engine beside it; Control's 0.1.45 is no longer shown as Strata
  and no longer goes into the update check as the app version
2026-10-18 20:55:06 +02:00

26 lines
1.2 KiB
JavaScript

/**
* The app's version, from one place. The desktop shell reports its own (apps/desktop/src-tauri/Cargo.toml, which Tauri also uses for
* the installer and file names) in STRATA_APP_VERSION. Outside the app, in a source checkout, the same file is read; otherwise 'dev'.
*/
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
const VERSION = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.+-]+)?$/;
export function appVersionFrom({ env = process.env, here }) {
const given = String(env.STRATA_APP_VERSION ?? '').trim();
if (VERSION.test(given)) return given;
try {
const toml = readFileSync(join(here, '..', '..', 'desktop', 'src-tauri', 'Cargo.toml'), 'utf8');
const found = /^version\s*=\s*"([^"]+)"/m.exec(toml);
if (found && VERSION.test(found[1])) return found[1];
} catch { /* not a checkout */ }
return 'dev';
}
/** The version "Strata" means on screen and in the update check: the app's own, not Strata Control's (see src/lib/app-version.ts). */
export function appVersionToShow(app, control) {
const real = value => (typeof value === 'string' && value.trim() && value.trim().toLowerCase() !== 'dev' ? value.trim() : null);
return real(app) ?? real(control) ?? (typeof app === 'string' && app.trim() ? app.trim() : null);
}