run prettier

master
Drake 2 years ago
parent 1ca158e39f
commit c713d85429

@ -41,6 +41,7 @@ Because it's
- Will break at the slightest poke or prod (related to the first one) - Will break at the slightest poke or prod (related to the first one)
### Who's your least favourite sin? ### Who's your least favourite sin?
Probably Mammon, due to a mix of me not liking their sin in general (greed 👎), and them being an ABSOLUTE ASSHOLE in nearly every fancanon out there. Probably Mammon, due to a mix of me not liking their sin in general (greed 👎), and them being an ABSOLUTE ASSHOLE in nearly every fancanon out there.
# Screenshots # Screenshots

@ -27,7 +27,7 @@ function wackyPatch(
thisArg: any, thisArg: any,
[ctx, args]: [ctx: any, args: []] [ctx, args]: [ctx: any, args: []]
) => { ) => {
console.log(thisArg) console.log(thisArg);
if (before !== undefined) before.apply(ctx, [args]); if (before !== undefined) before.apply(ctx, [args]);
const res = const res =
patches["instead"] !== undefined patches["instead"] !== undefined
@ -66,8 +66,13 @@ function after(parentObj: any, name: string, func: AfterFunc) {
} }
//idea shamelessly ripped from vencord, but done slightly differently (ie allowing for targetting specific webpack functions) //idea shamelessly ripped from vencord, but done slightly differently (ie allowing for targetting specific webpack functions)
function regexPatch(match: RegExp | string, replace: string, obj: any, prop: string) { function regexPatch(
const oldFunc = obj[prop] match: RegExp | string,
replace: string,
obj: any,
prop: string
) {
const oldFunc = obj[prop];
const injId = Symbol(); const injId = Symbol();
const handler = { const handler = {
apply: ( apply: (
@ -75,18 +80,18 @@ function regexPatch(match: RegExp | string, replace: string, obj: any, prop: str
thisArg: any, thisArg: any,
[ctx, args]: [ctx: any, args: []] [ctx, args]: [ctx: any, args: []]
) => { ) => {
let oldfunc = target let oldfunc = target;
let str: string = oldFunc.toString() let str: string = oldFunc.toString();
str = str.replaceAll(match, replace) str = str.replaceAll(match, replace);
console.log("(" + str + ")") console.log("(" + str + ")");
let newfunc = eval.apply(ctx, ["(" + str + ")"]) let newfunc = eval.apply(ctx, ["(" + str + ")"]);
console.log(ctx) console.log(ctx);
return newfunc.apply(ctx, args) return newfunc.apply(ctx, args);
} }
}; };
const prox = new Proxy(obj[prop], handler); const prox = new Proxy(obj[prop], handler);
const orig = obj[prop]; const orig = obj[prop];
obj[prop] = prox obj[prop] = prox;
const unpatch = () => { const unpatch = () => {
obj[prop] = orig; obj[prop] = orig;
}; };
@ -98,13 +103,7 @@ function regexPatch(match: RegExp | string, replace: string, obj: any, prop: str
return unpatch; return unpatch;
} }
export { instead, before, after, regexPatch };
export {
instead,
before,
after,
regexPatch
};
export default { export default {
instead, instead,

@ -59,7 +59,7 @@ function add(iife: string, customMeta: UnknownObject = {}) {
enabled: false, enabled: false,
desc: exports.meta.desc desc: exports.meta.desc
}; };
Object.assign(pluginNest.store.plugins[exports.meta.name], customMeta) Object.assign(pluginNest.store.plugins[exports.meta.name], customMeta);
} }
function del(name: string) { function del(name: string) {

@ -49,7 +49,7 @@ const warn = makeLogger(console.warn);
const error = makeLogger(console.error); const error = makeLogger(console.error);
const trace = makeLogger(console.trace); const trace = makeLogger(console.trace);
const debug = makeLogger((...args) => { const debug = makeLogger((...args) => {
/*#if _DEBUG /*#if _DEBUG
console.log(...args) console.log(...args)
//#endif */ //#endif */
}); });

@ -55,4 +55,4 @@ window.demon = {
}; };
plugins.init(); plugins.init();
settings.init(); settings.init();

Loading…
Cancel
Save