CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.
CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.
Path: blob/master/PHEx/firefox/disableIntegrity.js
Views: 720
/**1* disableIntegrity.js2*3* Currently maintained by ProdigyPNP4* Original author: Prodigy-Hacking5* Contributors: hostedposted, gemsvido, Eris6* File has been updated for Firefox7*/89(async () => {1011/** Get an item from the browser local storage. */12function get(key) {13return new Promise(resolve => {14browser.storage.local.get([key], result => {15resolve(result[key]);16});17});18}1920/** Custom P-NP URL from popup.js */21const url = await get("url");2223/** Use Custom P-NP URL. */24const checked = await get("checked");2526/** P-NP URL to use. Code: (If url exists and checked is true, then use url. Else, get a domain from infinite zero.) */27const redirectorDomain = (url && checked) ? url : (await (await fetch("https://infinitezero.net/domain")).text()).valueOf();2829303132/*-----------------------------------------------*33* *34* INJECT GAME.MIN.JS *35* *36------------------------------------------------*/373839async function insertCode () {40try {41/** P-NP Loader. If you're using a custom URL, then you have the ?force attribute. */42const request = await (await fetch(`https://infinitezero.net/eval${(url && checked) ? "?force=" + url : ""}`)).text();43document.documentElement.setAttribute("onreset", `${request}\nSW.Load.decrementLoadSemaphore();`);44document.documentElement.dispatchEvent(new CustomEvent("reset"));45document.documentElement.removeAttribute("onreset");46} catch (e) {47alert("Failed to load the hacks. Error:\n" + e.message);48}49}5051if (!window.scriptIsInjected) {525354insertCode().catch((err) => {55swal.fire({56title: "Could not insert gamemin",57html: err,58icon: "error"59});60});616263646566/*-----------------------------------------------*67* *68* LATEST PHEx VERSION *69* *70------------------------------------------------*/717273/** User's version of PHEx */74const pluginVersion = browser.runtime.getManifest().version;7576/** Latest version of PHEx. */77const supportedVersion = (await (await fetch(`${redirectorDomain}/version`)).text());787980/** Checks for plugin version. If outdated, triggers dialog box */81if (pluginVersion !== supportedVersion) {82const res = confirm(`PHEx is outdated. If you experience any errors, please update.\n\Your Version: ${pluginVersion}\nLatest Version: ${supportedVersion}`);83if (res) location = "https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/meta/wiki/UPDATING.md";84}858687888990/*-----------------------------------------------*91* *92* DISABLE INTEGRITY *93* *94------------------------------------------------*/959697/** Remove integrity attributes from scripts and links. */98console.groupCollapsed("[PHEx] integrity patches");99[...document.getElementsByTagName("script"), ...document.getElementsByTagName("link")].forEach(element => {100if (element.hasAttribute("integrity")) {101console.log("[PHEx] " + element.getAttribute("integrity"));102element.removeAttribute("integrity");103}104});105console.groupEnd("[PHEx] integrity patches");106/** End disable integrity */107108109110111/** Script is now injected. */112window.scriptIsInjected = true;113}114})();115116117