mirror of
https://github.com/EndPwnArchive/endpwn3.git
synced 2024-08-15 00:23:30 +00:00
rudimentary preload script support
This commit is contained in:
parent
f430a4159f
commit
a8aca55ed5
2 changed files with 12 additions and 7 deletions
15
monitor.htm
15
monitor.htm
|
@ -40,14 +40,19 @@
|
||||||
win.webContents.executeJavaScript(stage2);
|
win.webContents.executeJavaScript(stage2);
|
||||||
});
|
});
|
||||||
|
|
||||||
function load() {
|
|
||||||
var branch = require('path').basename(electron.app.getPath("userData")).substr(7);
|
|
||||||
win.loadURL('https://' + (branch ? branch + '.' : '') + 'discordapp.com/channels/@me');
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the data path
|
// get the data path
|
||||||
var data = electron.app.getPath('userData');
|
var data = electron.app.getPath('userData');
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
var branch = require('path').basename(data).substr(7);
|
||||||
|
var preload = '';
|
||||||
|
if (fs.existsSync(data + '/preload.js')) {
|
||||||
|
preload = fs.readFileSync(data + '/preload.js').toString();
|
||||||
|
}
|
||||||
|
win.loadURL('https://' + (branch ? branch + '.' : '') + 'discordapp.com/channels/@me');
|
||||||
|
win.webContents.executeJavaScript(preload);
|
||||||
|
}
|
||||||
|
|
||||||
// dont update EPAPI if DONTUPDATE exists
|
// dont update EPAPI if DONTUPDATE exists
|
||||||
if (!fs.existsSync(data + '/DONTUPDATE')) {
|
if (!fs.existsSync(data + '/DONTUPDATE')) {
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
var fs = electron.require('original-fs');
|
var fs = electron.require('original-fs');
|
||||||
|
|
||||||
// get the data path (where epapi.js should be)
|
// get the data path (where epapi.js should be)
|
||||||
var data = electron.app.getPath('userData').replace(/\\\\/g, "/") + '/';
|
var ___data = electron.app.getPath('userData').replace(/\\\\/g, "/") + '/';
|
||||||
|
|
||||||
// shakily reimplemented of require() intended for loading plugins and EPAPI itself
|
// shakily reimplemented of require() intended for loading plugins and EPAPI itself
|
||||||
function __krequire(path) {
|
function __krequire(path) {
|
||||||
return eval('(()=>{var exports={};' + fs.readFileSync(data + path, 'utf8').toString() + ';return exports})()');
|
return eval('(()=>{var exports={};' + fs.readFileSync(___data + path, 'utf8').toString() + ';return exports})()');
|
||||||
}
|
}
|
||||||
|
|
||||||
// load EPAPI
|
// load EPAPI
|
||||||
|
|
Loading…
Reference in a new issue