update proxy release

This commit is contained in:
Cynthia Foxwell 2018-07-11 18:32:22 -06:00
parent 9297c285b1
commit 1d4fc955bf
4 changed files with 383 additions and 344 deletions

View File

@ -6,6 +6,12 @@
<meta property="og:description" content="Instructions for installing Lambda" /> <meta property="og:description" content="Instructions for installing Lambda" />
<meta property="og:image" content="/lambda.png" /> <meta property="og:image" content="/lambda.png" />
<script>
function updatePayload() {
document.querySelector('code').innerText = `DiscordNative.globals.appSettings.set('UPDATE_ENDPOINT','https://proxy.xn--lmbda-2be.cf/api');DiscordNative.globals.appSettings.save();reloadElectronApp()`
}
</script>
<style> <style>
@font-face { @font-face {
font-family: 'IBMVGA8'; font-family: 'IBMVGA8';
@ -45,9 +51,9 @@
<body> <body>
<div>L&lambda;mbda</div> <div>L&lambda;mbda</div>
<a href="https://gitlab.com/Cynosphere/lambda-patcher">Grab the Lambda Patcher</a> Copy and paste the following string into your Discord console:
<br> <br>
<p>Lambda does not have any Discord internal injection methods anymore.</p> <code>please wait...</code>
<br> <br>
<b>This is a fork of EndPwn3.</b> <b>This is a fork of EndPwn3.</b>
</body> </body>

View File

@ -17,7 +17,7 @@
*/ */
var internal = { /*var internal = {
print: function (str) { print: function (str) {
console.log(`%c[Customizer]%c ` + str, 'font-weight:bold;color:#0cc', ''); console.log(`%c[Customizer]%c ` + str, 'font-weight:bold;color:#0cc', '');
@ -120,3 +120,4 @@ exports = {
} }
} }
*/

View File

@ -16,51 +16,68 @@
https://github.com/endpwn/ https://github.com/endpwn/
*/ */
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 = { exports = {
manifest: { manifest: {
replacements: [ replacements: [
{ {
signature: /{section:(\w)\.SectionTypes\.DIVIDER},{section:"logout",/g, 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",' payload:
'{section:$1.SectionTypes.DIVIDER},{section:"ENDPWN",label:"ΣndPwn Settings",element:window.BlankSettingsElement,color:"#0cc"},{section:$1.SectionTypes.DIVIDER},{section:"logout",'
} }
], ]
}, },
init: function() { init: function() {
delete endpwn.settings.init; delete endpwn.settings.init;
var currentSection = ''; var currentSection = "";
$api.events.listen('ENDPWN_PSEUDO_IPC', msg => { /*$api.events.listen('ENDPWN_PSEUDO_IPC', msg => {
$api.localStorage.set('customizer_signature', JSON.parse(msg.data).signature); $api.localStorage.set('customizer_signature', JSON.parse(msg.data).signature);
console.log(currentSection); console.log(currentSection);
renderSettings(currentSection); renderSettings(currentSection);
}); });*/
window.BlankSettingsElement = $api.util.findConstructor('FormSection', 'FormSection').FormSection; window.BlankSettingsElement = $api.util.findConstructor(
"FormSection",
"FormSection"
).FormSection;
var buttons = $api.util.findFuncExports('button-', 'colorBlack'); var buttons = $api.util.findFuncExports("button-", "colorBlack");
var checkboxes = $api.util.findFuncExports('checkboxEnabled'); var checkboxes = $api.util.findFuncExports("checkboxEnabled");
var misc = $api.util.findFuncExports('statusRed-', 'inputDefault'); var misc = $api.util.findFuncExports("statusRed-", "inputDefault");
var misc2 = $api.util.findFuncExports('multiInputField'); var misc2 = $api.util.findFuncExports("multiInputField");
var headers = $api.util.findFuncExports('h5-', 'h5'); var headers = $api.util.findFuncExports("h5-", "h5");
var panels = wc.findFunc('flexChild-')[0].exports; var panels = wc.findFunc("flexChild-")[0].exports;
var panels2 = $api.util.findFuncExports('errorMessage-', 'inputWrapper'); var panels2 = $api.util.findFuncExports(
"errorMessage-",
"inputWrapper"
);
function createVerticalPanel() { function createVerticalPanel() {
return createElement("div") return createElement("div").withClass(
.withClass(panels2.vertical, 'epButtonPanel') panels2.vertical,
"epButtonPanel"
);
} }
function createHorizontalPanel() { function createHorizontalPanel() {
return createElement("div") return createElement("div").withClass(
.withClass(panels.horizontal, 'epButtonPanel') panels.horizontal,
"epButtonPanel"
);
} }
function createButton(name) { function createButton(name) {
return createElement('button') return createElement("button")
.withContents(name) .withContents(name)
.withClass( .withClass(
buttons.button, buttons.button,
@ -68,12 +85,12 @@ exports = {
buttons.colorBrand, buttons.colorBrand,
buttons.sizeSmall, buttons.sizeSmall,
buttons.grow, buttons.grow,
'epMargin' "epMargin"
); );
} }
function createWarnButton(name) { function createWarnButton(name) {
return createElement('button') return createElement("button")
.withContents(name) .withContents(name)
.withClass( .withClass(
buttons.button, buttons.button,
@ -81,12 +98,12 @@ exports = {
buttons.colorYellow, buttons.colorYellow,
buttons.sizeSmall, buttons.sizeSmall,
buttons.grow, buttons.grow,
'epMargin' "epMargin"
); );
} }
function createDangerButton(name) { function createDangerButton(name) {
return createElement('button') return createElement("button")
.withContents(name) .withContents(name)
.withClass( .withClass(
buttons.button, buttons.button,
@ -94,7 +111,7 @@ exports = {
buttons.colorRed, buttons.colorRed,
buttons.sizeSmall, buttons.sizeSmall,
buttons.grow, buttons.grow,
'epMargin' "epMargin"
); );
} }
@ -108,7 +125,7 @@ exports = {
headers.height20, headers.height20,
headers.weightSemiBold, headers.weightSemiBold,
headers.defaultColor, headers.defaultColor,
'epMargin' "epMargin"
) )
.withText(text); .withText(text);
} }
@ -131,9 +148,9 @@ exports = {
misc.inputDefault, misc.inputDefault,
misc.input, misc.input,
misc.size16, misc.size16,
'epMargin' "epMargin"
) )
.modify(x => x.value = v) .modify(x => (x.value = v));
} }
//<input class="checkboxEnabled-CtinEn checkbox-2tyjJg" type="checkbox"> //<input class="checkboxEnabled-CtinEn checkbox-2tyjJg" type="checkbox">
@ -141,18 +158,18 @@ exports = {
//switchEnabled-V2WDBB switch-3wwwcV valueChecked-m-4IJZ 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) { function updateSwitch(s, w) {
if (s.checked) { if (s.checked) {
w.classList.remove(checkboxes.valueUnchecked.split(' ')[0]); w.classList.remove(checkboxes.valueUnchecked.split(" ")[0]);
w.classList.add(checkboxes.valueChecked.split(' ')[0]) w.classList.add(checkboxes.valueChecked.split(" ")[0]);
} } else {
else { w.classList.remove(checkboxes.valueChecked.split(" ")[0]);
w.classList.remove(checkboxes.valueChecked.split(' ')[0]); w.classList.add(checkboxes.valueUnchecked.split(" ")[0]);
w.classList.add(checkboxes.valueUnchecked.split(' ')[0])
} }
} }
function createSwitch(c, i) { function createSwitch(c, i) {
if (c === undefined) c = () => {}; if (c === undefined) c = () => {};
if (i === undefined) i = false; if (i === undefined) i = false;
var s, w = createElement('div') var s,
w = createElement("div")
.withClass( .withClass(
checkboxes.switch, checkboxes.switch,
checkboxes.switchEnabled, checkboxes.switchEnabled,
@ -161,23 +178,26 @@ exports = {
checkboxes.themeDefault checkboxes.themeDefault
) )
.withChildren( .withChildren(
s = createElement("input") (s = createElement("input")
.withClass( .withClass(
checkboxes.checkbox, checkboxes.checkbox,
checkboxes.checkboxEnabled checkboxes.checkboxEnabled
) )
.modify(x => x.type = 'checkbox') .modify(x => (x.type = "checkbox"))
.modify(x => x.checked = i) .modify(x => (x.checked = i))
.modify(x => x.onchange = () => { .modify(
x =>
(x.onchange = () => {
updateSwitch(s, w); updateSwitch(s, w);
c(s.checked); c(s.checked);
}) })
) ))
);
updateSwitch(s, w); updateSwitch(s, w);
return w; return w;
} }
function authorizeCustomizer() { /*function authorizeCustomizer() {
var endpoint = $api.internal.constants.API_HOST; 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 url = `https://${endpoint}/oauth2/authorize?client_id=436715820970803203&redirect_uri=https%3A%2F%2Fendpwn.cathoderay.tube%2Fauth%2Fdiscord%2Fintegratedcallback&response_type=code&scope=identify`;
@ -218,31 +238,29 @@ exports = {
}); });
} }*/
function renderSettings(e) { function renderSettings(e) {
currentSection = e; currentSection = e;
if ($("#ep_settings")) $("#ep_settings").remove(); if ($("#ep_settings")) $("#ep_settings").remove();
if (e.section == "ENDPWN") { if (e.section == "ENDPWN") {
var pane = $(".content-column.default"); var pane = $(".content-column.default");
if (!pane) return; if (!pane) return;
var needAuth = !$api.localStorage.get('customizer_signature'); //var needAuth = !$api.localStorage.get('customizer_signature');
var content = createElement('div') var content = createElement("div")
.withId('ep_settings') .withId("ep_settings")
.withClass('flex-vertical') .withClass("flex-vertical")
.withChildren( .withChildren(
createElement("div") createElement("div")
.withClass('epSettingsHeader') .withClass("epSettingsHeader")
.withText('ΣndPwn Settings') .withText("ΣndPwn Settings")
) )
.appendTo(pane); .appendTo(pane);
if (!$api.localStorage.get('customizer_signature')) { /*if (!$api.localStorage.get('customizer_signature')) {
createHorizontalPanel() createHorizontalPanel()
.withChildren( .withChildren(
@ -276,26 +294,40 @@ exports = {
) )
.appendTo(content); .appendTo(content);
} }*/
createElement("div") createElement("div")
.withClass(panels.horizontal, 'epButtonPanel') .withClass(panels.horizontal, "epButtonPanel")
.withChildren( .withChildren(
createButton("Open Data Folder") createButton("Open Data Folder").modify(
.modify(x => x.onclick = () => { electron.shell.openExternal($api.data) }), x =>
createWarnButton("Restart in safe mode") (x.onclick = () => {
.modify(x => x.onclick = endpwn.safemode), electron.shell.openExternal($api.data);
createDangerButton("Uninstall EndPwn") })
.modify(x => x.onclick = endpwn.uninstall) ),
createWarnButton("Restart in safe mode").modify(
x => (x.onclick = endpwn.safemode)
),
createDangerButton("Uninstall EndPwn").modify(
x => (x.onclick = endpwn.uninstall)
)
/*createButton("Toggle Customizer")
.modify(x => x.onclick = function(){
window.____customizerToggled = !window.____customizerToggled;
$api.localStorage.set("customizerToggled",window.____customizerToggled);
const restart = confirm("For toggle to be in full effect, you will need to refresh. Press \"OK\" to refresh or \"Cancel\" to refresh later on your own.");
if (restart){
window.electron.getCurrentWindow().reload();
}
})*/
) )
.appendTo(content); .appendTo(content);
} }
} }
$api.events.hook("USER_SETTINGS_MODAL_SET_SECTION", renderSettings); $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_INIT", e =>
} setTimeout(_ => renderSettings(e), 200)
);
} }
};

View File

@ -18,20 +18,17 @@
*/ */
var internal = { var internal = {
print: function(str) { print: function(str) {
console.log(`%c[EndPwn3]%c ` + str, 'font-weight:bold;color:#0cc', ''); console.log(`%c[EndPwn3]%c ` + str, "font-weight:bold;color:#0cc", "");
}, },
warn: function(str) { warn: function(str) {
console.warn(`%c[EndPwn3]%c ` + str, 'font-weight:bold;color:#0cc', ''); console.warn(`%c[EndPwn3]%c ` + str, "font-weight:bold;color:#0cc", "");
}
} }
};
exports = { exports = {
manifest: { manifest: {
replacements: [ replacements: [
// changelog injection // changelog injection
/*{ /*{
signature: /key:"changeLog",get:function\(\){return (\w)}/g, signature: /key:"changeLog",get:function\(\){return (\w)}/g,
@ -49,26 +46,27 @@ exports = {
signature: "window.GLOBAL_ENV.RELEASE_CHANNEL", signature: "window.GLOBAL_ENV.RELEASE_CHANNEL",
payload: "'staging'" payload: "'staging'"
} }
]
],
}, },
preload: function() { preload: function() {
window.reload = () => { app.relaunch(); app.exit(); }; window.reload = () => {
app.relaunch();
app.exit();
};
window.endpwn = { window.endpwn = {
// safemode // safemode
safemode: function() { safemode: function() {
$api.ui.showDialog({ $api.ui.showDialog({
title: 'EndPwn: safe mode', title: "EndPwn: safe mode",
body: 'This will restart your client in a state without plugin support.', body:
confirmText: 'Yes', cancelText: 'No', "This will restart your client in a state without plugin support.",
confirmText: "Yes",
cancelText: "No",
onConfirm: () => { onConfirm: () => {
$api.localStorage.set("safemode", 1);
$api.localStorage.set('safemode', 1);
window.electron.getCurrentWindow().reload(); window.electron.getCurrentWindow().reload();
} }
}); });
}, },
@ -76,42 +74,41 @@ exports = {
// uninstaller // uninstaller
uninstall: function() { uninstall: function() {
$api.ui.showDialog({ $api.ui.showDialog({
title: 'EndPwn: confirm uninstallation', title: "EndPwn: confirm uninstallation",
body: 'Are you sure you want to remove EndPwn from your client? You can reinstall it at any time.', body:
confirmText: 'Yes', cancelText: 'No', "Are you sure you want to remove EndPwn from your client? You can reinstall it at any time.",
confirmText: "Yes",
cancelText: "No",
onConfirm: () => { onConfirm: () => {
var data = $api.data; var data = $api.data;
$api.settings.set('WEBAPP_ENDPOINT'); $api.settings.set("WEBAPP_ENDPOINT");
$api.settings.set('WEBAPP_PATH'); $api.settings.set("WEBAPP_PATH");
$api.settings.set('UPDATE_ENDPOINT'); $api.settings.set("UPDATE_ENDPOINT");
reload(); reload();
} }
}); });
}, },
// endpwn customizer // endpwn customizer
customizer: krequire('customizer'), //customizer: krequire('customizer'),
// settings page stuff // settings page stuff
settings: krequire('settings'), settings: krequire("settings"),
// wrapper function for dispatch() // wrapper function for dispatch()
// intended to simplify using executeJavaScript() from other windows as a bad IPC method // 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) // 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) { pseudoipc: function(e) {
$api.events.dispatch({ $api.events.dispatch({
type: 'ENDPWN_PSEUDO_IPC', type: "ENDPWN_PSEUDO_IPC",
data: e data: e
}); });
}, },
__eval: e => eval(e) __eval: e => eval(e)
}; };
// fetch the changelog // fetch the changelog
@ -125,79 +122,82 @@ exports = {
});*/ });*/
// early init payload // early init payload
document.addEventListener('ep-prepared', () => { document.addEventListener("ep-prepared", () => {
// disable that obnoxious warning about not pasting shit in the console // disable that obnoxious warning about not pasting shit in the console
internal.print('disabling self xss warning...'); internal.print("disabling self xss warning...");
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { }; $api.util.findFuncExports(
"consoleWarning"
).consoleWarning = e => {};
// fuck sentry // fuck sentry
internal.print('fucking sentry...'); internal.print("fucking sentry...");
var sentry = wc.findCache('_originalConsoleMethods')[0].exports; var sentry = wc.findCache("_originalConsoleMethods")[0].exports;
window.console = Object.assign(window.console, sentry._originalConsoleMethods); // console window.console = Object.assign(
sentry._wrappedBuiltIns.forEach(x => x[0][x[1]] = x[2]); // other stuff window.console,
sentry._originalConsoleMethods
); // console
sentry._wrappedBuiltIns.forEach(x => (x[0][x[1]] = x[2])); // other stuff
sentry._breadcrumbEventHandler = () => () => {}; // break most event logging sentry._breadcrumbEventHandler = () => () => {}; // break most event logging
sentry.captureBreadcrumb = () => {}; // disable breadcrumb logging sentry.captureBreadcrumb = () => {}; // disable breadcrumb logging
}); });
}, },
start: function() { start: function() {
// disable analytics // disable analytics
internal.print('disabling analytics...'); internal.print("disabling analytics...");
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { }; $api.util.findFuncExports(
"AnalyticEventConfigs"
).default.track = () => {};
// enable experiments // enable experiments
internal.print('enabling experiments menu...'); internal.print("enabling experiments menu...");
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true); $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 // if we used start() in the other files, it would create a different instance -- we dont want that
endpwn.customizer.init(); endpwn.customizer.init();
endpwn.settings.init(); endpwn.settings.init();
// check for epapi updates // check for epapi updates
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE')) if ($api.lite || !fs.existsSync($api.data + "/DONTUPDATE"))
(function() { (function() {
internal.print('checking for EPAPI updates...'); internal.print("checking for EPAPI updates...");
// fetch the latest build of epapi // fetch the latest build of epapi
fetch('https://lambda.cynfoxwell.cf/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => { fetch(
"https://lambda.cynfoxwell.cf/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:
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.', "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
reload(); 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
);
} }
}); });
} else setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
}
else setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
}); });
})(); })();
} }
} };