forked from xsk666/Autojs-hot-update
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
31 lines (29 loc) · 1.33 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const baseUrl = "http://abc.svip925.top/";
//加入QQ群聊952614347,免费获取热更新服务
const versionName = "热更新 b0.0.1";
log("正在进行版本检查…");
var res = http.get(baseUrl + "codelist.php?user=3104182180").body.json();
var a = [];
var name = res[0].fileName;
var a = name.slice(name.indexOf("b") + 1, name.indexOf(".j"));
var ver = versionName.slice(versionName.indexOf("b"), versionName.length).replace(/\D/g, '');
if (ver < a.replace(/\D/g, '')) {
log("有新版本可以更新\n当前版本:" + versionName + "\n最新版本:热更新 " + a);
confirm("有新版本可以更新", "当前版本:" + versionName + "\n\n最新版本:热更新 " + a, (value) => {
if (value) {
threads.start(function() {
toast("正在更新…");
codePath = engines.myEngine().cwd() + "/main.js";
files.write(codePath, http.get(baseUrl + "download.php?user=3104182180&name=" + name).body.string())
toast("更新完成\n\n正在打开…");
engines.execScriptFile(codePath);
toast("更新完成!")
exit();
})
} else {
toastLog("已取消更新。\n下次打开热更新将再次提示")
}
})
} else {
log("版本检查完成:暂无新版本");
};