Fixed updater

Contrast_Picker
Arcidayne 9 years ago
parent 966b397c1c
commit 687c112f9e

@ -15,7 +15,7 @@
save_state="y"
date_written="2015-10-25 12:00:38"
requires="4.00"
version="2.2"
version="2.3"
>
<description trim="y">
<![CDATA[
@ -222,21 +222,17 @@ function OnPluginInstall()
SetCounterDebug = 0
end
function update_plugin ()
local pid = GetPluginID ()
local pfile, pversion = GetPluginInfo(pid, 6), GetPluginInfo(pid, 19)
local raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Epic_Not_Here_Counter/Epic_Not_Here_Counter.xml"
async_ok, async = pcall (require, "async")
if async_ok then
plugin_page = async.doAsyncRemoteRequest(raw, function(retval, page, status, headers, full_status, request_url) if status == 200 then raw_version = page:match('%s%s+version="([0-9%.]+)"') end end, "HTTPS")
function raw_get(retval, page, status, headers, full_status, request_url)
if status == 200 then
raw_version = tonumber(string.match(page, '%s%s+version="([0-9%.]+)"'))
print(type(raw_version), raw_version)
print(type(GetPluginInfo(GetPluginID(), 19)), GetPluginInfo(GetPluginID(), 19))
end
if tonumber(raw_version) == pversion then
if raw_version == GetPluginInfo(GetPluginID(), 19) then
ColourNote("white", "blue", GetPluginInfo(pid, 1) .. " is up-to-date.")
elseif to_number(raw_version) > pversion then
ColourNote("white", "blue", "Updating from version " .. pversion .. " to " .. raw_version .. ". Do not touch anything.")
local file = io.open(pfile, "w")
elseif raw_version > GetPluginInfo(GetPluginID(), 19) then
ColourNote("white", "blue", "Updating from version " .. GetPluginInfo(GetPluginID(), 19) .. " to " .. raw_version .. ". Do not touch anything.")
local file = io.open(GetPluginInfo(GetPluginID(), 6), "w")
file:write(page)
file:close()
end
@ -248,6 +244,15 @@ function update_plugin ()
Execute(GetAlphaOption("script_prefix").."DoAfterSpecial(1, \"ReloadPlugin('"..GetPluginID().."')\", sendto.script)")
end
function update_plugin ()
local raw = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Epic_Not_Here_Counter/Epic_Not_Here_Counter.xml"
async_ok, async = pcall (require, "async")
if async_ok then
plugin_page = async.doAsyncRemoteRequest(raw, raw_get, "HTTPS")
end
end
]]>
</script>

Loading…
Cancel
Save