버전명 표시

This commit is contained in:
Macbook
2026-06-15 10:31:44 +09:00
parent 0e09825cab
commit 6481a432fd
7 changed files with 112 additions and 17 deletions
+23
View File
@@ -0,0 +1,23 @@
import { readBakedDesktopAppVersion } from './desktopAppVersion';
const LATEST_JSON_PATH = '/desktop/updates/latest.json';
/** Vite 빌드·desktop 번들에 주입된 앱 버전 */
export function readBakedAppVersion(): string | null {
const fromVite = import.meta.env.VITE_APP_VERSION?.trim();
if (fromVite) return fromVite;
return readBakedDesktopAppVersion();
}
/** 서버에 배포된 desktop latest.json — 웹 타이틀바 런타임 버전 */
export async function fetchPublishedAppVersion(): Promise<string | null> {
try {
const res = await fetch(LATEST_JSON_PATH, { cache: 'no-store' });
if (!res.ok) return null;
const data = (await res.json()) as { version?: string };
const v = data.version?.trim();
return v || null;
} catch {
return null;
}
}