fix: Mac desktop updater — platform-aware errors, HTTPS latest.json

Show Mac-specific update errors on macOS (not Windows message). Force HTTPS
bundle URLs, fix reconcile version from bundle filenames, bump to 0.1.4.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Macbook
2026-06-14 12:19:19 +09:00
parent 6176c151a3
commit 6b9e88ca9f
6 changed files with 94 additions and 45 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@goldenchart/desktop",
"version": "0.1.3",
"version": "0.1.4",
"private": true,
"type": "module",
"scripts": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "GoldenChart",
"version": "0.1.3",
"version": "0.1.4",
"identifier": "com.goldenchart.desktop",
"build": {
"beforeDevCommand": "npm run dev",
+53 -10
View File
@@ -33,33 +33,76 @@ function emit(onProgress: ((p: DesktopUpdateProgress) => void) | undefined, p: D
onProgress?.(p);
}
function formatUpdateError(e: unknown): string {
function isMacOs(): boolean {
if (typeof navigator !== 'undefined' && /mac/i.test(navigator.userAgent)) return true;
return false;
}
function isWindowsOs(): boolean {
if (typeof navigator !== 'undefined' && /win/i.test(navigator.userAgent)) return true;
return false;
}
async function formatUpdateError(e: unknown): Promise<string> {
const msg = e instanceof Error ? e.message : String(e ?? '');
const lower = msg.toLowerCase();
const onMac = isMacOs();
const onWin = isWindowsOs();
if (!msg.trim()) return '업데이트 확인에 실패했습니다.';
if (/could not fetch a valid release json|release not found/.test(lower)) {
return '업데이트 서버 응답을 처리하지 못했습니다. 잠시 후 다시 시도하거나 PC 프로그램 탭에서 dmg를 새로 설치해 주세요.';
return onMac
? '업데이트 서버 응답을 처리하지 못했습니다. PC 프로그램 탭에서 dmg를 새로 설치해 주세요.'
: '업데이트 서버 응답을 처리하지 못했습니다. PC 프로그램 탭에서 exe를 새로 설치해 주세요.';
}
if (/json|parse|unexpected end|eof|empty|deserialize|invalid value for/.test(lower)) {
return '서버 업데이트 정보(latest.json) 형식 오류입니다. PC 프로그램 탭에서 새 dmg를 받아 주세요.';
return onMac
? '서버 업데이트 정보(latest.json) 형식 오류입니다. PC 프로그램 탭에서 dmg를 받아 주세요.'
: '서버 업데이트 정보(latest.json) 형식 오류입니다. PC 프로그램 탭에서 exe를 받아 주세요.';
}
if (/insecuretransport|insecure transport|http url|https/.test(lower)) {
return '업데이트 URL 보안(HTTPS) 설정 오류입니다. 잠시 후 다시 시도해 주세요.';
}
if (/signature|pubkey|verify|minisign|invalid key/.test(lower)) {
return '업데이트 서명 검증에 실패했습니다. 웹 PC 프로그램 탭에서 설치 파일을 다시 받아 주세요.';
return onMac
? '업데이트 서명 검증에 실패했습니다. PC 프로그램 탭에서 dmg를 다시 받아 주세요.'
: '업데이트 서명 검증에 실패했습니다. PC 프로그램 탭에서 exe를 다시 받아 주세요.';
}
if (/invalid symbol|offset \d+|replace_with/.test(lower)) {
return '이 버전(v0.1.1 이전/초기 dmg)에는 자동 업데이트 키가 없습니다. 웹 PC 프로그램 탭에서 최신 dmg를 받아 Applications에 다시 설치해 주세요. 이후부터는 자동 업데이트가 됩니다.';
}
if (/404|not found/.test(lower)) {
return '업데이트 파일을 찾을 수 없습니다. 관리자에게 문의하거나 dmg를 직접 다운로드해 주세요.';
return onMac
? 'Mac용 업데이트 파일을 찾을 수 없습니다. PC 프로그램 탭에서 dmg를 직접 다운로드해 주세요.'
: 'Windows용 업데이트 파일을 찾을 수 없습니다. PC 프로그램 탭에서 exe를 직접 다운로드해 주세요.';
}
if (/network|fetch|connect|timeout|dns|offline|failed to send/.test(lower)) {
return `네트워크 오류로 업데이트를 확인하지 못했습니다. (${msg})`;
}
if (/fallback platforms|platforms object|windows-x86_64/.test(lower)) {
return 'Windows용 업데이트 패키지가 서버에 없습니다. PC 프로그램 탭에서 exe 설치 파일을 받아 다시 설치해 주세요.';
if (/darwin-x86_64|x86_64.*darwin|intel mac/.test(lower) && onMac) {
return 'Intel Mac용 업데이트 패키지(darwin-x86_64)가 서버에 없습니다. PC 프로그램 탭에서 dmg를 받아 다시 설치해 주세요.';
}
if (/darwin-aarch64|aarch64.*darwin/.test(lower) && onMac) {
return 'Apple Silicon Mac용 업데이트 패키지(darwin-aarch64)가 서버에 없습니다. PC 프로그램 탭에서 dmg를 받아 다시 설치해 주세요.';
}
if (/windows-x86_64/.test(lower) && onWin) {
return 'Windows용 업데이트 패키지가 서버에 없습니다. PC 프로그램 탭에서 exe 설치 파일을 받아 다시 설치해 주세요.';
}
if (/fallback platforms|platforms object|platform.*not found|missing platform/.test(lower)) {
if (onMac) {
const hint = /darwin-x86_64|x86_64/.test(lower)
? 'Intel Mac(darwin-x86_64)'
: 'Apple Silicon Mac(darwin-aarch64)';
return `Mac용 업데이트 패키지가 서버에 없습니다 (${hint}). PC 프로그램 탭에서 dmg를 받아 다시 설치해 주세요.`;
}
if (onWin) {
return 'Windows용 업데이트 패키지가 서버에 없습니다. PC 프로그램 탭에서 exe 설치 파일을 받아 다시 설치해 주세요.';
}
}
if (/platform|darwin|arch|target/.test(lower)) {
return `이 PC용 업데이트 패키지가 없습니다. 웹 PC 프로그램 탭에서 설치 파일을 다시 받아 주세요.`;
return onMac
? 'Mac용 업데이트 패키지가 없습니다. PC 프로그램 탭에서 dmg를 받아 다시 설치해 주세요.'
: '이 PC용 업데이트 패키지가 없습니다. PC 프로그램 탭에서 설치 파일을 다시 받아 주세요.';
}
return msg;
}
@@ -86,7 +129,7 @@ export async function checkForUpdates(): Promise<{
message: `새 버전 v${update.version}을(를) 사용할 수 있습니다. (현재 v${currentVersion})`,
};
} catch (e) {
return { available: false, message: formatUpdateError(e) };
return { available: false, message: await formatUpdateError(e) };
}
}
@@ -192,7 +235,7 @@ export async function runDesktopUpdate(
newVersion: update.version,
};
} catch (e) {
const message = formatUpdateError(e);
const message = await formatUpdateError(e);
emit(onProgress, { phase: 'error', message, currentVersion });
return { ok: false, phase: 'error', message, currentVersion };
}