앱 버전표시

This commit is contained in:
Macbook
2026-06-14 19:20:48 +09:00
parent b2c6650cd5
commit 5045a548a4
10 changed files with 137 additions and 31 deletions
+25
View File
@@ -0,0 +1,25 @@
declare const __DESKTOP_APP_VERSION__: string | undefined;
declare global {
interface Window {
__GC_APP_VERSION__?: string;
}
}
/** Desktop Vite 빌드·index.html 인라인 스크립트에 주입된 앱 버전 */
export function readBakedDesktopAppVersion(): string | null {
if (typeof window !== 'undefined') {
const fromWindow = window.__GC_APP_VERSION__?.trim();
if (fromWindow) return fromWindow;
}
if (typeof __DESKTOP_APP_VERSION__ !== 'undefined') {
const fromDefine = __DESKTOP_APP_VERSION__.trim();
if (fromDefine) return fromDefine;
}
return null;
}
export function formatDesktopWindowTitle(version: string | null | undefined): string {
const v = version?.trim();
return v ? `GoldenChart (v${v})` : 'GoldenChart';
}
+3 -1
View File
@@ -2,7 +2,9 @@
export type RuntimePlatform = 'web' | 'desktop' | 'mobile';
export function isDesktop(): boolean {
return typeof window !== 'undefined' && '__TAURI__' in window;
if (typeof window === 'undefined') return false;
if ('__TAURI__' in window || '__TAURI_INTERNALS__' in window) return true;
return document.documentElement.classList.contains('desktop-client');
}
export function isMobileCapacitor(): boolean {