update settingsapi
This commit is contained in:
parent
6ea8342f94
commit
4dbde490cf
|
@ -24,6 +24,10 @@ exports = {
|
|||
name: "Settings Page + Settings API",
|
||||
description: "Hijacking the settings pages.",
|
||||
replacements: [
|
||||
{
|
||||
signature:/section:"logout",onClick:function\(\){(.)\.default\.push\(function\((.)\){return (.)\.createElement\((.)\.default,(.)\((.+),(.)\),(.)\((.)\.default,{size:(.)\.default\.Sizes\.MEDIUM,color:(.)\.default\.Colors\.PRIMARY},void 0,((.)\.default\.Messages\.USER_SETTINGS_CONFIRM_LOGOUT)\)\)}\)}/,
|
||||
payload:'section:"logout",onClick:window.__fancyDialog=function(data=$6,txt=$12){$1.default.push(function($2){return $3.createElement($4.default,$5(data,$7),$8($9.default,{size:$10.default.Sizes.MEDIUM,color:$11.default.Colors.PRIMARY},void 0,txt))})}'
|
||||
},
|
||||
{signature:'/function (.)\\(\\){return\\[{(.+)}]}/',payload:'window.$settingsapi={sections:[{$2}]};function $1(){return window.$settingsapi.sections;}'}
|
||||
],
|
||||
loadAfter: ["system"]
|
||||
|
@ -45,6 +49,9 @@ exports = {
|
|||
var panels2 = $api.util.findFuncExports('errorMessage-', 'inputWrapper');
|
||||
|
||||
let sections = window.$settingsapi.sections;
|
||||
let dialog = window.__fancyDialog;
|
||||
|
||||
delete window.__fancyDialog;
|
||||
|
||||
window.$settingsapi = {
|
||||
sections: sections,
|
||||
|
@ -71,6 +78,7 @@ exports = {
|
|||
$settingsapi.ourSections.push({section:"HEADER",label:label});
|
||||
$settingsapi.sections.splice($settingsapi.sections.length-4,0,{section:"HEADER",label:label});
|
||||
},
|
||||
fancyDialog: dialog,
|
||||
//All of these allow us to use Discord's elements.
|
||||
elements: {
|
||||
createVerticalPanel: function() {
|
||||
|
@ -323,7 +331,23 @@ exports = {
|
|||
em.createWarnButton("Restart in safe mode")
|
||||
.modify(x => x.onclick = endpwn.safemode),
|
||||
em.createDangerButton("Uninstall EndPwn")
|
||||
.modify(x => x.onclick = endpwn.uninstall)
|
||||
.modify(x => x.onclick = function () {
|
||||
$settingsapi.fancyDialog({
|
||||
header: 'EndPwn: confirm uninstallation',
|
||||
confirmText: 'Yes', cancelText: 'No',
|
||||
|
||||
onConfirm: () => {
|
||||
|
||||
var data = $api.data;
|
||||
|
||||
$api.settings.set('WEBAPP_ENDPOINT');
|
||||
$api.settings.set('WEBAPP_PATH');
|
||||
|
||||
reload();
|
||||
|
||||
}
|
||||
},'Are you sure you want to remove EndPwn from your client? You can reinstall it at any time.');
|
||||
})
|
||||
)
|
||||
.appendTo(content);
|
||||
|
||||
|
|
Loading…
Reference in New Issue