add endpwn object during preload
This commit is contained in:
parent
28716d0347
commit
0370baa4c5
57
plugin.js
57
plugin.js
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __epprint(str) {
|
function __epprint(str) {
|
||||||
console.log(`%c[EndPwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
|
console.log(`%c[EndPwn3]%c ` + str, 'font-weight:bold;color:#0cc', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
exports = {
|
exports = {
|
||||||
|
@ -32,7 +32,7 @@ exports = {
|
||||||
|
|
||||||
function fetchGoodies() {
|
function fetchGoodies() {
|
||||||
// fetch goodies.json
|
// fetch goodies.json
|
||||||
__epprint('fetching endpwn cutomizer data from server...');
|
__epprint('fetching EndPwn Cutomizer data from server...');
|
||||||
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
|
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
|
||||||
.then(x => x.json())
|
.then(x => x.json())
|
||||||
.then(r => window.__goodies = r);
|
.then(r => window.__goodies = r);
|
||||||
|
@ -42,6 +42,33 @@ exports = {
|
||||||
fetchGoodies();
|
fetchGoodies();
|
||||||
setInterval(fetchGoodies, 1800000);
|
setInterval(fetchGoodies, 1800000);
|
||||||
|
|
||||||
|
window.endpwn = {
|
||||||
|
|
||||||
|
__eval: e => eval(e),
|
||||||
|
|
||||||
|
uninstall: function () {
|
||||||
|
$api.ui.showDialog({
|
||||||
|
title: 'EndPwn: confirm uninstallation',
|
||||||
|
body: 'Are you sure you want to remove EndPwn from your client? You can reinstall it at any time.',
|
||||||
|
confirmText: 'Yes', cancelText: 'No',
|
||||||
|
|
||||||
|
onConfirm: () => {
|
||||||
|
|
||||||
|
var data = $api.data;
|
||||||
|
|
||||||
|
$api.settings.set('WEBAPP_ENDPOINT');
|
||||||
|
$api.settings.set('WEBAPP_PATH');
|
||||||
|
|
||||||
|
reload();
|
||||||
|
|
||||||
|
},
|
||||||
|
onCancel: () => console.log('<3')
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// early init payload
|
// early init payload
|
||||||
document.addEventListener('ep-prepared', () => {
|
document.addEventListener('ep-prepared', () => {
|
||||||
|
|
||||||
|
@ -101,32 +128,6 @@ exports = {
|
||||||
start: function () {
|
start: function () {
|
||||||
|
|
||||||
window.reload = () => { app.relaunch(); app.exit(); };
|
window.reload = () => { app.relaunch(); app.exit(); };
|
||||||
window.endpwn = {
|
|
||||||
|
|
||||||
__eval: e => eval(e),
|
|
||||||
|
|
||||||
uninstall: function () {
|
|
||||||
$api.ui.showDialog({
|
|
||||||
title: 'EndPwn: confirm uninstallation',
|
|
||||||
body: 'Are you sure you want to remove EndPwn from your client? You can reinstall it at any time.',
|
|
||||||
confirmText: 'Yes', cancelText: 'No',
|
|
||||||
|
|
||||||
onConfirm: () => {
|
|
||||||
|
|
||||||
var data = $api.data;
|
|
||||||
|
|
||||||
$api.settings.set('WEBAPP_ENDPOINT');
|
|
||||||
$api.settings.set('WEBAPP_PATH');
|
|
||||||
|
|
||||||
reload();
|
|
||||||
|
|
||||||
},
|
|
||||||
onCancel: () => console.log('<3')
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// disable analytics
|
// disable analytics
|
||||||
__epprint('disabling analytics...');
|
__epprint('disabling analytics...');
|
||||||
|
|
Loading…
Reference in New Issue