Fixed updater

Contrast_Picker
Arcidayne 9 years ago
parent 966b397c1c
commit 687c112f9e

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

Loading…
Cancel
Save