-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathversion.lua
55 lines (49 loc) · 2.3 KB
/
version.lua
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
47
48
49
50
51
52
53
54
55
Version = {}
Version.checkRelease = function (resourcename, repo)
repo = repo:gsub("https://github.com/", "")
local current = {
version = GetResourceMetadata(resourcename, 'version')
}
PerformHttpRequest('https://api.github.com/repos/'..repo..'/releases/latest', function(err, text, headers)
local response = json.decode(text)
local latest = {
url = response.html_url,
body = response.body,
version = response.tag_name
}
local uptodate = false
local overdate = false
if current.version > latest.version then
overdate = true
elseif current.version < latest.version then
uptodate = false
else
uptodate = true
end
if uptodate then
print("^1---------------------------------------------------------------------------^0\n" ..
" mdt - Archive System for VORPCore\n" ..
"^1---------------------------------------------------------------------------^0\n")
print('^2✅ Up to Date! (Current Version '..current.version..')^0')
elseif overdate then
print("^1---------------------------------------------------------------------------^0\n" ..
" mdt - Archive System for VORPCore\n" ..
"^1---------------------------------------------------------------------------^0\n")
print('^3⚠️Unsupported! (Version '..current.version..')^0')
print('^4Current Version ^2('..latest.version..') ^3<'..latest.url..'>^0')
else
print("^1---------------------------------------------------------------------------^0\n" ..
" mdt - Archive System for VORPCore\n" ..
"^1---------------------------------------------------------------------------^0\n")
print('^1❌Outdated! (Version '..current.version..')^0')
print('^4New Version ^2('..latest.version..') ^3<'..latest.url..'>^0')
print('^4Changelog - ^0\r\n'..latest.body)
end
end, 'GET', json.encode(payload), {
['Content-Type'] = 'application/json'
})
end
Version.checkRelease(GetCurrentResourceName(), 'https://github.com/unknownghostz6/westerntheme-mdt')
exports('Version',function()
return Version
end)