fix(update): never offer a lower or equal version on prerelease channels

Setting a channel makes electron-updater allow downgrades, and the channel
check let prerelease channels accept them, so a stable install on beta would
be asked to 'update' down to an older beta.
This commit is contained in:
Yun Chan 2026-10-20 16:34:48 +09:00
parent 4e75f515e2
commit a03cda2211
2 changed files with 10 additions and 7 deletions

View file

@ -144,14 +144,10 @@ export function isChannelAcceptable(
const targetIsPrerelease = target.prerelease.length > 0
// stable 채널은 더 높은 prerelease로 올라가지 않는다.
if (!allowPrerelease && targetIsPrerelease && !currentIsPrerelease) return false
// prerelease가 아닌 현재 버전보다 낮은/같은 버전으로 내려가지 않는다.
// 어느 채널이든 낮은/같은 버전으로 내려가지 않는다. 채널을 지정하면 electron-updater 가 allowDowngrade 를
// 켜서 낮은 버전도 update-available 로 보낸다 — 여기서 막지 않으면 정식판에서 beta 로 내려가자고 물었다.
const ordering = compareVersions(currentVersion, targetVersion)
if (ordering === null) return false
if (ordering >= 0) {
// 다운그레이드는 채널이 prerelease를 허용할 때만 (예: beta → stable 정렬).
return allowPrerelease ? ordering >= 0 : false
}
return true
return ordering !== null && ordering < 0
}
/** 현재 버전·대상 버전·정책으로 업데이트 결정을 계산한다. */