CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
ProdigyPNP

CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.

GitHub Repository: ProdigyPNP/ProdigyMathGameHacking
Path: blob/master/PHEx/src/disableIntegrity.js
Views: 720
1
/**
2
* disableIntegrity.js
3
*
4
* Currently maintained by ProdigyPNP
5
* Original author: Prodigy-Hacking
6
* Contributors: hostedposted, gemsvido, Eris
7
* File has been updated for Manifest V3
8
*/
9
10
11
(async () => {
12
13
const browser = chrome || browser;
14
15
/** get an item from chrome local storage */
16
function get(key) {
17
return new Promise(resolve => {
18
browser.storage.local.get([key], result => {
19
resolve(result[key]);
20
});
21
});
22
}
23
24
/** Custom P-NP URL */
25
const url = await get("url");
26
27
/** Use Custom P-NP URL */
28
const checked = await get("checked");
29
30
/** RedirectorDomain */
31
const PNPURL = (url && checked) ? url : await (await fetch("https://infinitezero.net/domain")).text();
32
33
34
35
36
/*-----------------------------------------------*
37
* *
38
* INJECT GAME.MIN.JS *
39
* *
40
------------------------------------------------*/
41
42
async function insertCode () {
43
try {
44
/** P-NP Loader. If you're using a custom URL, then you have the ?force attribute. */
45
const request = await (await fetch(`https://infinitezero.net/eval${(url && checked) ? "?force=" + url : ""}`)).text();
46
document.documentElement.setAttribute("onreset", `${request}\nSW.Load.decrementLoadSemaphore();`);
47
document.documentElement.dispatchEvent(new CustomEvent("reset"));
48
document.documentElement.removeAttribute("onreset");
49
} catch (e) {
50
alert("Failed to load the hacks. Error:\n" + e.message);
51
}
52
}
53
54
55
56
57
58
/*-----------------------------------------------*
59
* *
60
* DISABLE INTEGRITY *
61
* *
62
------------------------------------------------*/
63
64
65
if (!window.scriptIsInjected) {
66
window.scriptIsInjected = true;
67
setTimeout(insertCode, 1000);
68
console.group("integrity patches");
69
[...document.getElementsByTagName("script"), ...document.getElementsByTagName("link")].forEach(v => {
70
if (v.integrity) {
71
console.log(v.integrity);
72
v.removeAttribute("integrity");
73
}
74
});
75
console.groupEnd();
76
}
77
78
79
80
81
82
83
/*-----------------------------------------------*
84
* *
85
* LATEST PHEx VERSION *
86
* *
87
------------------------------------------------*/
88
89
90
/** User's version of PHEx */
91
const pluginVersion = chrome.runtime.getManifest().version;
92
93
/** Latest version of PHEx. */
94
const supportedVersion = (await (await fetch(`${PNPURL}/version`)).text());
95
96
97
/** Checks for plugin version. If outdated, triggers dialog box */
98
if (pluginVersion !== supportedVersion) {
99
const res = confirm(`PHEx is outdated. If you experience any errors, please update.\n\Your Version: ${pluginVersion}\nLatest Version: ${supportedVersion}`);
100
if (res) { location = "https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/meta/wiki/UPDATING.md"; }
101
}
102
103
104
105
106
107
108
109
/*-----------------------------------------------*
110
* *
111
* CUSTOM LOADING TEXT *
112
* *
113
------------------------------------------------*/
114
115
/** Custom Loading Text Array */
116
const customLoadingText = await (await (await fetch("https://raw.githubusercontent.com/ProdigyPNP/P-NP/master/loadingText.txt")).text()).split("\n");
117
118
/** Which text to use */
119
var index = 0;
120
121
/** Update custom loading text index */
122
setInterval(() => {
123
index = Math.floor(Math.random() * customLoadingText.length);
124
}, 2000);
125
126
127
/** Override the loading text */
128
setInterval(() => {
129
const LT = document.getElementById("loading-text");
130
if (LT) LT.innerHTML = customLoadingText[index];
131
}, 100);
132
133
134
135
136
})();
137
138