rsspls.7bit.org/static/home.js

38 lines
1.4 KiB
JavaScript

const installButton = document.querySelector(".install-button");
const version = installButton ? installButton.dataset.version : null;
if (installButton && version) {
const baseUrl = "https://releases.wezm.net/rsspls/"+version+"/";
const agent = window.navigator.userAgent;
let file = null;
let os = null;
let arch = null;
if (agent.indexOf("Windows") >= 0) {
file = "rsspls-"+version+"-x86_64-pc-windows-msvc.zip";
os = "Windows";
arch = "x86_64";
}
else if (agent.indexOf("Mac OS X") >= 0 || agent.indexOf("macOS") >= 0) {
file = "rsspls-"+version+"-universal-apple-darwin.tar.gz";
os = "macOS";
arch = "universal";
}
else if (agent.indexOf("FreeBSD") >= 0 && x64(agent)) {
file = "rsspls-"+version+"-amd64-unknown-freebsd.tar.gz";
os = "FreeBSD";
arch = "amd64";
}
else if (agent.indexOf("Linux") >= 0 && x64(agent)) {
file = "rsspls-"+version+"-x86_64-unknown-linux-musl.tar.gz";
os = "Linux";
arch = "x86_64";
}
if (file !== null && os != null && arch != null) {
installButton.href = baseUrl + file;
installButton.innerText = "Download for "+os;
installButton.title = "rsspls "+version+" for "+os+" "+arch;
}
}
function x64(agent) {
return (agent.indexOf("x86_64") >= 0 || agent.indexOf("amd64") >= 0);
}