From 666f8af5353fb0e9ea3915b0d7a92b8c28e10b75 Mon Sep 17 00:00:00 2001
From: AardCrowley <12467582+AardCrowley@users.noreply.github.com>
Date: Sun, 17 Feb 2019 18:16:50 -0500
Subject: [PATCH] New code added
Added update code
---
AardClock2.0_Beta | 439 ------------------------------------------
AardClock2.0_Beta.xml | 43 +++++
2 files changed, 43 insertions(+), 439 deletions(-)
delete mode 100644 AardClock2.0_Beta
diff --git a/AardClock2.0_Beta b/AardClock2.0_Beta
deleted file mode 100644
index e77f14d..0000000
--- a/AardClock2.0_Beta
+++ /dev/null
@@ -1,439 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AardClock2.0_Beta.xml b/AardClock2.0_Beta.xml
index e77f14d..b9fe07c 100644
--- a/AardClock2.0_Beta.xml
+++ b/AardClock2.0_Beta.xml
@@ -25,6 +25,13 @@
+
+
+
+
+
+
+
@@ -432,6 +439,42 @@ require 'mw_theme_base'
canRedraw = true
print("Mouseup!")
end
+
+function update_plugin()
+ raw = "https://raw.githubusercontent.com/AardCrowley/Aardwolf-Scripts/master/Auction_Utilities/AardClock2.0_Beta.xml"
+
+ async_ok, async = pcall (require, "async")
+
+ if async_ok then
+ plugin_page = async.doAsyncRemoteRequest(raw, raw_get, "HTTPS")
+ else
+ ColourNote("white", "blue", "Error on plugin update!")
+ end
+ end
+
+ 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%.]+)"'))
+ end
+
+ if raw_version == PLUGIN_VERSION then
+ ColourNote("white", "blue", PLUGIN_NAME .. " is up-to-date.")
+ elseif raw_version > PLUGIN_VERSION then
+ ColourNote("white", "blue", "Updating from version " .. PLUGIN_VERSION .. " to " .. raw_version .. ". Do not touch anything!")
+ local file = io.open(GetPluginInfo(GetPluginID(), 6), "w")
+ file:write(page)
+ file:close()
+ end
+
+ raw_version = nil
+
+ if "" == GetAlphaOption("script_prefix") then
+ SetAlphaOption("script_prefix", "\\\\\\")
+ end
+
+ Execute(GetAlphaOption("script_prefix") .. "DoAfterSpecial(1, \"ReloadPlugin('" .. GetPluginID() .. "')\", sendto.script)")
+ ColourNote("white", "blue", "Update complete!")
+ end -- end Update code
]]>