Skip to content

Commit 1092ea5

Browse files
committed
Use mirrored versions lists instead of maddie480.ovh on the home page
Some people can't access maddie480.ovh... and since they're on everestapi.github.io, might as well fetch the versions lists from the same website.
1 parent ae5b23a commit 1092ea5

File tree

1 file changed

+34
-46
lines changed

1 file changed

+34
-46
lines changed

index.js

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,26 @@
1212
// === Fetch link to Everest
1313

1414
{
15-
// a static file on this website indicates to Everest and Olympus where the Everest versions list is provided,
16-
// so load the URL from there as well...
17-
const updaterUrlFetch = await fetch("/everestupdater.txt");
18-
19-
if (updaterUrlFetch.ok) {
20-
// ... then call it.
21-
const updaterUrl = await updaterUrlFetch.text();
22-
const versionListFetch = await fetch(updaterUrl.trim() + "?supportsNativeBuilds=true");
23-
24-
if (versionListFetch.ok) {
25-
const versionList = await versionListFetch.json();
26-
27-
const stable = getLinkForBranch(versionList, "stable").mainDownload;
28-
const beta = getLinkForBranch(versionList, "beta").mainDownload;
29-
const dev = getLinkForBranch(versionList, "dev").mainDownload;
30-
31-
// if all versions have an existing build...
32-
if (stable !== null && beta !== null && dev !== null) {
33-
// set the links to their artifacts
34-
document.getElementById("latest-stable-link").href = stable;
35-
document.getElementById("latest-beta-link").href = beta;
36-
document.getElementById("latest-dev-link").href = dev;
37-
38-
// remove the line saying "Click the '1 published' button under 'Related', then 'main' to download it." since those are now direct links.
39-
var artifactInstructions = document.getElementById("artifact-instructions");
40-
artifactInstructions.parentNode.removeChild(artifactInstructions);
41-
}
15+
// call the API mirror on this very website to retrieve the versions list
16+
const versionListFetch = await fetch("https://everestapi.github.io/updatermirror/everest_versions.json");
17+
18+
if (versionListFetch.ok) {
19+
const versionList = await versionListFetch.json();
20+
21+
const stable = getLinkForBranch(versionList, "stable").mainDownload;
22+
const beta = getLinkForBranch(versionList, "beta").mainDownload;
23+
const dev = getLinkForBranch(versionList, "dev").mainDownload;
24+
25+
// if all versions have an existing build...
26+
if (stable !== null && beta !== null && dev !== null) {
27+
// set the links to their artifacts
28+
document.getElementById("latest-stable-link").href = stable;
29+
document.getElementById("latest-beta-link").href = beta;
30+
document.getElementById("latest-dev-link").href = dev;
31+
32+
// remove the line saying "Click the '1 published' button under 'Related', then 'main' to download it." since those are now direct links.
33+
var artifactInstructions = document.getElementById("artifact-instructions");
34+
artifactInstructions.parentNode.removeChild(artifactInstructions);
4235
}
4336
}
4437
}
@@ -47,29 +40,24 @@
4740
// === Fetch link to Olympus
4841

4942
{
50-
const updaterUrlFetch = await fetch("/olympusupdater.txt");
43+
// call the API mirror on this very website to retrieve the versions list
44+
const versionListFetch = await fetch("https://everestapi.github.io/updatermirror/olympus_versions.json");
5145

52-
if (updaterUrlFetch.ok) {
53-
// ... then call it.
54-
const updaterUrl = await updaterUrlFetch.text();
55-
const versionListFetch = await fetch(updaterUrl.trim());
46+
if (versionListFetch.ok) {
47+
const versionList = await versionListFetch.json();
5648

57-
if (versionListFetch.ok) {
58-
const versionList = await versionListFetch.json();
49+
const stable = getLinkForBranch(versionList, "stable");
5950

60-
const stable = getLinkForBranch(versionList, "stable");
51+
if (stable !== null) {
52+
// set the links to the latest stable
53+
document.getElementById("olympus-macos-latest-link").href = stable.macosDownload;
54+
document.getElementById("olympus-linux-latest-link").href = stable.linuxDownload;
6155

62-
if (stable !== null) {
63-
// set the links to the latest stable
64-
document.getElementById("olympus-macos-latest-link").href = stable.macosDownload;
65-
document.getElementById("olympus-linux-latest-link").href = stable.linuxDownload;
66-
67-
// remove the line saying "Click the '5 published' button under 'Related', then '...main' to download it." since those are now direct links.
68-
const artifactInstructionsMacOS = document.getElementById("olympus-macos-artifact-instructions");
69-
artifactInstructionsMacOS.parentNode.removeChild(artifactInstructionsMacOS);
70-
const artifactInstructionsLinux = document.getElementById("olympus-linux-artifact-instructions");
71-
artifactInstructionsLinux.parentNode.removeChild(artifactInstructionsLinux);
72-
}
56+
// remove the line saying "Click the '5 published' button under 'Related', then '...main' to download it." since those are now direct links.
57+
const artifactInstructionsMacOS = document.getElementById("olympus-macos-artifact-instructions");
58+
artifactInstructionsMacOS.parentNode.removeChild(artifactInstructionsMacOS);
59+
const artifactInstructionsLinux = document.getElementById("olympus-linux-artifact-instructions");
60+
artifactInstructionsLinux.parentNode.removeChild(artifactInstructionsLinux);
7361
}
7462
}
7563
}

0 commit comments

Comments
 (0)