Skip to content

Commit

Permalink
Deploying to gh-pages from @ a6e21cd 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Mar 20, 2024
0 parents commit 4e339ba
Show file tree
Hide file tree
Showing 79 changed files with 18,025 additions and 0 deletions.
245 changes: 245 additions & 0 deletions artifacts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
/* Code modified from the blender website
* https://www.blender.org/wp-content/themes/bthree/assets/js/get_os.js?x82196
*/

let options = {
windows64: "x86_64-pc-windows",
windows32: "i686-pc-windows",
windowsArm: "aarch64-pc-windows",

mac64: "x86_64-apple",
mac32: "i686-apple",
macSilicon: "aarch64-apple",

linux64: "x86_64-unknown-linux",
linux32: "i686-unknown-linux",
linuxArm: "aarch64-unknown-linux",

// ios: "ios",
// android: "linux-android",
// freebsd: "freebsd",
};

function isAppleSilicon() {
try {
var glcontext = document.createElement("canvas").getContext("webgl");
var debugrenderer = glcontext
? glcontext.getExtension("WEBGL_debug_renderer_info")
: null;
var renderername =
(debugrenderer &&
glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL)) ||
"";
if (renderername.match(/Apple M/) || renderername.match(/Apple GPU/)) {
return true;
}

return false;
} catch (e) {}
}

function getOS() {
var OS = options.windows64.default;
var userAgent = navigator.userAgent;
var platform = navigator.platform;

if (navigator.appVersion.includes("Win")) {
if (
!userAgent.includes("Windows NT 5.0") &&
!userAgent.includes("Windows NT 5.1") &&
(userAgent.indexOf("Win64") > -1 ||
platform == "Win64" ||
userAgent.indexOf("x86_64") > -1 ||
userAgent.indexOf("x86_64") > -1 ||
userAgent.indexOf("amd64") > -1 ||
userAgent.indexOf("AMD64") > -1 ||
userAgent.indexOf("WOW64") > -1)
) {
OS = options.windows64;
} else {
if (
window.external &&
window.external.getHostEnvironmentValue &&
window.external
.getHostEnvironmentValue("os-architecture")
.includes("ARM64")
) {
OS = options.windowsArm;
} else {
try {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl");

var debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
if (renderer.includes("Qualcomm")) OS = options.windowsArm;
} catch (e) {}
}
}
}

//MacOS, MacOS X, macOS
if (navigator.appVersion.includes("Mac")) {
if (
navigator.userAgent.includes("OS X 10.5") ||
navigator.userAgent.includes("OS X 10.6")
) {
OS = options.mac32;
} else {
OS = options.mac64;

const isSilicon = isAppleSilicon();
if (isSilicon) {
OS = options.macSilicon;
}
}
}

// linux
if (platform.includes("Linux")) {
OS = options.linux64;
// FIXME: Can we find out whether linux 32-bit or ARM are used?
}

// if (
// userAgent.includes("iPad") ||
// userAgent.includes("iPhone") ||
// userAgent.includes("iPod")
// ) {
// OS = options.ios;
// }
// if (platform.toLocaleLowerCase().includes("freebsd")) {
// OS = options.freebsd;
// }

return OS;
}

let os = getOS();
window.os = os;

// Unhide and hydrate selector with events
const archSelect = document.querySelector(".arch-select");
if (archSelect) {
archSelect.classList.remove("hidden");
const selector = document.querySelector("#install-arch-select");
if (selector) {
selector.addEventListener("change", onArchChange);
}
}

// Hydrate tab buttons with events
Array.from(document.querySelectorAll(".install-tab[data-id]")).forEach((tab) => {
tab.addEventListener("click", onTabClick);
});

function onArchChange(evt) {
// Get target
const target = evt.currentTarget.value;
// Find corresponding installer lists
const newContentEl = document.querySelector(`.arch[data-arch=${target}]`);
const oldContentEl = document.querySelector(`.arch[data-arch]:not(.hidden)`);
// Hide old content element (if applicable)
if (oldContentEl) {
oldContentEl.classList.add("hidden");
}
// Show new content element
newContentEl.classList.remove("hidden");
// Show the first tab's content if nothing was selected before
if (newContentEl.querySelectorAll(".install-tab.selected").length === 0) {
const firstContentChild = newContentEl.querySelector(".install-content:first-of-type");
const firstTabChild = newContentEl.querySelector(".install-tab:first-of-type");
firstContentChild.classList.remove("hidden");
if (firstTabChild) {
firstTabChild.classList.add("selected");
}
}
// Hide "no OS detected" message
const noDetectEl = document.querySelector(".no-autodetect");
noDetectEl.classList.add("hidden");
// Hide Mac hint
document.querySelector(".mac-switch").classList.add("hidden");
}

function onTabClick(evt) {
// Get target and ID
const {triple, id} = evt.currentTarget.dataset;
if (triple) {
// Find corresponding content elements
const newContentEl = document.querySelector(`.install-content[data-id="${String(id)}"][data-triple=${triple}]`);
const oldContentEl = document.querySelector(`.install-content[data-triple=${triple}][data-id]:not(.hidden)`);
// Find old tab to unselect
const oldTabEl = document.querySelector(`.install-tab[data-triple=${triple}].selected`);
// Hide old content element
if (oldContentEl && oldTabEl) {
oldContentEl.classList.add("hidden");
oldTabEl.classList.remove("selected");
}

// Unhide new content element
newContentEl.classList.remove("hidden");
// Select new tab element
evt.currentTarget.classList.add("selected");
}
}

const allPlatforms = Array.from(document.querySelectorAll(`.arch[data-arch]`));
let hit = allPlatforms.find(
(a) => {
// Show Intel Mac downloads if no M1 Mac downloads are available
if (
a.attributes["data-arch"].value.includes(options.mac64) &&
os.includes(options.macSilicon) &&
!allPlatforms.find(p => p.attributes["data-arch"].value.includes(options.macSilicon))) {
// Unhide hint
document.querySelector(".mac-switch").classList.remove("hidden");
return true;
}
return a.attributes["data-arch"].value.includes(os);
}
);

if (hit) {
hit.classList.remove("hidden");
const selectEl = document.querySelector("#install-arch-select");
selectEl.value = hit.dataset.arch;
const firstContentChild = hit.querySelector(".install-content:first-of-type");
const firstTabChild = hit.querySelector(".install-tab:first-of-type");
firstContentChild.classList.remove("hidden");
if (firstTabChild) {
firstTabChild.classList.add("selected");
}
} else {
const noDetectEl = document.querySelector(".no-autodetect");
if (noDetectEl) {
const noDetectElDetails = document.querySelector(".no-autodetect-details");
if (noDetectElDetails) {
noDetectElDetails.innerHTML = `We detected you're on ${os} but there don't seem to be installers for that. `
}
noDetectEl.classList.remove("hidden");
}
}

let copyButtons = Array.from(document.querySelectorAll("[data-copy]"));
if (copyButtons.length) {
copyButtons.forEach(function (element) {
element.addEventListener("click", () => {
navigator.clipboard.writeText(element.attributes["data-copy"].value);
});
});
}

// Toggle for pre releases
const checkbox = document.getElementById("show-prereleases");

if (checkbox) {
checkbox.addEventListener("click", () => {
const all = document.getElementsByClassName("pre-release");

if (all) {
for (var item of all) {
item.classList.toggle("hidden");
}
}
});
}
1 change: 1 addition & 0 deletions artifacts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"format_version":"0.6.2","tag":"0.12.0-prerelease.1","formatted_date":null,"platforms_with_downloads":[{"target":["aarch64-apple-darwin"],"display_name":"macOS Apple Silicon","installers":[0]},{"target":["x86_64-apple-darwin"],"display_name":"macOS Intel","installers":[0]},{"target":["x86_64-pc-windows-msvc"],"display_name":"Windows x64","installers":[0]},{"target":["x86_64-unknown-linux-gnu"],"display_name":"Linux x64","installers":[0]}],"downloadable_files":[],"release":{"artifacts":{"files":[],"installers":[{"label":"crates.io","description":"","app_name":null,"method":{"type":"Run","file":null,"run_hint":"cargo install cargo-dist"}}],"targets":{"aarch64-apple-darwin":[0],"aarch64-pc-windows-msvc":[0],"aarch64-unknown-linux-gnu":[0],"aarch64-unknown-linux-musl":[0],"i686-apple-darwin":[0],"i686-pc-windows-msvc":[0],"i686-unknown-linux-gnu":[0],"i686-unknown-linux-musl":[0],"x86_64-apple-darwin":[0],"x86_64-pc-windows-msvc":[0],"x86_64-unknown-linux-gnu":[0],"x86_64-unknown-linux-musl":[0]}}},"os_script":"/cargo-dist/artifacts.js","has_checksum_files":false}
133 changes: 133 additions & 0 deletions artifacts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en" id="oranda" class="dark axo">
<head>
<title>cargo-dist</title>


<link rel="icon" href="/cargo-dist/favicon.ico" />

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<meta name="description" content="Shippable application packaging for Rust" />
<meta property="og:description" content="Shippable application packaging for Rust" />

<meta property="og:type" content="website" />
<meta property="og:title" content="cargo-dist" />

<meta name="twitter:card" content="summary_large_image" />
<meta property="og:image" content="https://www.axo.dev/meta_small.jpeg" />


<meta property="og:image:alt" content="axo" />


<meta name="twitter:creator" content="@axodotdev" />
<meta name="twitter:site" content="@axodotdev" />

<meta http-equiv="Permissions-Policy" content="interest-cohort=()" />
<link rel="stylesheet" href="/cargo-dist/oranda-v0.6.1.css" />


</head>
<body>
<div class="container">
<div class="page-body">

<div class="repo_banner">
<a href="https://github.com/axodotdev/cargo-dist">
<div class="github-icon" aria-hidden="true"></div>
Check out our GitHub!
</a>
</div>


<main>
<header>

<h1 class="title">cargo-dist</h1>

<nav class="nav">
<ul>
<li><a href="/cargo-dist/">Home</a></li>




<li><a href="/cargo-dist/artifacts/">Install</a></li>



<li><a href="/cargo-dist/book/">Docs</a></li>





<li><a href="/cargo-dist/changelog/">Changelog</a></li>

</ul>
</nav>

</header>


<div>
<div class="package-managers-downloads">



<div>
<h3>crates.io</h3>
<div class="install-code-wrapper">
<pre style="background-color:#263238;">
<span style="color:#82aaff;">cargo install cargo-dist</span></pre>

<button class="button copy-clipboard-button primary" data-copy="cargo install cargo-dist">
<svg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 20 20' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'><path d='M8 2a1 1 0 000 2h2a1 1 0 100-2H8z'></path><path d='M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5zM15 11h2a1 1 0 110 2h-2v-2z'></path></svg>
</button>


</div>
</div>


</div>
<div>
<h3>Downloads</h3>
<table class="artifacts-table">
<tbody>
<tr>
<th>File</th>
<th>Platform</th>

</tr>

</tbody>
</table>
</div>
</div>

</main>
</div>

<footer>

<a href="https://github.com/axodotdev/cargo-dist"><div class="github-icon" aria-hidden="true"></div></a>

<span>
cargo-dist, MIT OR Apache-2.0
</span>
</footer>
</div>


<script defer="true" data-domain="opensource.axo.dev" src="https://plausible.io/js/script.js"></script>




<script src="/cargo-dist/artifacts.js"></script>

</body>
</html>
Loading

0 comments on commit 4e339ba

Please sign in to comment.