// ==UserScript== // @name webpack-patcher // @namespace http://tampermonkey.net/ // @version 2025-05-22 // @description Patches webpack modules // @author Vendicated, Arjix // @match https://www.cineby.app/* // @icon https://www.google.com/s2/favicons?sz=64&domain=cineby.app // @grant none // @run-at document-start // ==/UserScript== const patches = [ { find: /detectors:\[(\d,?)+\]/, replacement: [ { match: /detectors:\[(\d,?)+\]/, replace: "detectors:[]" }, { match: "clearLog:!0,", replace: "clearLog:false," } ] } ]; /// ======== Do not touch the below! ======== let wreq; const values = o => (Array.isArray(o) ? o : Object.values(o)); function extractPrivateCache(wreq) { let cache = null; const sym = Symbol("wpgrabber.extract"); Object.defineProperty(Object.prototype, sym, { get() { cache = this; return { exports: {} }; }, set() { }, configurable: true, }) wreq(sym); delete Object.prototype[sym]; if (cache) delete cache[sym]; return cache; } Object.defineProperty(Function.prototype, "m", { set(v) { const source = this.toString(); if ( source.includes("exports") && (source.includes("false") || source.includes("!1")) && !(Array.isArray(v) && v?.some(m => m.toString().includes("CHROME_WEBSTORE_EXTENSION_ID"))) // react devtools ) { Object.defineProperty(this, "m", { value: v, configurable: true, enumerable: true, writable: true }); patchFactories(v); delete Function.prototype.m; this.m = v; console.log( "%c%s%c %s %c%s", "background-color: #babbf1; color: black; border-radius: 4px; padding: 2px 4px; font-weight: bold;", "WebpackGrabber", "", "Found webpack_require! Check out", "font-weight: 600", "window.WEBPACK_GRABBER" ); } else { // huh not webpack_require Object.defineProperty(this, "m", { value: v, configurable: true, writable: true, enumerable: true }); } }, configurable: true, }); function patchPush(webpackGlobal) { function handlePush(chunk) { try { patchFactories(chunk[1]); } catch (err) { console.error("Error in handlePush", err); } return handlePush.$$vencordOriginal.call(webpackGlobal, chunk); } handlePush.$$vencordOriginal = webpackGlobal.push; handlePush.toString = handlePush.$$vencordOriginal.toString.bind(handlePush.$$vencordOriginal); handlePush.bind = (...args) => handlePush.$$vencordOriginal.bind(...args); Object.defineProperty(webpackGlobal, "push", { configurable: true, get: () => handlePush, set(v) { handlePush.$$vencordOriginal = v; } }); } function patchFactories(factories) { for (const id in factories) { let mod = factories[id]; const originalMod = mod; const factory = factories[id] = function (module, exports, require) { try { mod(module, exports, require); } catch (e) { if (mod === originalMod) throw e; console.error("Error in patched module", e); return void originalMod(module, exports, require); } exports = module.exports; if (!exports) return; } factory.toString = originalMod.toString.bind(originalMod); factory.original = originalMod; let code = "0," + mod.toString(); for (let i=0; i