Skip to content

Commit 7bcbe29

Browse files
committed
Deploying to gh-pages from @ e44afd3 🚀
0 parents  commit 7bcbe29

15 files changed

+3779
-0
lines changed

artifacts.js

+245
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
/* Code modified from the blender website
2+
* https://www.blender.org/wp-content/themes/bthree/assets/js/get_os.js?x82196
3+
*/
4+
5+
let options = {
6+
windows64: "x86_64-pc-windows",
7+
windows32: "i686-pc-windows",
8+
windowsArm: "aarch64-pc-windows",
9+
10+
mac64: "x86_64-apple",
11+
mac32: "i686-apple",
12+
macSilicon: "aarch64-apple",
13+
14+
linux64: "x86_64-unknown-linux",
15+
linux32: "i686-unknown-linux",
16+
linuxArm: "aarch64-unknown-linux",
17+
18+
// ios: "ios",
19+
// android: "linux-android",
20+
// freebsd: "freebsd",
21+
};
22+
23+
function isAppleSilicon() {
24+
try {
25+
var glcontext = document.createElement("canvas").getContext("webgl");
26+
var debugrenderer = glcontext
27+
? glcontext.getExtension("WEBGL_debug_renderer_info")
28+
: null;
29+
var renderername =
30+
(debugrenderer &&
31+
glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL)) ||
32+
"";
33+
if (renderername.match(/Apple M/) || renderername.match(/Apple GPU/)) {
34+
return true;
35+
}
36+
37+
return false;
38+
} catch (e) {}
39+
}
40+
41+
function getOS() {
42+
var OS = options.windows64.default;
43+
var userAgent = navigator.userAgent;
44+
var platform = navigator.platform;
45+
46+
if (navigator.appVersion.includes("Win")) {
47+
if (
48+
!userAgent.includes("Windows NT 5.0") &&
49+
!userAgent.includes("Windows NT 5.1") &&
50+
(userAgent.indexOf("Win64") > -1 ||
51+
platform == "Win64" ||
52+
userAgent.indexOf("x86_64") > -1 ||
53+
userAgent.indexOf("x86_64") > -1 ||
54+
userAgent.indexOf("amd64") > -1 ||
55+
userAgent.indexOf("AMD64") > -1 ||
56+
userAgent.indexOf("WOW64") > -1)
57+
) {
58+
OS = options.windows64;
59+
} else {
60+
if (
61+
window.external &&
62+
window.external.getHostEnvironmentValue &&
63+
window.external
64+
.getHostEnvironmentValue("os-architecture")
65+
.includes("ARM64")
66+
) {
67+
OS = options.windowsArm;
68+
} else {
69+
try {
70+
var canvas = document.createElement("canvas");
71+
var gl = canvas.getContext("webgl");
72+
73+
var debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
74+
var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
75+
if (renderer.includes("Qualcomm")) OS = options.windowsArm;
76+
} catch (e) {}
77+
}
78+
}
79+
}
80+
81+
//MacOS, MacOS X, macOS
82+
if (navigator.appVersion.includes("Mac")) {
83+
if (
84+
navigator.userAgent.includes("OS X 10.5") ||
85+
navigator.userAgent.includes("OS X 10.6")
86+
) {
87+
OS = options.mac32;
88+
} else {
89+
OS = options.mac64;
90+
91+
const isSilicon = isAppleSilicon();
92+
if (isSilicon) {
93+
OS = options.macSilicon;
94+
}
95+
}
96+
}
97+
98+
// linux
99+
if (platform.includes("Linux")) {
100+
OS = options.linux64;
101+
// FIXME: Can we find out whether linux 32-bit or ARM are used?
102+
}
103+
104+
// if (
105+
// userAgent.includes("iPad") ||
106+
// userAgent.includes("iPhone") ||
107+
// userAgent.includes("iPod")
108+
// ) {
109+
// OS = options.ios;
110+
// }
111+
// if (platform.toLocaleLowerCase().includes("freebsd")) {
112+
// OS = options.freebsd;
113+
// }
114+
115+
return OS;
116+
}
117+
118+
let os = getOS();
119+
window.os = os;
120+
121+
// Unhide and hydrate selector with events
122+
const archSelect = document.querySelector(".arch-select");
123+
if (archSelect) {
124+
archSelect.classList.remove("hidden");
125+
const selector = document.querySelector("#install-arch-select");
126+
if (selector) {
127+
selector.addEventListener("change", onArchChange);
128+
}
129+
}
130+
131+
// Hydrate tab buttons with events
132+
Array.from(document.querySelectorAll(".install-tab[data-id]")).forEach((tab) => {
133+
tab.addEventListener("click", onTabClick);
134+
});
135+
136+
function onArchChange(evt) {
137+
// Get target
138+
const target = evt.currentTarget.value;
139+
// Find corresponding installer lists
140+
const newContentEl = document.querySelector(`.arch[data-arch=${target}]`);
141+
const oldContentEl = document.querySelector(`.arch[data-arch]:not(.hidden)`);
142+
// Hide old content element (if applicable)
143+
if (oldContentEl) {
144+
oldContentEl.classList.add("hidden");
145+
}
146+
// Show new content element
147+
newContentEl.classList.remove("hidden");
148+
// Show the first tab's content if nothing was selected before
149+
if (newContentEl.querySelectorAll(".install-tab.selected").length === 0) {
150+
const firstContentChild = newContentEl.querySelector(".install-content:first-of-type");
151+
const firstTabChild = newContentEl.querySelector(".install-tab:first-of-type");
152+
firstContentChild.classList.remove("hidden");
153+
if (firstTabChild) {
154+
firstTabChild.classList.add("selected");
155+
}
156+
}
157+
// Hide "no OS detected" message
158+
const noDetectEl = document.querySelector(".no-autodetect");
159+
noDetectEl.classList.add("hidden");
160+
// Hide Mac hint
161+
document.querySelector(".mac-switch").classList.add("hidden");
162+
}
163+
164+
function onTabClick(evt) {
165+
// Get target and ID
166+
const {triple, id} = evt.currentTarget.dataset;
167+
if (triple) {
168+
// Find corresponding content elements
169+
const newContentEl = document.querySelector(`.install-content[data-id="${String(id)}"][data-triple=${triple}]`);
170+
const oldContentEl = document.querySelector(`.install-content[data-triple=${triple}][data-id]:not(.hidden)`);
171+
// Find old tab to unselect
172+
const oldTabEl = document.querySelector(`.install-tab[data-triple=${triple}].selected`);
173+
// Hide old content element
174+
if (oldContentEl && oldTabEl) {
175+
oldContentEl.classList.add("hidden");
176+
oldTabEl.classList.remove("selected");
177+
}
178+
179+
// Unhide new content element
180+
newContentEl.classList.remove("hidden");
181+
// Select new tab element
182+
evt.currentTarget.classList.add("selected");
183+
}
184+
}
185+
186+
const allPlatforms = Array.from(document.querySelectorAll(`.arch[data-arch]`));
187+
let hit = allPlatforms.find(
188+
(a) => {
189+
// Show Intel Mac downloads if no M1 Mac downloads are available
190+
if (
191+
a.attributes["data-arch"].value.includes(options.mac64) &&
192+
os.includes(options.macSilicon) &&
193+
!allPlatforms.find(p => p.attributes["data-arch"].value.includes(options.macSilicon))) {
194+
// Unhide hint
195+
document.querySelector(".mac-switch").classList.remove("hidden");
196+
return true;
197+
}
198+
return a.attributes["data-arch"].value.includes(os);
199+
}
200+
);
201+
202+
if (hit) {
203+
hit.classList.remove("hidden");
204+
const selectEl = document.querySelector("#install-arch-select");
205+
selectEl.value = hit.dataset.arch;
206+
const firstContentChild = hit.querySelector(".install-content:first-of-type");
207+
const firstTabChild = hit.querySelector(".install-tab:first-of-type");
208+
firstContentChild.classList.remove("hidden");
209+
if (firstTabChild) {
210+
firstTabChild.classList.add("selected");
211+
}
212+
} else {
213+
const noDetectEl = document.querySelector(".no-autodetect");
214+
if (noDetectEl) {
215+
const noDetectElDetails = document.querySelector(".no-autodetect-details");
216+
if (noDetectElDetails) {
217+
noDetectElDetails.innerHTML = `We detected you're on ${os} but there don't seem to be installers for that. `
218+
}
219+
noDetectEl.classList.remove("hidden");
220+
}
221+
}
222+
223+
let copyButtons = Array.from(document.querySelectorAll("[data-copy]"));
224+
if (copyButtons.length) {
225+
copyButtons.forEach(function (element) {
226+
element.addEventListener("click", () => {
227+
navigator.clipboard.writeText(element.attributes["data-copy"].value);
228+
});
229+
});
230+
}
231+
232+
// Toggle for pre releases
233+
const checkbox = document.getElementById("show-prereleases");
234+
235+
if (checkbox) {
236+
checkbox.addEventListener("click", () => {
237+
const all = document.getElementsByClassName("pre-release");
238+
239+
if (all) {
240+
for (var item of all) {
241+
item.classList.toggle("hidden");
242+
}
243+
}
244+
});
245+
}

artifacts.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"format_version":"0.6.5","tag":"v0.4.1","formatted_date":"Dec 15 2024 at 17:25 UTC","platforms_with_downloads":[{"target":["aarch64-apple-darwin"],"display_name":"macOS Apple Silicon","installers":[5,2]},{"target":["aarch64-unknown-linux-gnu"],"display_name":"Linux arm64","installers":[5,3]},{"target":["x86_64-apple-darwin"],"display_name":"macOS Intel","installers":[5,6]},{"target":["x86_64-pc-windows-msvc"],"display_name":"Windows x64","installers":[4,7]},{"target":["x86_64-unknown-linux-gnu"],"display_name":"Linux x64","installers":[5,8]}],"downloadable_files":[[1,{"name":"mc-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Apple Silicon"]],[3,{"name":"mc-aarch64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-aarch64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},["Linux arm64"]],[7,{"name":"mc-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Intel"]],[9,{"name":"mc-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},["Windows x64"]],[11,{"name":"mc-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},["Linux x64"]]],"release":{"artifacts":{"files":[{"name":"dist-manifest.json","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/dist-manifest.json","view_path":null,"checksum_file":null},{"name":"mc-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"mc-aarch64-apple-darwin.tar.xz.sha256","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-aarch64-apple-darwin.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"mc-aarch64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-aarch64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},{"name":"mc-aarch64-unknown-linux-gnu.tar.xz.sha256","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-aarch64-unknown-linux-gnu.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"mc-installer.ps1","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-installer.ps1","view_path":"mc-installer.ps1.txt","checksum_file":null},{"name":"mc-installer.sh","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-installer.sh","view_path":"mc-installer.sh.txt","checksum_file":null},{"name":"mc-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"mc-x86_64-apple-darwin.tar.xz.sha256","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-apple-darwin.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"mc-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},{"name":"mc-x86_64-pc-windows-msvc.zip.sha256","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-pc-windows-msvc.zip.sha256","view_path":null,"checksum_file":null},{"name":"mc-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},{"name":"mc-x86_64-unknown-linux-gnu.tar.xz.sha256","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-x86_64-unknown-linux-gnu.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"sha256.sum","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/sha256.sum","view_path":null,"checksum_file":null},{"name":"source.tar.gz","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/source.tar.gz","view_path":null,"checksum_file":null},{"name":"source.tar.gz.sha256","download_url":"https://github.com/thewh1teagle/mc/releases/download/v0.4.1/source.tar.gz.sha256","view_path":null,"checksum_file":null}],"installers":[{"label":"binstall","description":"","app_name":null,"method":{"type":"Run","file":null,"run_hint":"cargo binstall mc-cli"}},{"label":"cargo","description":"","app_name":null,"method":{"type":"Run","file":null,"run_hint":"cargo install mc-cli"}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":1}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":3}},{"label":"powershell","description":"","app_name":null,"method":{"type":"Run","file":5,"run_hint":"powershell -c \"irm https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-installer.ps1 | iex\""}},{"label":"shell","description":"","app_name":null,"method":{"type":"Run","file":6,"run_hint":"curl --proto '=https' --tlsv1.2 -LsSf https://github.com/thewh1teagle/mc/releases/download/v0.4.1/mc-installer.sh | sh"}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":7}},{"label":"zip","description":"","app_name":null,"method":{"type":"Download","file":9}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":11}}],"targets":{"aarch64-apple-darwin":[5,2],"aarch64-pc-windows-msvc":[4],"aarch64-unknown-linux-gnu":[5,3],"aarch64-unknown-linux-musl":[5],"i686-apple-darwin":[5],"i686-pc-windows-msvc":[4],"i686-unknown-linux-gnu":[5],"i686-unknown-linux-musl":[5],"x86_64-apple-darwin":[5,6],"x86_64-pc-windows-msvc":[4,7],"x86_64-unknown-linux-gnu":[5,8],"x86_64-unknown-linux-musl":[5]}}},"os_script":"/mc/artifacts.js","has_checksum_files":false}

0 commit comments

Comments
 (0)