blob: adc565e61ffcd15c739864f5594dd4341d65d208 (
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
|
cl_latestRelease = cvar.new("cl_latestRelease")
dlurl = ""
Releases = {
url='https://api.github.com/repos/GrangerHub/tremulous/releases'
refresh = function()
r = http.get(url)
if r.code != 200 then
cl_latestRelease = "ERROR:\n Server did not return OK status code"
return false
end
releases = rapidjson.decode(r.body)
most_recent = releases[1]
cl_latestRelease = most_recent.tag;
for i,asset in ipairs(most_recent.assets) do
dlurl = cvar.new("download_url", "", 256)
dlurl = asset.browser_download_url
end
return true
end
download = function()
r = http.get(download_url)
if r.code != 200 then
cvar.new("com_error") = "Download failed"
return false
end
io.open(path, "w+")
io.write(r.body)
io.close()
args = "path-to-tremulous-binary"
os.execute(path .. args)
end
}
|