Revert "Download link (#235)"
Some checks reported errors
continuous-integration/drone/push Build was killed

This reverts commit 32cef46dd2.
This commit is contained in:
Zkitefly 2025-07-30 05:03:18 +00:00 committed by GitHub
parent 32cef46dd2
commit 79a689c516
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 13 deletions

View File

@ -28,13 +28,34 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
<script>
setTimeout(function() {
async function checkUrl(url) {
try {
const response = await fetch(url, { method: 'HEAD' });
return response.ok;
} catch {
return false;
}
}
async function redirect() {
const isZhCN = /^zh-CN/i.test(navigator.language);
const url = isZhCN
? "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi"
: "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi";
location.href = url;
}, 5000); // Wait 5 seconds
const url1 = "https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-aarch64.msi";
const url2 = "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi";
const [url1Available, url2Available] = await Promise.all([
checkUrl(url1),
checkUrl(url2)
]);
if (url1Available && !url2Available) {
window.location.href = url1;
} else if (!url1Available && url2Available) {
window.location.href = url2;
} else {
window.location.href = isZhCN ? url1 : url2;
}
}
setTimeout(redirect, 5000); // Wait 5 seconds
</script>

View File

@ -28,12 +28,34 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
<script>
setTimeout(function() {
async function checkUrl(url) {
try {
const response = await fetch(url, { method: 'HEAD' });
return response.ok;
} catch {
return false;
}
}
async function redirect() {
const isZhCN = /^zh-CN/i.test(navigator.language);
const url = isZhCN
? "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi"
: "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi";
window.location.href = url;
}, 5000); // Wait 5 seconds
const url1 = "https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-x64.msi";
const url2 = "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi";
const [url1Available, url2Available] = await Promise.all([
checkUrl(url1),
checkUrl(url2)
]);
if (url1Available && !url2Available) {
window.location.href = url1;
} else if (!url1Available && url2Available) {
window.location.href = url2;
} else {
window.location.href = isZhCN ? url1 : url2;
}
}
setTimeout(redirect, 5000); // Wait 5 seconds
</script>