diff --git a/lib/init/src/index.ts b/lib/init/src/index.ts index c71e3b9..781fc2c 100644 --- a/lib/init/src/index.ts +++ b/lib/init/src/index.ts @@ -1,6 +1,6 @@ import './preinit' -import './patches/prevent-immutablize' +import './patches/prevent-freeze' import './patches/proxy' import { onModuleFirstRequired, onModuleInitialized } from '@revenge-mod/modules/metro/subscriptions' diff --git a/lib/init/src/patches/prevent-immutablize.ts b/lib/init/src/patches/prevent-freeze.ts similarity index 74% rename from lib/init/src/patches/prevent-immutablize.ts rename to lib/init/src/patches/prevent-freeze.ts index f4b9134..1250a72 100644 --- a/lib/init/src/patches/prevent-immutablize.ts +++ b/lib/init/src/patches/prevent-freeze.ts @@ -5,4 +5,5 @@ // Retain reference to the functions so the actual functions can be used later import '@revenge-mod/utils/functions' -Object.freeze = Object.seal = Object.preventExtensions = o => o +// Discord only uses Object.freeze +Object.freeze = (o: any) => o diff --git a/lib/utils/src/functions.ts b/lib/utils/src/functions.ts index 54a18a9..0ef8e30 100644 --- a/lib/utils/src/functions.ts +++ b/lib/utils/src/functions.ts @@ -1,6 +1,4 @@ // This file is imported before the functions are modified export const objectFreeze = Object.freeze -export const objectSeal = Object.seal -export const objectPreventExtensions = Object.preventExtensions export const objectDefineProperty = Object.defineProperty diff --git a/lib/utils/src/objects.ts b/lib/utils/src/objects.ts index 55d497f..93b55fd 100644 --- a/lib/utils/src/objects.ts +++ b/lib/utils/src/objects.ts @@ -1,8 +1,10 @@ -import { objectDefineProperty as defineProperty } from './functions' +// Retain reference to original functions +import './functions' // Heavily inspired by uwu/shelter // https://github.com/uwu/shelter/blob/main/packages/shelter/src/exfiltrate.ts +const defineProperty = Object.defineProperty // Patch to fix intercepting properties on Object.prototype Object.defineProperty = (target, p, d) => { if (target === Object.prototype && _intercepting.has(p)) {