desktop 앱 적용
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { check } from '@tauri-apps/plugin-updater';
|
||||
import { relaunch } from '@tauri-apps/plugin-process';
|
||||
import { getVersion } from '@tauri-apps/api/app';
|
||||
|
||||
export async function getAppVersion(): Promise<string> {
|
||||
return getVersion();
|
||||
}
|
||||
|
||||
export async function checkForUpdates(): Promise<{
|
||||
available: boolean;
|
||||
version?: string;
|
||||
message?: string;
|
||||
}> {
|
||||
try {
|
||||
const update = await check();
|
||||
if (!update) {
|
||||
return { available: false, message: '최신 버전입니다.' };
|
||||
}
|
||||
await update.downloadAndInstall();
|
||||
await relaunch();
|
||||
return { available: true, version: update.version, message: '업데이트 설치 후 재시작합니다.' };
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : '업데이트 확인 실패';
|
||||
return { available: false, message: msg };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user