|
4 | 4 | const debug = false; |
5 | 5 |
|
6 | 6 | const redirectorDomain = debug ? "http://localhost:1337" : "https://prodigyhacking.ml"; |
7 | | - |
| 7 | + |
8 | 8 | if (!window.scriptIsInjected) { |
9 | 9 | window.scriptIsInjected = true; |
10 | 10 | function redirectorCheck() { |
|
17 | 17 | */ |
18 | 18 | return response; |
19 | 19 | } |
20 | | - |
| 20 | + |
21 | 21 | //Fetches https://prodigyhacking.ml/game.min.js |
22 | 22 | fetch(`${redirectorDomain}/game.min.js?updated=${Date.now()}`) |
23 | 23 | //Error handler in action. 5 second delay to give time for webpage to load. |
24 | 24 | .then(setTimeout(handleErrors, 5000)) |
25 | 25 | //If can fetch, carry on normally. |
26 | | - .then(function(response) { |
| 26 | + .then(function (response) { |
27 | 27 | console.log("Connection to server was Successful!"); |
28 | 28 | }) |
29 | 29 | //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"> ${error} </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{ |
31 | 37 | 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.`); |
32 | 38 |
|
33 | 39 | if (res) location = "https://discord.gg/XQDfbfq"; |
34 | | - }); |
| 40 | + }}); |
35 | 41 | } |
36 | 42 | setTimeout(redirectorCheck, 1000) |
37 | 43 | const pluginVersion = chrome.runtime.getManifest().version; |
|
42 | 48 |
|
43 | 49 | if (res) location = "https://github.com/Prodigy-Hacking/ProdigyMathGameHacking/wiki/How-to-Update"; |
44 | 50 | } |
45 | | - |
| 51 | + |
46 | 52 | // Disable integrity |
47 | 53 | [...document.getElementsByTagName("script"), ...document.getElementsByTagName("link")].forEach(v => { |
48 | 54 | if (v.integrity) { |
|
0 commit comments