fix: keep Chinese downloads on OSS loading state
Cross-platform packages / Validate source (push) Canceled after 0s
Deploy website to GitHub Pages / Deploy static website (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Deploy website to GitHub Pages / Deploy static website (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
The Chinese download cards briefly exposed the GitHub fallback before OSS index validation completed. They now stay disabled while loading and only show GitHub if the OSS request or validation fails; English downloads remain unchanged. Release note: 中文官网下载入口加载 OSS 索引期间不再短暂跳转 GitHub,仅在索引失败时回退。
This commit is contained in:
+36
-7
@@ -28,6 +28,8 @@
|
||||
];
|
||||
let verifiedRelease;
|
||||
let verifiedLoongArchPreview;
|
||||
let releaseLoadState = "loading";
|
||||
let loongArchPreviewLoadState = "loading";
|
||||
const interfaceCopy = isEnglish
|
||||
? {
|
||||
themeDark: "Switch to dark theme",
|
||||
@@ -162,6 +164,17 @@
|
||||
meta.textContent = "实验预览 · 仅 DEB · 索引尚未发布或校验失败。";
|
||||
};
|
||||
|
||||
const setDownloadPending = (link, meta, visibleText) => {
|
||||
link.removeAttribute("href");
|
||||
link.removeAttribute("target");
|
||||
link.removeAttribute("rel");
|
||||
link.setAttribute("aria-disabled", "true");
|
||||
link.tabIndex = -1;
|
||||
link.classList.add("is-disabled");
|
||||
setLinkText(link, visibleText);
|
||||
meta.textContent = "正在从 OSS 获取最新版本。";
|
||||
};
|
||||
|
||||
const setLoongArchFormat = (formatSelect, selected) => {
|
||||
for (const option of formatSelect.options) {
|
||||
const unavailable = selected && option.value !== "deb";
|
||||
@@ -188,7 +201,11 @@
|
||||
|
||||
if (loongArchSelected) {
|
||||
if (!verifiedLoongArchPreview) {
|
||||
setDownloadUnavailable(link, meta);
|
||||
if (loongArchPreviewLoadState === "loading") {
|
||||
setDownloadPending(link, meta, "正在获取龙芯预览版下载信息…");
|
||||
} else {
|
||||
setDownloadUnavailable(link, meta);
|
||||
}
|
||||
return;
|
||||
}
|
||||
setReleaseLink(
|
||||
@@ -205,12 +222,20 @@
|
||||
}
|
||||
|
||||
if (!verifiedRelease) {
|
||||
setReleaseLink(
|
||||
link,
|
||||
releaseFallbackUrl,
|
||||
`前往 GitHub 下载 ${platformNames[platform] ?? platform} →`,
|
||||
);
|
||||
meta.textContent = "请在 GitHub Release 中选择对应的安装文件。";
|
||||
if (releaseLoadState === "loading") {
|
||||
setDownloadPending(
|
||||
link,
|
||||
meta,
|
||||
`正在获取 ${platformNames[platform] ?? platform} 下载信息…`,
|
||||
);
|
||||
} else {
|
||||
setReleaseLink(
|
||||
link,
|
||||
releaseFallbackUrl,
|
||||
`前往 GitHub 下载 ${platformNames[platform] ?? platform} →`,
|
||||
);
|
||||
meta.textContent = "请在 GitHub Release 中选择对应的安装文件。";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,11 +272,13 @@
|
||||
|
||||
const setFallbackDownloads = () => {
|
||||
verifiedRelease = undefined;
|
||||
releaseLoadState = "fallback";
|
||||
updateAllDownloadCards();
|
||||
};
|
||||
|
||||
const setLoongArchPreviewUnavailable = () => {
|
||||
verifiedLoongArchPreview = undefined;
|
||||
loongArchPreviewLoadState = "unavailable";
|
||||
const linuxCard = downloadCards.find(
|
||||
(card) => card.dataset.downloadCard === "linux",
|
||||
);
|
||||
@@ -266,6 +293,7 @@
|
||||
}
|
||||
verifiedLoongArchPreview =
|
||||
releaseIndexApi.validateLoongArchPreviewIndex(payload);
|
||||
loongArchPreviewLoadState = "ready";
|
||||
const linuxCard = downloadCards.find(
|
||||
(card) => card.dataset.downloadCard === "linux",
|
||||
);
|
||||
@@ -279,6 +307,7 @@
|
||||
throw new Error("发布索引校验器不可用");
|
||||
}
|
||||
verifiedRelease = releaseIndexApi.validateReleaseIndex(payload);
|
||||
releaseLoadState = "ready";
|
||||
updateAllDownloadCards();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user