fix: 发布 1.1.29,更新下载不再把 GitHub 302 当成失败

- 安装包里的 1.1.26 仍用 fetch 拉 github.com/archive,宿主不跟随 302 就报 http 302,切换失败所以版本一直停在旧的
- 下载改走 Node https,302 读 Location;没有 Location 时把 archive 地址改写成 codeload
- 自动更新只跟版本号,并在安装前写 stamp,避免 add --force 重启后再次更新
- 钉住的标签只标一条为当前

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-28 15:39:34 +08:00
1 parent 00b4c6f93d
commit 9504b8ab1a
5 files changed
+172 -43

No files matched your search

+5 -3
View File
@@ -892,7 +892,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
const next = { stable: "", beta: "" };
for (const id of ["stable", "beta"]) {
const list = versions.filter((item) => item.channel === id && keepListedVersion(item, ceiling));
const hit = preferListed(list, d && d.localVersion);
const hit = preferListed(list, d && d.localVersion, d && d.pin);
next[id] = (hit && hit.ref) || "";
}
setPick(next);
@@ -1279,7 +1279,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
const ceiling = listedCeiling(versions, localVer || (updateInfo && updateInfo.localVersion));
const list = versions.filter((item) => item.channel === id && keepListedVersion(item, ceiling));
const selectedRef = pick[id] || "";
const hit = list.find((item) => item.ref === selectedRef) || preferListed(list, localVer);
const hit = list.find((item) => item.ref === selectedRef) || preferListed(list, localVer, updateInfo && updateInfo.pin);
const onLane = channelNow === id;
const noBeta = id === "beta" && Array.isArray(updateInfo && updateInfo.versions) && !list.length;
const pickedOther = Boolean(hit && selectedRef && !hit.current);
@@ -1721,7 +1721,9 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
return listedVersionNewer(ver, ceiling);
}
function preferListed(list, localVer) {
function preferListed(list, localVer, pin) {
const pinned = pin ? (list || []).find((item) => item.ref === pin) : null;
if (pinned) return pinned;
const ver = String(localVer || "").replace(/^v/i, "");
return (list || []).find((item) => item.current)
|| (list || []).find((item) => ver && String(item.version || "").replace(/^v/i, "") === ver)