diff --git a/options.default.toml b/options.default.toml index d9cd04d..24d9866 100644 --- a/options.default.toml +++ b/options.default.toml @@ -1,7 +1,5 @@ #Passes configuration directly into rollup-plugin-jscc, refer to it's documentation for more details [values] -_DEBUG = 0 #enables debug logs -_ANALYTICS = 0 #enables analytics nagging -_TOKEN = 0 #enables the valentino token logging easter egg (untested, no clue if it actually works) +_DEBUG = 0 #enables debug logs _CORS_URL = "https://cors.ruthenic.com/" \ No newline at end of file diff --git a/src/api/analytics.ts b/src/api/analytics.ts deleted file mode 100644 index e023f40..0000000 --- a/src/api/analytics.ts +++ /dev/null @@ -1,9 +0,0 @@ -import modals from "./utils/modals"; - -/* demon.summon("utils/modals").openConfirmModal("Test Modal", "confirm", { - header: "Demoncord" -}) */ - -export default { - init: () => {} -}; diff --git a/src/api/patcher.ts b/src/api/patcher.ts index 801495f..df32ebe 100644 --- a/src/api/patcher.ts +++ b/src/api/patcher.ts @@ -30,8 +30,7 @@ function wackyPatch( if (before !== undefined) before.apply(ctx, [args]); const res = patches["instead"] !== undefined - ? //@ts-ignore; TS thinks that `instead` possibly being undefined is bad (meanwhile we literally check for that) - instead.apply(ctx, [args, target.bind(ctx)]) + ? instead?.apply(ctx, [args, target.bind(ctx)]) : target.apply(ctx, args); if (after === undefined) return res; return after.apply(ctx, [args, res]); diff --git a/src/api/ritual.ts b/src/api/ritual.ts index ef18dc7..8ac3ffe 100644 --- a/src/api/ritual.ts +++ b/src/api/ritual.ts @@ -2,14 +2,15 @@ import webpack from "./webpack"; import { instead } from "./patcher"; import { leak } from "./utils/memory"; -type Sins = Record void) | null>; +type Sins = Record void>; +type Rulers = Record; const sins: Sins = { - Lust: null, - Pride: null, - Greed: null, - Wrath: null, - Envy: null, + Lust: () => {}, + Pride: () => {}, + Greed: () => {}, + Wrath: () => {}, + Envy: () => {}, Gluttony: () => { //slowly memory leak to make the app notably slower (perhaps even slothier) setInterval(() => { @@ -33,7 +34,7 @@ const sins: Sins = { } }; -const rulers = { +const rulers: Rulers = { Asmodeus: "Lust", Lucifer: "Pride", Mammon: "Greed", @@ -50,12 +51,10 @@ function ritualFail(sin: string) { throw `Illegal Invocation of a sin!`; } else { if (sin in sins) { - if (!sins[sin]) { - throw `Illegal Invocation of a sin!`; - } else { - //@ts-ignore - sins[sin](); - } + sins[sin] || + (() => { + throw `Illegal Invocation of a sin!`; + })(); } else { console.log("WTF did you do"); console.log(sin); @@ -96,7 +95,7 @@ function findByRitual(incantation: string) { Math.floor(Math.random() * Object.keys(sins).length) ] ); - return; + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "of") { ritualFail( @@ -104,9 +103,10 @@ function findByRitual(incantation: string) { Math.floor(Math.random() * Object.keys(sins).length) ] ); + throw `Illegal Invocation of a sin!`; } - //@ts-expect-error 2532 - const sin = args.shift().replace(",", ""); + + const sin = args.shift()?.replace(",", "") ?? ""; if (!(sin in sins)) { //invalid sin, so we can't use it ritualFail( @@ -114,62 +114,66 @@ function findByRitual(incantation: string) { Math.floor(Math.random() * Object.keys(sins).length) ] ); - return; + throw `Illegal Invocation of a sin!`; } - //@ts-expect-error 2532 - const ruler = args.shift().replace(",", ""); + + const ruler = args.shift()?.replace(",", "") ?? ""; if (!(ruler in rulers)) { //invalid ruler, so we still can't use it //use the sin punishment ritualFail(sin); + throw `Illegal Invocation of a sin!`; } - //@ts-expect-error 2532 if (rulers[ruler] !== sin) { //sin/ruler mismatch //i feel it's more fitting to call the sin of the demon, instead of the sin you provided, as you would've angered the ruler for calling them for the wrong sin - //@ts-expect-error 2532 ritualFail(rulers[ruler]); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "to") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "summon") { - //TODO: we want to accept either "summon" or "bring forth" here but i cbf rn ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "the") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } const adjective = args.shift(); if (adjective !== "imposing" && adjective !== "foreboding") { //TODO: sin-specific adjectives ritualFail(sin); + throw `Illegal Invocation of a sin!`; } const descriptor = args.shift(); if (descriptor !== "object" && descriptor !== "element") { //TODO: typecheck this shit ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "with" || args.shift() !== "a") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } const filter = args.shift(); if (filter !== "display" && filter !== "property") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "of" || args.shift() !== "name") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } //TODO: HOW THE FUCK ARE WE SUPPOSED TO DO MULTIPLE PROPS? - //@ts-expect-error 2532 - const prop = args.shift().slice(0, -1); + const prop = args.shift()?.slice(0, -1); switch (filter) { case "display": return webpack.findByDisplayName(prop); - break; case "property": return webpack.findByProps(prop); - break; default: // the only way you can get here is with cosmic rays or divine intervention ritualFail(sin); diff --git a/src/api/utils/logger.ts b/src/api/utils/logger.ts index 8307131..22d6d70 100644 --- a/src/api/utils/logger.ts +++ b/src/api/utils/logger.ts @@ -49,7 +49,7 @@ const warn = makeLogger(console.warn); const error = makeLogger(console.error); const trace = makeLogger(console.trace); const debug = makeLogger((...args) => { - /*#if _DEBUG +/*#if _DEBUG console.log(...args) //#endif */ }); diff --git a/src/api/utils/memory.ts b/src/api/utils/memory.ts index f9371ee..50f10ba 100644 --- a/src/api/utils/memory.ts +++ b/src/api/utils/memory.ts @@ -4,7 +4,7 @@ export function leak(mb: number): void { if (!window.beelzejuice) { window.beelzejuice = []; //weird fanfic reference; i've seen this name used multiple times for alcoholic beverages } - const id = Math.random().toString(36).slice(2); + // const id = Math.random().toString(36).slice(2); window.beelzejuice.push( new Uint8Array(Math.floor(mb * 1024 * 1024)).fill(666) ); diff --git a/src/api/utils/modals.tsx b/src/api/utils/modals.tsx index e18364b..a76634d 100644 --- a/src/api/utils/modals.tsx +++ b/src/api/utils/modals.tsx @@ -9,7 +9,7 @@ const ConfirmModal = findByDisplayName("ConfirmModal"); const Markdown = findByDisplayNameAll("Markdown")[1]; function rawOpenConfirmModal( - component: any, + Component: any, props: any, insideProps: any, insideContent: any @@ -30,14 +30,17 @@ function rawOpenConfirmModal( (confirmed = false)} - //@ts-ignore - onCancel={() => (confirmed = false & e.onClose())} - //@ts-ignore - onConfirm={() => (confirmed = true & e.onClose())} + onCancel={() => { + confirmed = false; + e.onClose(); + }} + onConfirm={() => { + confirmed = true; + e.onClose(); + }} {...props} > - {/* @ts-ignore */} - {insideContent} + {insideContent} ); }); diff --git a/src/index.ts b/src/index.ts index 23be062..63d4fc7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -55,8 +55,4 @@ window.demon = { }; plugins.init(); -settings.init(); -/*//#if _ANALYTICS -import analytics from "./api/analytics" -analytics.init() -//#endif*/ +settings.init(); \ No newline at end of file