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
+23 -29
View File
@@ -7,6 +7,7 @@ export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH:-/usr/bin:/bin}"
UPDATES_DIR="${UPDATES_DIR:-${WORK_TREE:-$ROOT}/frontend/public/desktop/updates}"
CONF="$ROOT/desktop/src-tauri/tauri.conf.json"
BASE_URL="${DESKTOP_UPDATE_BASE_URL:-https://exdev.co.kr/desktop/updates}"
BASE_URL="${BASE_URL/http:\/\//https:\/\/}"
if [[ ! -d "$UPDATES_DIR" ]]; then
echo "[reconcile-latest] skip — no $UPDATES_DIR"
@@ -16,45 +17,38 @@ fi
VERSION="$(node -p "require('$CONF').version" 2>/dev/null || echo '0.1.0')"
LATEST_JSON="$UPDATES_DIR/latest.json"
BUILD_INFO="$UPDATES_DIR/build-info.json"
if [[ -f "$BUILD_INFO" ]]; then
BI_VER="$(node -p "require('$BUILD_INFO').version || ''" 2>/dev/null || true)"
if [[ -n "$BI_VER" ]]; then
VERSION="$(node <<NODE
# bundle 파일명·build-info·기존 manifest 중 최고 버전 사용 (build-info stale 방지)
VERSION="$(node <<NODE
const fs = require('fs');
const path = require('path');
const cmp = (a, b) => {
const pa = a.split('.').map(Number), pb = b.split('.').map(Number);
for (let i = 0; i < 3; i++) { const d = (pa[i]||0)-(pb[i]||0); if (d) return d; }
return 0;
};
console.log(cmp('$BI_VER', '$VERSION') > 0 ? '$BI_VER' : '$VERSION');
NODE
)"
fi
fi
if [[ -f "$LATEST_JSON" ]]; then
EXISTING="$(node <<NODE
const fs = require('fs');
const confV = '$VERSION';
let existing = '0.0.0';
let hasPlatforms = false;
const maxV = (a, b) => (cmp(a, b) >= 0 ? a : b);
let version = '$VERSION';
const dir = '$UPDATES_DIR';
try {
const bi = JSON.parse(fs.readFileSync('$BUILD_INFO', 'utf8'));
if (bi.version) version = maxV(version, bi.version);
} catch {}
try {
const j = JSON.parse(fs.readFileSync('$LATEST_JSON', 'utf8'));
existing = j.version || '0.0.0';
hasPlatforms = j.platforms && Object.keys(j.platforms).length > 0;
} catch {}
if (!hasPlatforms) { console.log(confV); process.exit(0); }
const cmp = (a, b) => {
const pa = a.split('.').map(Number), pb = b.split('.').map(Number);
for (let i = 0; i < 3; i++) {
const d = (pa[i] || 0) - (pb[i] || 0);
if (d !== 0) return d;
if (j.version && j.platforms && Object.keys(j.platforms).length > 0) {
version = maxV(version, j.version);
}
return 0;
};
console.log(cmp(existing, confV) > 0 ? existing : confV);
} catch {}
try {
for (const f of fs.readdirSync(dir)) {
const m = f.match(/(\\d+\\.\\d+\\.\\d+)/);
if (m) version = maxV(version, m[1]);
}
} catch {}
console.log(version);
NODE
)"
VERSION="$EXISTING"
fi
NOTES="${DESKTOP_RELEASE_NOTES:-GoldenChart Desktop $VERSION}"
set +e