mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-01-31 03:57:27 +05:00
fix version checking
This commit is contained in:
parent
810ddfe3da
commit
6169712625
4 changed files with 16 additions and 20 deletions
|
@ -138,7 +138,7 @@ local function BeatrunHUD()
|
|||
surface.DrawText(version_text)
|
||||
surface.SetFont("BeatrunHUD")
|
||||
|
||||
if not VERSIONLATEST then
|
||||
if VERSIONGLOBAL ~= VERSIONLATEST then
|
||||
local update_text = "Update available!"
|
||||
local notlatest_w, _ = surface.GetTextSize(update_text)
|
||||
surface.SetTextColor(255, 255, 255, 30)
|
||||
|
|
|
@ -3,17 +3,3 @@ include("shared.lua")
|
|||
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do
|
||||
include("cl/" .. v)
|
||||
end
|
||||
|
||||
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
|
||||
if code == 200 then
|
||||
if body == VERSIONGLOBAL then
|
||||
VERSIONLATEST = true
|
||||
else
|
||||
VERSIONLATEST = false
|
||||
end
|
||||
else
|
||||
print("Error while checking version:\n" .. body)
|
||||
end
|
||||
end, function(e)
|
||||
print("Error while checking version:\n" .. e)
|
||||
end)
|
|
@ -1,5 +1,5 @@
|
|||
VERSIONGLOBAL = "1.0.9"
|
||||
VERSIONLATEST = NULL
|
||||
VERSIONGLOBAL = "1.0.10"
|
||||
VERSIONLATEST = ""
|
||||
|
||||
DeriveGamemode("sandbox")
|
||||
|
||||
|
@ -14,3 +14,13 @@ for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME", "nam
|
|||
AddCSLuaFile("sh/" .. v)
|
||||
include("sh/" .. v)
|
||||
end
|
||||
|
||||
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
|
||||
if code == 200 then
|
||||
VERSIONLATEST = body:gsub("[\n\r]", "")
|
||||
else
|
||||
print("Error while checking version (not 200 code):\n" .. body)
|
||||
end
|
||||
end, function(e)
|
||||
print("Error while checking version (error on fetch):\n" .. e)
|
||||
end)
|
|
@ -1 +1 @@
|
|||
1.0.9
|
||||
1.0.10
|
||||
|
|
Loading…
Reference in a new issue