fix: anti-detection hook

This commit is contained in:
Xmader 2020-11-05 23:27:51 -05:00
parent 49c42eeda9
commit 6c283ba050
1 changed files with 8 additions and 3 deletions

View File

@ -15,7 +15,7 @@ export const makeNative = (() => {
} }
return _toString.call(this) as string return _toString.call(this) as string
} }
}) }, true)
return (fn: Function) => { return (fn: Function) => {
l.add(fn) l.add(fn)
@ -26,6 +26,7 @@ export function hookNative<T extends object, M extends (keyof T)> (
target: T, target: T,
method: M, method: M,
hook: (originalFn: T[M], detach: () => void) => T[M], hook: (originalFn: T[M], detach: () => void) => T[M],
async = false,
): void { ): void {
// reserve for future hook update // reserve for future hook update
const _fn = target[method] const _fn = target[method]
@ -38,9 +39,13 @@ export function hookNative<T extends object, M extends (keyof T)> (
const hookedFn = hook(_fn, detach) const hookedFn = hook(_fn, detach)
target[method] = hookedFn target[method] = hookedFn
setTimeout(() => { if (!async) {
makeNative(hookedFn as any) makeNative(hookedFn as any)
}) } else {
setTimeout(() => {
makeNative(hookedFn as any)
})
}
} }
export const hideFromArrFilter = (() => { export const hideFromArrFilter = (() => {