앱 실시간 갱신 수정
This commit is contained in:
@@ -1,30 +1,18 @@
|
||||
import { getVersion } from '@tauri-apps/api/app';
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
import {
|
||||
formatDesktopWindowTitle,
|
||||
readBakedDesktopAppVersion,
|
||||
} from '@frontend/utils/desktopAppVersion';
|
||||
import { formatDesktopWindowTitle } from '@frontend/utils/desktopAppVersion';
|
||||
|
||||
export { formatDesktopWindowTitle } from '@frontend/utils/desktopAppVersion';
|
||||
|
||||
/** macOS/Windows 네이티브 창 타이틀 — GoldenChart (vX.Y.Z) */
|
||||
export async function syncMainWindowTitle(): Promise<string> {
|
||||
try {
|
||||
const version = (await getVersion()) || readBakedDesktopAppVersion() || '';
|
||||
const title = formatDesktopWindowTitle(version);
|
||||
await getCurrentWindow().setTitle(title);
|
||||
if (typeof document !== 'undefined' && document.title !== title) {
|
||||
document.title = title;
|
||||
}
|
||||
return title;
|
||||
} catch (e) {
|
||||
const fallback = formatDesktopWindowTitle(readBakedDesktopAppVersion());
|
||||
if (typeof document !== 'undefined') {
|
||||
document.title = fallback;
|
||||
}
|
||||
console.warn('[desktop] syncMainWindowTitle failed:', e);
|
||||
throw e;
|
||||
const version = (await getVersion()).trim();
|
||||
const title = formatDesktopWindowTitle(version);
|
||||
await getCurrentWindow().setTitle(title);
|
||||
if (typeof document !== 'undefined' && document.title !== title) {
|
||||
document.title = title;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
let titleGuardInstalled = false;
|
||||
|
||||
@@ -11,6 +11,8 @@ const sharedRoot = path.resolve(__dirname, '../packages/shared/src');
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
function readDesktopAppVersion(): string {
|
||||
const fromEnv = process.env.DESKTOP_APP_VERSION?.trim();
|
||||
if (fromEnv) return fromEnv;
|
||||
try {
|
||||
const confPath = path.resolve(__dirname, 'src-tauri/tauri.conf.json');
|
||||
const conf = JSON.parse(readFileSync(confPath, 'utf8')) as { version?: string };
|
||||
|
||||
Reference in New Issue
Block a user