if(typeof(betterDiscordIPC)!="undefined"){eplog("It seems you have an install of BetterDiscord. Uninstall it before you install EndPwn2.");return;}
if(typeof(_cynergy_ver)!="undefined"){eplog(`It seems you have an install of Cynergy. Uninstall it before you install EndPwn2.\nhint: replace %appdata%\\${_discord_branch.toLowerCase()}\\app-${_discord_version}\\modules\\discord_desktop_core\\core.asar with the one in\n%localappdata%\\${_discord_branch}\\app-${_discord_version}\\resources\\bootstrap\\discord_desktop_core.zip to rid the autorun code.\nDelete the folder, too.`);return;}
if(typeof(injected)!="undefined"){eplog("It seems you have a bootsyhax-based modification installed. Uninstall it before you install EndPwn2.");return;}
eplog("Injecting dom-ready listener into app.asar...");
asarinject('nodeIntegration: false,',
'nodeIntegration: true,');
asarinject("// Prevent navigation when links or files are dropping into the app, turning it into a browser.\n // https://github.com/discordapp/discord/pull/278",
"// endpwn <3\r\n mainWindow.webContents.on('dom-ready', function () {require('../../../../../endpwn/i.js').x(mainWindow)}); //this makes endpwn work");
};
varasarunpwn=function(){
eplog("Undoing asarpwn...");
asarinject('nodeIntegration: true,',
'nodeIntegration: false,');
asarinject("// endpwn <3\r\n mainWindow.webContents.on('dom-ready', function () {require('../../../../../endpwn/i.js').x(mainWindow)}); //this makes endpwn work",
"// Prevent navigation when links or files are dropping into the app, turning it into a browser.\n // https://github.com/discordapp/discord/pull/278");
}
vardata=function(){
returnremote.app.getPath('userData')+"/";
}
varapproot=function(){
returnasar()+"/../";
}
varsettingsjson=function(){
returndata()+'settings.json';
}
varasar=function(){
returnremote.app.getAppPath();
}
vardropfiles=function(){
if(!_fs.existsSync(data()+'/endpwn')){
_fs.mkdirSync(data()+'/endpwn');
}
if(!_fs.existsSync(data()+'/endpwn/styles')){
_fs.mkdirSync(data()+'/endpwn/styles');
}
if(!_fs.existsSync(data()+'/endpwn/plugins')){
_fs.mkdirSync(data()+'/endpwn/plugins');
}
if(!_fs.existsSync(data()+'/endpwn/lib')){
_fs.mkdirSync(data()+'/endpwn/lib');
}
varlicense='BeautifulDiscord\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 leovoel\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the "Software"),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.';
_fs.writeFileSync(data()+'/endpwn/styles/style.css',"/*@import url('https://block57.net/discord/css/all.css');*/\n@import url('https://block57.net/discord/css/animations.css');\n@import url('https://block57.net/discord/css/avatars.css');\n@import url('https://block57.net/discord/css/background.css');\n@import url('https://block57.net/discord/css/channels.css');\n@import url('https://block57.net/discord/css/emoji.css');\n@import url('https://block57.net/discord/css/guilds.css');\n@import url('https://block57.net/discord/css/misc.css');\n@import url('https://block57.net/discord/css/titlebar.css');\n@import url('https://block57.net/discord/css/typinginput.css');\n@import url('https://block57.net/discord/css/variables.css');\n\n/* This file contains the custom CSS edits for EndPwn. If you want to\nchange the way these look, copy in the 'variables.css' file and edit the\nvalues in it. Also, you can select what kinds of edits you want applied\nusing the lines above. Comment out the ones you don't want, or leave them\nall in by uncommenting the 'all.css' file and removing the others. */");