fix: stop desktop startup update loop — manifest version matches bundles
Do not inflate latest.json from dmg filenames; use build version only. Add client loop guard when the same update retries without version bump. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,40 +15,23 @@ if [[ ! -d "$UPDATES_DIR" ]]; then
|
||||
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"
|
||||
|
||||
# bundle 파일명·build-info·기존 manifest 중 최고 버전 사용 (build-info stale 방지)
|
||||
VERSION="$(node <<NODE
|
||||
if [[ -f "$BUILD_INFO" ]]; then
|
||||
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;
|
||||
};
|
||||
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'));
|
||||
if (j.version && j.platforms && Object.keys(j.platforms).length > 0) {
|
||||
version = maxV(version, j.version);
|
||||
}
|
||||
} 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);
|
||||
const confV = '$VERSION';
|
||||
let biV = confV;
|
||||
try { biV = JSON.parse(fs.readFileSync('$BUILD_INFO', 'utf8')).version || confV; } catch {}
|
||||
console.log(cmp(biV, confV) > 0 ? biV : confV);
|
||||
NODE
|
||||
)"
|
||||
fi
|
||||
# dmg/exe 설치 파일명 버전은 manifest에 반영하지 않음 (updater tar.gz/exe와 불일치 시 루프 유발)
|
||||
NOTES="${DESKTOP_RELEASE_NOTES:-GoldenChart Desktop $VERSION}"
|
||||
|
||||
set +e
|
||||
|
||||
Reference in New Issue
Block a user