ProdigyPNP / ProdigyMathGameHacking

Hacking Prodigy, the math game.
https://prodigypnp.com
Mozilla Public License 2.0
40 stars 62 forks source link

[B] Cheat Menu always loads from a static URL. #15

Closed afkvido closed 2 years ago

afkvido commented 2 years ago

Actual Behavior

Cheat Menu always loads from a static URL.

Expected Behavior

Cheat Menu will load from the URL specified in P-NP. At ProdigyPNP/P-NP/dist/util.js, line 18 and 19.

Location

At ProdigyPNP/ProdigyMathGameHacking/willsCheatMenu/src/hacks/utility.ts, line 91.

I know the fix

In P-NP, add another URL export at [pnpDomain]/cheatmenu.



In ProdigyMathGameHacking, load the cheat menu like this:

javascript:


const cmu = // get the cheat menu URL from [pnpDomain]/cheatmenu

(async () => {
        eval(await (await fetch(`${cmu}?updated=${Date.now()}`)).text()); // updated parameter is so browser ignores cached version
    })();
Erisfiregamer1 commented 2 years ago

Status on this?

afkvido commented 2 years ago

In theory, P-NP decides which cheat menu to load... however if someone is trying to use our cheat menu (cheatGUI) but it's self-hosted, that should be their issue.

However, I believe that the fix is to append a line of code in the P-NP output (game.min.js) which says something like:

const PNPURL = "https://p-np.prodigypnp.repl.co";

Then, we can substitute the line in Update Menu to load from PNPURL.