diff options
author | 0neGal <mail@0negal.com> | 2022-07-09 00:02:13 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-07-09 00:02:13 +0200 |
commit | eaa6437ad476f73a5b4464938c806bcdc53c8899 (patch) | |
tree | c6dfe33dcb172941473223929a6f8e4ca2d56a75 /docs | |
parent | 2bd408ece80e8cf3b94aafd75e481e487b867bb3 (diff) | |
download | Viper-eaa6437ad476f73a5b4464938c806bcdc53c8899.tar.gz Viper-eaa6437ad476f73a5b4464938c806bcdc53c8899.zip |
move site/ to docs/
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 8 | ||||
-rw-r--r-- | docs/main.js | 44 |
2 files changed, 52 insertions, 0 deletions
diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..a817e49 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,8 @@ +<html> + <head> + <title>Viper</title> + </head> + <body> + <script src="main.js"></script> + </body> +</html> diff --git a/docs/main.js b/docs/main.js new file mode 100644 index 0000000..38c91ec --- /dev/null +++ b/docs/main.js @@ -0,0 +1,44 @@ +let repo = "viper"; +let author = "0neGal"; +let api = "https://api.github.com/repos"; + +async function init() { + let release = await (await fetch(`${api}/${author}/${repo}/releases/latest`)).json(); + let assets = release.assets; + + let get = (asset) => { + for (let i in assets) { + if (assets[i].name.match(asset)) { + return assets[i].browser_download_url; + } + } + } + + let url; + let search = location.search.replace(/^\?/, ""); + switch(search) { + case "win-setup": + url = get(/Viper-Setup-.*\.exe$/); + break; + case "win-installer": + url = get(/Viper-.*\.exe$/); + break; + case "appimage": + url = get(/Viper-.*\.AppImage$/); + break; + case "linux": + url = get(/viper-.*.tar\.gz$/); + break; + case "rpm": + url = get(/viper-.*\.x86_64\.rpm$/); + break; + case "deb": + url = get(/viper_.*_amd64\.deb$/); + break; + default: + url = release.html_url; + break; + } + + location.replace(url); +}; init() |