You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
9 years ago
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
<!DOCTYPE muclient>
|
||
|
<!-- Saved on Sunday, December 20, 2015, 1:20 PM -->
|
||
|
<!-- MuClient version 4.99 -->
|
||
|
|
||
|
<!-- Plugin "Updater" generated by Plugin Wizard -->
|
||
|
|
||
|
<muclient>
|
||
|
<plugin
|
||
|
name="Updater"
|
||
|
author="Arcidayne"
|
||
|
id="dff6da0f0c8bd7605fe6a5f4"
|
||
|
language="Lua"
|
||
|
purpose="Created to allow reloading of plugins after updating"
|
||
|
save_state="y"
|
||
|
date_written="2015-12-20 13:19:13"
|
||
|
requires="4.00"
|
||
|
version="1.0"
|
||
|
>
|
||
|
|
||
|
</plugin>
|
||
|
|
||
|
|
||
|
<!-- Script -->
|
||
|
|
||
|
|
||
|
<script>
|
||
|
<![CDATA[
|
||
|
function UpdatePlugin(pid, pfile, pversion, raw)
|
||
|
async_ok, async = pcall (require, "async")
|
||
|
|
||
|
--[[local raw_page = "https://raw.githubusercontent.com/Arcidayne/Aardwolf-Scripts/master/Epic_Not_Here_Counter/Epic_Not_Here_Counter.xml"
|
||
|
local plugin_file = GetPluginInfo(GetPluginID(), 20) .. GetPluginInfo(GetPluginID(), 1)
|
||
|
local plugin_version = GetPluginInfo(GetPluginID(), 19)]]
|
||
|
|
||
|
if async_ok then
|
||
|
raw_return = async.request(raw, "HTTPS")
|
||
|
end
|
||
|
|
||
|
retval, page, status, headers, full_status = raw_return:join()
|
||
|
raw_return = nil
|
||
|
|
||
|
if status == 200 then
|
||
|
raw_version = string.match(page, '%s%s+version="([0-9%.]+)"')
|
||
|
print("Raw version: " .. raw_version)
|
||
|
print("Plugin version: " .. pversion)
|
||
|
end
|
||
|
|
||
|
if tonumber(raw_version) == tonumber(pversion) then
|
||
|
ColourNote("white", "blue", "You currently have the latest version!")
|
||
|
elseif tonumber(raw_version) > tonumber(pversion) then
|
||
|
ColourNote("white", "blue", "Updating from " .. pversion .. " to " .. raw_version .. "!")
|
||
|
local file = io.open(pfile, "w")
|
||
|
file:write(page)
|
||
|
file:close()
|
||
|
ReloadPlugin(pfile)
|
||
|
end
|
||
|
|
||
|
raw_version = nil
|
||
|
end
|
||
|
]]>
|
||
|
</script>
|
||
|
|
||
|
|
||
|
</muclient>
|