rewrite wrapper

This commit is contained in:
StageGuard
2021-07-06 16:06:20 +08:00
parent 04bed642f9
commit 90156ce0af

View File

@@ -1,16 +1,8 @@
"ui"; "ui";
"use strict"; "use strict";
/* /*
SkyAutoPlayer (Auto.js script) SkyAutoPlayer (Auto.js script)
Copyright © 2020-2021 StageGuard Copyright © 2020-2021 StageGuard
Contact :
(QQ: 1355416608)
(Email: beamiscool@qq.com)
(BaiduTieba@拐角处_等你)
(Weibo@StageGuard)
(CoolApk@StageGuard)
(Twiter@stageguardcn)
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
@@ -27,23 +19,26 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA USA
*/ */
(function(emitter) {
var emitter = events.emitter(threads.currentThread()); threads.start(function () {
threads.start(function() { emitter.emit("evaluate", (function () {
emitter.emit("evaluate", (function(){ //Many sources
var resp = http.get("https://gitee.com/stageguard/SkyAutoPlayerScript/raw/master/source/SkyAutoplayer.js"); let sources = [
if(resp.statusCode >= 200 && resp.statusCode < 300) { "http://cdn.stagex.top:8090/StageGuard/SkyAutoPlayerScript/raw/master/source/SkyAutoplayer.js",
return resp.body.string(); "https://cdn.jsdelivr.net/gh/StageGuard/SkyAutoPlayerScript/source/SkyAutoplayer.js",
} else { "https://dl.skyautoplayerscript.stageguard.top/source/SkyAutoplayer.js",
resp = http.get("https://cdn.jsdelivr.net/gh/StageGuard/SkyAutoPlayerScript@" + http.get("https://gitee.com/stageguard/SkyAutoPlayerScript/raw/master/gitVersion").body.string() + "/source/SkyAutoplayer.js"); "https://raw.githubusercontent.com/StageGuard/SkyAutoPlayerScript/master/source/SkyAutoplayer.js"
if(resp.statusCode >= 200 && resp.statusCode < 300) { ];
return resp.body.string(); for (let i in sources) {
} else { let resp = http.get(sources[i]);
return "console.show();console.log(\"Failed to load script\")"; if (resp.statusCode >= 200 && resp.statusCode < 300) {
return resp.body.string();
}
} }
} return "console.show();console.log(\"Failed to load script\")";
}())); }()));
}); });
emitter.on('evaluate', function(s){ emitter.on('evaluate', function (s) {
eval(s); eval(s);
}); });
}(events.emitter(threads.currentThread())));