feat: desktop startup auto-update before main app launch

Check server version on launch, download/install/relaunch if newer,
then show the main UI. Manual update check no longer triggers full install.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Macbook
2026-06-14 11:58:54 +09:00
parent d2b8affc57
commit 9a0f3f554b
5 changed files with 210 additions and 14 deletions
+30 -5
View File
@@ -65,17 +65,42 @@ export async function getAppVersion(): Promise<string> {
return getVersion();
}
/** @deprecated runDesktopUpdate 사용 */
/** 서버에 새 버전이 있는지만 확인 (다운로드·설치 없음) */
export async function checkForUpdates(): Promise<{
available: boolean;
version?: string;
message?: string;
}> {
const result = await runDesktopUpdate();
try {
const currentVersion = await getVersion();
const update = await check();
if (!update) {
return { available: false, message: `최신 버전입니다. (v${currentVersion})` };
}
return {
available: true,
version: update.version,
message: `새 버전 v${update.version}을(를) 사용할 수 있습니다. (현재 v${currentVersion})`,
};
} catch (e) {
return { available: false, message: formatUpdateError(e) };
}
}
export interface StartupAutoUpdateResult {
/** false면 relaunch 중 — 메인 UI를 띄우지 않음 */
shouldContinue: boolean;
result: DesktopUpdateResult;
}
/** 앱 시작 시 — 새 버전이 있으면 자동 다운로드·설치·재시작 */
export async function runStartupAutoUpdate(
onProgress?: (p: DesktopUpdateProgress) => void,
): Promise<StartupAutoUpdateResult> {
const result = await runDesktopUpdate(onProgress);
return {
available: result.phase === 'relaunching' || result.phase === 'available',
version: result.newVersion,
message: result.message,
shouldContinue: result.phase !== 'relaunching',
result,
};
}