Skip to content

Commit 37f1aff

Browse files
committed
fix: create a Promise trap to prevent execution of anti-adblock script
1 parent ceb1889 commit 37f1aff

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@filteringdev/abb-kluncheon",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "",
55
"type": "module",
66
"scripts": {

sources/banner.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// @downloadURL https://cdn.jsdelivr.net/npm/@filteringdev/abb-kluncheon@latest/dist/abb-kluncheon.user.js
99
// @license Apache-2.0
1010
//
11-
// @version 1.0.0
11+
// @version 1.1.0
1212
// @author PiQuark6046 and contributors
1313
//
1414
// @match *://klauncher.kr/*

sources/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ declare const unsafeWindow: unsafeWindow
44

55
const Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window
66

7-
let AdblockDetectPositiveRegExps: RegExp[][] = [[
7+
let AdblockDetectInnerPromiseTrapRegExps: RegExp[][] = [[
88
/if *\( *typeof *window *\[ *\w+\( *\d+ *\) *\] *!== *\w+\( *\d+ *\) *\) *{/,
99
/const *\w+ *= *setTimeout *\( *\( *\) *=> *{/,
10-
/typeof *\w+ *!== *\w+ *\( *[\da-f]+ *\) *\|\| *\w+ *===? *void *0 *\|\| *\w+ *===? *null *\|\| *\w+ *===? *('|")+ *\)/
10+
/const *\w *= *window *\[ *\w *\( *\d+ *\) *\] *\[ *\w+ *\( *\d+ *\) *\] *\( *\) *;/,
11+
/ *\w+ *\( *! *\w+ *\|\| *\w+ *=== *"" *\) *} *catch *{ *clearTimeout *\( *\w+ *\) *, *\w+ *\( */
1112
]]
1213

1314
Win.Promise = new Proxy(Win.Promise, {
1415
construct(Target: typeof Promise, Args: ConstructorParameters<typeof Promise>) {
15-
if (typeof Args[0] === 'function' && AdblockDetectPositiveRegExps.filter(RegExpList => RegExpList.filter(Reg => Reg.test(Args[0].toString())).length >= 3).length === 1) {
16-
return new Promise(async () => {})
16+
if (typeof Args[0] === 'function' && AdblockDetectInnerPromiseTrapRegExps.filter(RegExpList => RegExpList.filter(Reg => Reg.test(Args[0].toString())).length >= 4).length === 1) {
17+
return Reflect.construct(Target, [() => {}])
1718
}
1819
return Reflect.construct(Target, Args)
1920
}

0 commit comments

Comments
 (0)