mirror of
https://github.com/EndPwnArchive/endpwn3.git
synced 2024-08-15 00:23:30 +00:00
check for DONTUPDATE
This commit is contained in:
parent
e5855c27d2
commit
204e49e124
1 changed files with 27 additions and 26 deletions
51
shared.js
51
shared.js
|
@ -111,45 +111,46 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// check for epapi updates
|
// check for epapi updates
|
||||||
(function () {
|
if (!fs.existsSync($api.data + '/DONTUPDATE'))
|
||||||
|
(function () {
|
||||||
|
|
||||||
// fetch the latest build of epapi
|
// fetch the latest build of epapi
|
||||||
fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
|
fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
|
||||||
|
|
||||||
// check the version
|
// check the version
|
||||||
if (kparse(x).version > $api.version) {
|
if (kparse(x).version > $api.version) {
|
||||||
|
|
||||||
// if the version on the server is newer, pester the user
|
// if the version on the server is newer, pester the user
|
||||||
$api.ui.showDialog({
|
$api.ui.showDialog({
|
||||||
|
|
||||||
title: 'EndPwn3: EPAPI Update Available',
|
title: 'EndPwn3: EPAPI Update Available',
|
||||||
body: 'An update to EPAPI has been released. It is recommended that you restart your client in order to gain access to new features and maintain compatibility.',
|
body: 'An update to EPAPI has been released. It is recommended that you restart your client in order to gain access to new features and maintain compatibility.',
|
||||||
confirmText: 'Restart Now', cancelText: 'Later',
|
confirmText: 'Restart Now', cancelText: 'Later',
|
||||||
|
|
||||||
// user pressed "Restart Now"
|
// user pressed "Restart Now"
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
|
|
||||||
// refresh the page if we're running in a browser, reboot the app if we're running outside of lite mode
|
// refresh the page if we're running in a browser, reboot the app if we're running outside of lite mode
|
||||||
if ($api.lite) location.reload();
|
if ($api.lite) location.reload();
|
||||||
else reload();
|
else reload();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// they pressed "Later", for some reason
|
// they pressed "Later", for some reason
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
|
|
||||||
// bother them again in 6 hrs (* 60 min * 60 sec * 1000 ms)
|
// bother them again in 6 hrs (* 60 min * 60 sec * 1000 ms)
|
||||||
setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
|
setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue