remove epapi6 bs

This commit is contained in:
Cynthia Foxwell 2018-06-15 17:50:37 -06:00
parent 7ebafb218c
commit fab5d4682c
3 changed files with 482 additions and 506 deletions

View File

@ -25,104 +25,98 @@ var internal = {
}
if (window.$api === undefined && typeof $api != 'undefined') {
console.warn('$api is defined, but window.$api is not! assuming we are running under epapi6 and exporting an empty object...');
exports = {};
}
else
exports = {
module.exports = {
manifest: {
replacements: [
manifest: {
replacements: [
// fix for custom discrims breaking search
{
signature: '#([0-9]{4})',
payload: '#(.{1,4})'
},
// fix for custom discrims breaking search
{
signature: '#([0-9]{4})',
payload: '#(.{1,4})'
},
// endpwn dev badges
{
//signature: 'return t.hasFlag(H.UserFlags.STAFF)',
signature: /return (\w)\.hasFlag\((\w)\.UserFlags\.STAFF\)&&(\w)\.push/g,
//payload: 'return t.hasFlag(4096)&&r.push({tooltip:"EndPwn Developer",onClick:function(){return window.open("https://endpwn.github.io/","_blank")},class:"endpwn"}),t.hasFlag(H.UserFlags.STAFF)'
payload: 'return $1.hasFlag(4096)&&$3.push({tooltip:"EndPwn Developer",onClick:function(){return window.open("https://endpwn.github.io/","_blank")},class:"endpwn"}),t.hasFlag($2.UserFlags.STAFF)&&r.push'
}
],
},
// fallback data
data: {
guilds: [],
devs: [],
bots: [],
users: {}
},
get me() {
return {
bot: exports.data.bots.indexOf($me()) != -1,
discrim: exports.data.users[$me()]
// endpwn dev badges
{
//signature: 'return t.hasFlag(H.UserFlags.STAFF)',
signature: /return (\w)\.hasFlag\((\w)\.UserFlags\.STAFF\)&&(\w)\.push/g,
//payload: 'return t.hasFlag(4096)&&r.push({tooltip:"EndPwn Developer",onClick:function(){return window.open("https://endpwn.github.io/","_blank")},class:"endpwn"}),t.hasFlag(H.UserFlags.STAFF)'
payload: 'return $1.hasFlag(4096)&&$3.push({tooltip:"EndPwn Developer",onClick:function(){return window.open("https://endpwn.github.io/","_blank")},class:"endpwn"}),t.hasFlag($2.UserFlags.STAFF)&&r.push'
}
},
update: function () {
// fetch goodies.json
internal.print('fetching data from server...');
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => endpwn.customizer.data = r);
},
],
},
init: function () {
// prevent doublecalling
delete endpwn.customizer.init;
// apply custom discrims/bot tags/badges/server verif from EndPwn Customizer (endpwn.cathoderay.tube)
internal.print('initializing...');
// refetch customizer stuff every half hour
setInterval(endpwn.customizer.update, 1800000);
endpwn.customizer.update();
// add the endpwn dev badge to the class obfuscation table
wc.findFunc('profileBadges:"profileBadges')[0].exports['profileBadgeEndpwn'] = 'profileBadgeEndPwn';
// hook getUser() so we can apply custom discrims/bot tags/badges
$api.util.wrapAfter(
"wc.findCache('getUser')[0].exports.getUser",
x => {
if (x === undefined || x === null) return;
if (endpwn.customizer.data.bots.includes(x.id)) x.bot = true;
if (endpwn.customizer.data.users[x.id] !== undefined) x.discriminator = endpwn.customizer.data.users[x.id];
if (endpwn.customizer.data.devs.includes(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
return x;
}
);
// make sure devs' badges actually render
$api.events.hook('USER_PROFILE_MODAL_FETCH_SUCCESS', x => { if (endpwn.customizer.data.devs.includes(x.user.id)) x.user.flags += x.user.flags & 4096 ? 0 : 4096; })
// hook getGuild() so we can verify servers
$api.util.wrapAfter(
"wc.findCache('getGuild')[0].exports.getGuild",
x => {
if (x === undefined || x === null) return;
if (endpwn.customizer.data.guilds.includes(x.id)) x.features.add('VERIFIED');
return x;
}
);
// fallback data
data: {
guilds: [],
devs: [],
bots: [],
users: {}
},
get me() {
return {
bot: exports.data.bots.indexOf($me()) != -1,
discrim: exports.data.users[$me()]
}
},
update: function () {
// fetch goodies.json
internal.print('fetching data from server...');
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => endpwn.customizer.data = r);
},
init: function () {
// prevent doublecalling
delete endpwn.customizer.init;
// apply custom discrims/bot tags/badges/server verif from EndPwn Customizer (endpwn.cathoderay.tube)
internal.print('initializing...');
// refetch customizer stuff every half hour
setInterval(endpwn.customizer.update, 1800000);
endpwn.customizer.update();
// add the endpwn dev badge to the class obfuscation table
wc.findFunc('profileBadges:"profileBadges')[0].exports['profileBadgeEndpwn'] = 'profileBadgeEndPwn';
// hook getUser() so we can apply custom discrims/bot tags/badges
$api.util.wrapAfter(
"wc.findCache('getUser')[0].exports.getUser",
x => {
if (x === undefined || x === null) return;
if (endpwn.customizer.data.bots.includes(x.id)) x.bot = true;
if (endpwn.customizer.data.users[x.id] !== undefined) x.discriminator = endpwn.customizer.data.users[x.id];
if (endpwn.customizer.data.devs.includes(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
return x;
}
);
// make sure devs' badges actually render
$api.events.hook('USER_PROFILE_MODAL_FETCH_SUCCESS', x => { if (endpwn.customizer.data.devs.includes(x.user.id)) x.user.flags += x.user.flags & 4096 ? 0 : 4096; })
// hook getGuild() so we can verify servers
$api.util.wrapAfter(
"wc.findCache('getGuild')[0].exports.getGuild",
x => {
if (x === undefined || x === null) return;
if (endpwn.customizer.data.guilds.includes(x.id)) x.features.add('VERIFIED');
return x;
}
);
}
}

View File

@ -16,293 +16,286 @@
https://github.com/endpwn/
*/
module.exports = {
manifest: {
replacements: [
{
signature: /{section:(\w)\.SectionTypes\.DIVIDER},{section:"logout",/g,
payload: '{section:$1.SectionTypes.DIVIDER},{section:"ENDPWN",label:"ΣndPwn Settings",element:window.BlankSettingsElement,color:"#0cc"},{section:$1.SectionTypes.DIVIDER},{section:"logout",'
}
],
},
if (window.$api === undefined && typeof $api != 'undefined') {
console.warn('$api is defined, but window.$api is not! assuming we are running under epapi6 and exporting an empty object...');
exports = {};
}
else
exports = {
init: function () {
manifest: {
replacements: [
{
signature: /{section:(\w)\.SectionTypes\.DIVIDER},{section:"logout",/g,
payload: '{section:$1.SectionTypes.DIVIDER},{section:"ENDPWN",label:"ΣndPwn Settings",element:window.BlankSettingsElement,color:"#0cc"},{section:$1.SectionTypes.DIVIDER},{section:"logout",'
}
],
},
delete endpwn.settings.init;
init: function () {
var currentSection = '';
delete endpwn.settings.init;
$api.events.listen('ENDPWN_PSEUDO_IPC', msg => {
$api.localStorage.set('customizer_signature', JSON.parse(msg.data).signature);
console.log(currentSection);
renderSettings(currentSection);
});
var currentSection = '';
window.BlankSettingsElement = $api.util.findConstructor('FormSection', 'FormSection').FormSection;
var buttons = $api.util.findFuncExports('button-', 'colorBlack');
var checkboxes = $api.util.findFuncExports('checkboxEnabled');
var misc = $api.util.findFuncExports('statusRed-', 'inputDefault');
var misc2 = $api.util.findFuncExports('multiInputField');
var headers = $api.util.findFuncExports('h5-', 'h5');
var panels = wc.findFunc('flexChild-')[0].exports;
var panels2 = $api.util.findFuncExports('errorMessage-', 'inputWrapper');
function createVerticalPanel() {
return createElement("div")
.withClass(panels2.vertical, 'epButtonPanel')
}
function createHorizontalPanel() {
return createElement("div")
.withClass(panels.horizontal, 'epButtonPanel')
}
function createButton(name) {
return createElement('button')
.withContents(name)
.withClass(
buttons.button,
buttons.lookFilled,
buttons.colorBrand,
buttons.sizeSmall,
buttons.grow,
'epMargin'
);
}
function createWarnButton(name) {
return createElement('button')
.withContents(name)
.withClass(
buttons.button,
buttons.lookOutlined,
buttons.colorYellow,
buttons.sizeSmall,
buttons.grow,
'epMargin'
);
}
function createDangerButton(name) {
return createElement('button')
.withContents(name)
.withClass(
buttons.button,
buttons.lookOutlined,
buttons.colorRed,
buttons.sizeSmall,
buttons.grow,
'epMargin'
);
}
function createH2(text) {
//h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi defaultColor-1_ajX0 defaultMarginh2-2LTaUL marginBottom20-32qID7
return createElement("h2")
.withClass(
headers.h2,
headers.title,
headers.size16,
headers.height20,
headers.weightSemiBold,
headers.defaultColor,
'epMargin'
)
.withText(text);
}
function createH5(text) {
return createElement("h5")
.withClass(
headers.h5,
headers.title,
headers.size12,
headers.height16,
headers.weightSemiBold
)
.withText(text);
}
function createInput(v) {
return createElement("input")
.withClass(
misc.inputDefault,
misc.input,
misc.size16,
'epMargin'
)
.modify(x => x.value = v)
}
//<input class="checkboxEnabled-CtinEn checkbox-2tyjJg" type="checkbox">
//switchEnabled-V2WDBB switch-3wwwcV valueUnchecked-2lU_20 value-2hFrkk sizeDefault-2YlOZr size-3rFEHg themeDefault-24hCdX
//switchEnabled-V2WDBB switch-3wwwcV valueChecked-m-4IJZ value-2hFrkk sizeDefault-2YlOZr size-3rFEHg themeDefault-24hCdX
function updateSwitch(s, w) {
if (s.checked) {
w.classList.remove(checkboxes.valueUnchecked.split(' ')[0]);
w.classList.add(checkboxes.valueChecked.split(' ')[0])
}
else {
w.classList.remove(checkboxes.valueChecked.split(' ')[0]);
w.classList.add(checkboxes.valueUnchecked.split(' ')[0])
}
}
function createSwitch(c, i) {
if (c === undefined) c = () => { };
if (i === undefined) i = false;
var s, w = createElement('div')
.withClass(
checkboxes.switch,
checkboxes.switchEnabled,
checkboxes.size,
checkboxes.sizeDefault,
checkboxes.themeDefault
)
.withChildren(
s = createElement("input")
.withClass(
checkboxes.checkbox,
checkboxes.checkboxEnabled
)
.modify(x => x.type = 'checkbox')
.modify(x => x.checked = i)
.modify(x => x.onchange = () => {
updateSwitch(s, w);
c(s.checked);
})
)
updateSwitch(s, w);
return w;
}
function authorizeCustomizer() {
var endpoint = $api.internal.constants.API_HOST;
var url = `https://${endpoint}/oauth2/authorize?client_id=436715820970803203&redirect_uri=https%3A%2F%2Fendpwn.cathoderay.tube%2Fauth%2Fdiscord%2Fintegratedcallback&response_type=code&scope=identify`;
var win = new window.electron.BrowserWindow({
width: 420,
height: 500,
transparent: false,
frame: false,
resizable: true,
nodeIntegration: true
});
win.loadURL(url);
}
function submitCustomizer(d, b) {
fetch('https://endpwn.cathoderay.tube/set', {
headers: {
'Content-type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
id: $me(),
signature: $api.localStorage.get('customizer_signature'),
discriminator: d,
bot: b
})
}).then(r => {
r.text().then(k => {
$api.ui.showDialog({
title: 'Server Response',
body: k
});
});
endpwn.customizer.update();
$api.events.listen('ENDPWN_PSEUDO_IPC', msg => {
$api.localStorage.set('customizer_signature', JSON.parse(msg.data).signature);
console.log(currentSection);
renderSettings(currentSection);
});
window.BlankSettingsElement = $api.util.findConstructor('FormSection', 'FormSection').FormSection;
}
var buttons = $api.util.findFuncExports('button-', 'colorBlack');
var checkboxes = $api.util.findFuncExports('checkboxEnabled');
var misc = $api.util.findFuncExports('statusRed-', 'inputDefault');
var misc2 = $api.util.findFuncExports('multiInputField');
var headers = $api.util.findFuncExports('h5-', 'h5');
function renderSettings(e) {
var panels = wc.findFunc('flexChild-')[0].exports;
var panels2 = $api.util.findFuncExports('errorMessage-', 'inputWrapper');
currentSection = e;
if ($("#ep_settings")) $("#ep_settings").remove();
function createVerticalPanel() {
return createElement("div")
.withClass(panels2.vertical, 'epButtonPanel')
}
if (e.section == "ENDPWN") {
function createHorizontalPanel() {
return createElement("div")
.withClass(panels.horizontal, 'epButtonPanel')
}
var pane = $(".content-column.default");
if (!pane) return;
function createButton(name) {
return createElement('button')
.withContents(name)
.withClass(
buttons.button,
buttons.lookFilled,
buttons.colorBrand,
buttons.sizeSmall,
buttons.grow,
'epMargin'
);
}
var needAuth = !$api.localStorage.get('customizer_signature');
function createWarnButton(name) {
return createElement('button')
.withContents(name)
.withClass(
buttons.button,
buttons.lookOutlined,
buttons.colorYellow,
buttons.sizeSmall,
buttons.grow,
'epMargin'
);
}
function createDangerButton(name) {
return createElement('button')
.withContents(name)
.withClass(
buttons.button,
buttons.lookOutlined,
buttons.colorRed,
buttons.sizeSmall,
buttons.grow,
'epMargin'
);
}
function createH2(text) {
//h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi defaultColor-1_ajX0 defaultMarginh2-2LTaUL marginBottom20-32qID7
return createElement("h2")
.withClass(
headers.h2,
headers.title,
headers.size16,
headers.height20,
headers.weightSemiBold,
headers.defaultColor,
'epMargin'
var content = createElement('div')
.withId('ep_settings')
.withClass('flex-vertical')
.withChildren(
createElement("div")
.withClass('epSettingsHeader')
.withText('ΣndPwn Settings')
)
.withText(text);
}
.appendTo(pane);
function createH5(text) {
return createElement("h5")
.withClass(
headers.h5,
headers.title,
headers.size12,
headers.height16,
headers.weightSemiBold
)
.withText(text);
}
if (!$api.localStorage.get('customizer_signature')) {
function createInput(v) {
return createElement("input")
.withClass(
misc.inputDefault,
misc.input,
misc.size16,
'epMargin'
)
.modify(x => x.value = v)
}
createHorizontalPanel()
.withChildren(
createButton("Authorize EndPwn Customizer")
.modify(x => x.onclick = authorizeCustomizer)
)
.appendTo(content);
//<input class="checkboxEnabled-CtinEn checkbox-2tyjJg" type="checkbox">
//switchEnabled-V2WDBB switch-3wwwcV valueUnchecked-2lU_20 value-2hFrkk sizeDefault-2YlOZr size-3rFEHg themeDefault-24hCdX
//switchEnabled-V2WDBB switch-3wwwcV valueChecked-m-4IJZ value-2hFrkk sizeDefault-2YlOZr size-3rFEHg themeDefault-24hCdX
function updateSwitch(s, w) {
if (s.checked) {
w.classList.remove(checkboxes.valueUnchecked.split(' ')[0]);
w.classList.add(checkboxes.valueChecked.split(' ')[0])
}
else {
w.classList.remove(checkboxes.valueChecked.split(' ')[0]);
w.classList.add(checkboxes.valueUnchecked.split(' ')[0])
}
}
function createSwitch(c, i) {
if (c === undefined) c = () => { };
if (i === undefined) i = false;
var s, w = createElement('div')
.withClass(
checkboxes.switch,
checkboxes.switchEnabled,
checkboxes.size,
checkboxes.sizeDefault,
checkboxes.themeDefault
)
.withChildren(
s = createElement("input")
.withClass(
checkboxes.checkbox,
checkboxes.checkboxEnabled
)
.modify(x => x.type = 'checkbox')
.modify(x => x.checked = i)
.modify(x => x.onchange = () => {
updateSwitch(s, w);
c(s.checked);
})
)
updateSwitch(s, w);
return w;
}
function authorizeCustomizer() {
var endpoint = $api.internal.constants.API_HOST;
var url = `https://${endpoint}/oauth2/authorize?client_id=436715820970803203&redirect_uri=https%3A%2F%2Fendpwn.cathoderay.tube%2Fauth%2Fdiscord%2Fintegratedcallback&response_type=code&scope=identify`;
var discrim, bot;
var win = new window.electron.BrowserWindow({
width: 420,
height: 500,
transparent: false,
frame: false,
resizable: true,
nodeIntegration: true
});
win.loadURL(url);
}
function submitCustomizer(d, b) {
fetch('https://endpwn.cathoderay.tube/set', {
headers: {
'Content-type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
id: $me(),
signature: $api.localStorage.get('customizer_signature'),
discriminator: d,
bot: b
})
}).then(r => {
r.text().then(k => {
$api.ui.showDialog({
title: 'Server Response',
body: k
});
});
endpwn.customizer.update();
});
}
function renderSettings(e) {
currentSection = e;
if ($("#ep_settings")) $("#ep_settings").remove();
if (e.section == "ENDPWN") {
var pane = $(".content-column.default");
if (!pane) return;
var needAuth = !$api.localStorage.get('customizer_signature');
var content = createElement('div')
.withId('ep_settings')
.withClass('flex-vertical')
createVerticalPanel()
.withChildren(
createElement("div")
.withClass('epSettingsHeader')
.withText('ΣndPwn Settings')
)
.appendTo(pane);
createH5('Discriminator'),
createHorizontalPanel()
.withChildren(
discrim = createInput(endpwn.customizer.me.discrim ? endpwn.customizer.me.discrim : '')
.withClass('epDiscrimField')
.modify(x => x.maxLength = 4),
createVerticalPanel()
.withChildren(
createH5('Bot?'),
bot = createSwitch(() => { }, endpwn.customizer.me.bot)
),
createButton("Submit")
.modify(x => x.onclick = () => submitCustomizer(discrim.value, bot.children[0].checked))
)
if (!$api.localStorage.get('customizer_signature')) {
createHorizontalPanel()
.withChildren(
createButton("Authorize EndPwn Customizer")
.modify(x => x.onclick = authorizeCustomizer)
)
.appendTo(content);
}
else {
var discrim, bot;
createVerticalPanel()
.withChildren(
createH5('Discriminator'),
createHorizontalPanel()
.withChildren(
discrim = createInput(endpwn.customizer.me.discrim ? endpwn.customizer.me.discrim : '')
.withClass('epDiscrimField')
.modify(x => x.maxLength = 4),
createVerticalPanel()
.withChildren(
createH5('Bot?'),
bot = createSwitch(() => { }, endpwn.customizer.me.bot)
),
createButton("Submit")
.modify(x => x.onclick = () => submitCustomizer(discrim.value, bot.children[0].checked))
)
)
.appendTo(content);
}
createElement("div")
.withClass(panels.horizontal, 'epButtonPanel')
.withChildren(
createButton("Open Data Folder")
.modify(x => x.onclick = () => { electron.shell.openExternal($api.data) }),
createWarnButton("Restart in safe mode")
.modify(x => x.onclick = endpwn.safemode),
createDangerButton("Uninstall EndPwn")
.modify(x => x.onclick = endpwn.uninstall)
)
.appendTo(content);
}
createElement("div")
.withClass(panels.horizontal, 'epButtonPanel')
.withChildren(
createButton("Open Data Folder")
.modify(x => x.onclick = () => { electron.shell.openExternal($api.data) }),
createWarnButton("Restart in safe mode")
.modify(x => x.onclick = endpwn.safemode),
createDangerButton("Uninstall EndPwn")
.modify(x => x.onclick = endpwn.uninstall)
)
.appendTo(content);
}
$api.events.hook("USER_SETTINGS_MODAL_SET_SECTION", renderSettings);
$api.events.hook("USER_SETTINGS_MODAL_INIT", e => setTimeout(_ => renderSettings(e), 200));
}
$api.events.hook("USER_SETTINGS_MODAL_SET_SECTION", renderSettings);
$api.events.hook("USER_SETTINGS_MODAL_INIT", e => setTimeout(_ => renderSettings(e), 200));
}
}

View File

@ -28,181 +28,170 @@ var internal = {
}
if (window.$api === undefined && typeof $api != 'undefined') {
console.warn('$api is defined, but window.$api is not! assuming we are running under epapi6 and exporting an empty object...');
exports = {};
}
else
exports = {
module.exports = {
manifest: {
replacements: [
manifest: {
// changelog injection
/*{
signature: /key:"changeLog",get:function\(\){return (\w)}/g,
payload: 'key:"changeLog",get:function(){if(!$1.injected){$1.injected=1;$1.date=$1.date<=window.endpwn.changelog.date?window.endpwn.changelog.date:$1.date;$1.body=window.endpwn.changelog.body+"\\n\\n"+$1.body}return $1}'
},*/
replacements: [
// crash screen hijack
{
signature: /var (\w)=(\w)\("div",{},void 0,\w\("p",{},void 0,(\w)\.default\.Messages\.ERRORS_UNEXPECTED_CRASH\),\w\("p",{},void 0,\w\.default\.Messages\.ERRORS_ACTION_TO_TAKE\)\),(\w)=\w\((\w)\.default,{size:(\w)\.ButtonSizes\.LARGE,onClick:this\._handleSubmitReport},void 0,a\.default\.Messages\.ERRORS_RELOAD\);return o\(u\.default,{theme:this\.props.theme,title:a\.default\.Messages\.UNSUPPORTED_BROWSER_TITLE,/g,
payload: `var $1=$2("div",{},void 0,$2("p",{},void 0,"Something has gone very, very wrong, and Discord has crashed."),$2("p",{},void 0,"If this is the first time you've seen this error screen, reload and hope for the best. If this screen appears again, follow these steps:"),$2("p",{},void 0,"Try removing any new plugins and restarting again. If this solves the problem there may be a bug in a plugin or a conflict."),$2("p",{},void 0,"If problems continue, it's likely that there is a bug in EndPwn or Discord."),$2("p",{},void 0,"If you need help, join the EndPwn Discord server (https://discord.gg/wXdPNf2)"),$2("p",{},void 0,"Details may be available in the console (Ctrl+Shift+I), but at this level of crash we can't be certain.")),$4=$2("div",{},void 0,$2($5.default,{size:$6.ButtonSizes.LARGE,onClick:()=>window.electron.getCurrentWindow().reload()},void 0,"Reload"),$2($5.default,{size:$6.ButtonSizes.LARGE,onClick:()=>{window.$api.localStorage.set('safemode',1);window.electron.getCurrentWindow().reload()}},void 0,"Reload in safe mode"));return $2(u.default,{theme:this.props.theme,title:"Discord: Fatal Error",`
}
// changelog injection
/*{
signature: /key:"changeLog",get:function\(\){return (\w)}/g,
payload: 'key:"changeLog",get:function(){if(!$1.injected){$1.injected=1;$1.date=$1.date<=window.endpwn.changelog.date?window.endpwn.changelog.date:$1.date;$1.body=window.endpwn.changelog.body+"\\n\\n"+$1.body}return $1}'
},*/
],
},
// crash screen hijack
{
signature: /var (\w)=(\w)\("div",{},void 0,\w\("p",{},void 0,(\w)\.default\.Messages\.ERRORS_UNEXPECTED_CRASH\),\w\("p",{},void 0,\w\.default\.Messages\.ERRORS_ACTION_TO_TAKE\)\),(\w)=\w\((\w)\.default,{size:(\w)\.ButtonSizes\.LARGE,onClick:this\._handleSubmitReport},void 0,a\.default\.Messages\.ERRORS_RELOAD\);return o\(u\.default,{theme:this\.props.theme,title:a\.default\.Messages\.UNSUPPORTED_BROWSER_TITLE,/g,
payload: `var $1=$2("div",{},void 0,$2("p",{},void 0,"Something has gone very, very wrong, and Discord has crashed."),$2("p",{},void 0,"If this is the first time you've seen this error screen, reload and hope for the best. If this screen appears again, follow these steps:"),$2("p",{},void 0,"Try removing any new plugins and restarting again. If this solves the problem there may be a bug in a plugin or a conflict."),$2("p",{},void 0,"If problems continue, it's likely that there is a bug in EndPwn or Discord."),$2("p",{},void 0,"If you need help, join the EndPwn Discord server (https://discord.gg/wXdPNf2)"),$2("p",{},void 0,"Details may be available in the console (Ctrl+Shift+I), but at this level of crash we can't be certain.")),$4=$2("div",{},void 0,$2($5.default,{size:$6.ButtonSizes.LARGE,onClick:()=>window.electron.getCurrentWindow().reload()},void 0,"Reload"),$2($5.default,{size:$6.ButtonSizes.LARGE,onClick:()=>{window.$api.localStorage.set('safemode',1);window.electron.getCurrentWindow().reload()}},void 0,"Reload in safe mode"));return $2(u.default,{theme:this.props.theme,title:"Discord: Fatal Error",`
}
preload: function () {
window.reload = () => { app.relaunch(); app.exit(); };
window.endpwn = {
],
},
// safemode
safemode: function () {
$api.ui.showDialog({
title: 'EndPwn: safe mode',
body: 'This will restart your client in a state without plugin support.',
confirmText: 'Yes', cancelText: 'No',
preload: function () {
onConfirm: () => {
window.reload = () => { app.relaunch(); app.exit(); };
window.endpwn = {
$api.localStorage.set('safemode', 1);
window.electron.getCurrentWindow().reload();
// safemode
safemode: function () {
}
});
},
// uninstaller
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');
$api.settings.set('UPDATE_ENDPOINT');
reload();
}
});
},
// endpwn customizer
customizer: krequire('customizer'),
// settings page stuff
settings: krequire('settings'),
// wrapper function for dispatch()
// intended to simplify using executeJavaScript() from other windows as a bad IPC method
// we do this since afaik we cant use electron.ipc in a useful way (maybe im wrong? if i am ill make this better later on lol)
pseudoipc: function (e) {
$api.events.dispatch({
type: 'ENDPWN_PSEUDO_IPC',
data: e
});
},
__eval: e => eval(e)
};
// fetch the changelog
/*internal.print('retrieving changelog...');
fetch('https://dr1ft.xyz/ep/changelog.txt?_=' + Date.now()).then(r => r.text()).then(l => {
var data = l.split(';;');
window.endpwn.changelog = {
date: data[0],
body: data[1]
};
});*/
// early init payload
document.addEventListener('ep-prepared', () => {
// disable that obnoxious warning about not pasting shit in the console
internal.print('disabling self xss warning...');
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
// fuck sentry
internal.print('fucking sentry...');
var sentry = wc.findCache('_originalConsoleMethods')[0].exports;
window.console = Object.assign(window.console, sentry._originalConsoleMethods); // console
sentry._wrappedBuiltIns.forEach(x => x[0][x[1]] = x[2]); // other stuff
sentry._breadcrumbEventHandler = () => () => { }; // break most event logging
sentry.captureBreadcrumb = () => { }; // disable breadcrumb logging
});
},
start: function () {
// disable analytics
internal.print('disabling analytics...');
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
// enable experiments
internal.print('enabling experiments menu...');
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);
// if we used start() in the other files, it would create a different instance -- we dont want that
endpwn.customizer.init();
endpwn.settings.init();
// check for epapi updates
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE'))
(function () {
internal.print('checking for EPAPI updates...');
// fetch the latest build of epapi
fetch('https://lambda.cynfoxwell.cf/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
// check the version
if (kparse(x).version > $api.version) {
// if the version on the server is newer, pester the user
$api.ui.showDialog({
title: 'EndPwn: safe mode',
body: 'This will restart your client in a state without plugin support.',
confirmText: 'Yes', cancelText: 'No',
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.',
confirmText: 'Restart Now', cancelText: 'Later',
// user pressed "Restart Now"
onConfirm: () => {
$api.localStorage.set('safemode', 1);
window.electron.getCurrentWindow().reload();
}
});
},
// uninstaller
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');
$api.settings.set('UPDATE_ENDPOINT');
// refresh the page if we're running in a browser, reboot the app if we're running outside of lite mode
reload();
},
// they pressed "Later", for some reason
onCancel: () => {
// bother them again in 6 hrs (* 60 min * 60 sec * 1000 ms)
setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
}
});
},
// endpwn customizer
customizer: krequire('customizer'),
// settings page stuff
settings: krequire('settings'),
// wrapper function for dispatch()
// intended to simplify using executeJavaScript() from other windows as a bad IPC method
// we do this since afaik we cant use electron.ipc in a useful way (maybe im wrong? if i am ill make this better later on lol)
pseudoipc: function (e) {
$api.events.dispatch({
type: 'ENDPWN_PSEUDO_IPC',
data: e
});
},
__eval: e => eval(e)
};
// fetch the changelog
/*internal.print('retrieving changelog...');
fetch('https://dr1ft.xyz/ep/changelog.txt?_=' + Date.now()).then(r => r.text()).then(l => {
var data = l.split(';;');
window.endpwn.changelog = {
date: data[0],
body: data[1]
};
});*/
// early init payload
document.addEventListener('ep-prepared', () => {
// disable that obnoxious warning about not pasting shit in the console
internal.print('disabling self xss warning...');
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
// fuck sentry
internal.print('fucking sentry...');
var sentry = wc.findCache('_originalConsoleMethods')[0].exports;
window.console = Object.assign(window.console, sentry._originalConsoleMethods); // console
sentry._wrappedBuiltIns.forEach(x => x[0][x[1]] = x[2]); // other stuff
sentry._breadcrumbEventHandler = () => () => { }; // break most event logging
sentry.captureBreadcrumb = () => { }; // disable breadcrumb logging
}
else setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
});
},
start: function () {
// disable analytics
internal.print('disabling analytics...');
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
// enable experiments
internal.print('enabling experiments menu...');
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);
// if we used start() in the other files, it would create a different instance -- we dont want that
endpwn.customizer.init();
endpwn.settings.init();
// check for epapi updates
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE'))
(function () {
internal.print('checking for EPAPI updates...');
// fetch the latest build of epapi
fetch('https://lambda.cynfoxwell.cf/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
// check the version
if (kparse(x).version > $api.version) {
// if the version on the server is newer, pester the user
$api.ui.showDialog({
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.',
confirmText: 'Restart Now', cancelText: 'Later',
// user pressed "Restart Now"
onConfirm: () => {
// refresh the page if we're running in a browser, reboot the app if we're running outside of lite mode
reload();
},
// they pressed "Later", for some reason
onCancel: () => {
// bother them again in 6 hrs (* 60 min * 60 sec * 1000 ms)
setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
}
});
}
else setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
});
})();
}
}
})();
}
}