blob: f88479f833ab844e41aa3a4af331e8a692ecd8b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
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-portable":
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;
case "release-page":
url = release.html_url;
break;
default:
return;
}
location.replace(url);
}; init()
|