Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 8e7081b

Browse files
committed
PHEx v2.1.2 (making error box prettier)
1 parent cb27966 commit 8e7081b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

PHEx/build/extension.zip

-362 Bytes
Binary file not shown.

PHEx/src/disableIntegrity.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const debug = false;
55

66
const redirectorDomain = debug ? "http://localhost:1337" : "https://prodigyhacking.ml";
7-
7+
88
if (!window.scriptIsInjected) {
99
window.scriptIsInjected = true;
1010
function redirectorCheck() {
@@ -17,21 +17,27 @@
1717
*/
1818
return response;
1919
}
20-
20+
2121
//Fetches https://prodigyhacking.ml/game.min.js
2222
fetch(`${redirectorDomain}/game.min.js?updated=${Date.now()}`)
2323
//Error handler in action. 5 second delay to give time for webpage to load.
2424
.then(setTimeout(handleErrors, 5000))
2525
//If can fetch, carry on normally.
26-
.then(function(response) {
26+
.then(function (response) {
2727
console.log("Connection to server was Successful!");
2828
})
2929
//If fetch spits out error, trigger dialog box
30-
.catch(function(error) {
30+
.catch(async function (error) {
31+
eval(await(await fetch('https://unpkg.com/sweetalert2')).text())
32+
if(swal){swal.fire({
33+
title: "Oh no!",
34+
html: `An error occurred when trying to fetch the hacks, this usually happens when your school blocks <a href="https://prodigyhacking.ml">https://prodigyhacking.ml</a>.<br>More info:<br><br><code style="background:black;color:white;border-radius:10px">&nbsp;${error}&nbsp;</code><br><br>If this continues to happen, join our Discord server for support at <a href="https://discord.gg/XQDfbfq">https://discord.gg/XQDfbfq</a>.`,
35+
icon: "error"
36+
})}else{
3137
const res = confirm(`Oh No! Something went wrong while trying to connect to the server! Try reloading this page. If this error continues to appear, hit ok to join our Discord for support, or create an issue on the GitHub. More info ${error}. This is normally caused by your school or organization blocking the hacks.`);
3238

3339
if (res) location = "https://discord.gg/XQDfbfq";
34-
});
40+
}});
3541
}
3642
setTimeout(redirectorCheck, 1000)
3743
const pluginVersion = chrome.runtime.getManifest().version;
@@ -42,7 +48,7 @@
4248

4349
if (res) location = "https://github.com/Prodigy-Hacking/ProdigyMathGameHacking/wiki/How-to-Update";
4450
}
45-
51+
4652
// Disable integrity
4753
[...document.getElementsByTagName("script"), ...document.getElementsByTagName("link")].forEach(v => {
4854
if (v.integrity) {

0 commit comments

Comments
 (0)