@filteringdev/tinyshield 2.0.21 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -202
- package/README.ja.md +1 -4
- package/README.ko.md +1 -4
- package/README.md +1 -4
- package/dist/interface.js +9 -0
- package/dist/interface.js.map +2 -2
- package/dist/tinyshield.user.js +11395 -0
- package/dist/types/interface.d.ts +9 -0
- package/dist/types/src/as-weakmap.d.ts +9 -0
- package/dist/types/src/index.d.ts +9 -0
- package/dist/types/src/utils.d.ts +9 -0
- package/package.json +12 -6
- package/dist/tinyShield.user.js +0 -1653
package/README.md
CHANGED
|
@@ -15,11 +15,8 @@ If you believe this userscript is causing issues while in use, please use GitHub
|
|
|
15
15
|
> tinyShield userscript maintainer recommends using one of the following adblockers with tinyShield userscript:
|
|
16
16
|
> - AdGuard
|
|
17
17
|
> - uBlock Origin
|
|
18
|
-
> - Brave web browser's Shield
|
|
19
|
-
> - AdBlock Plus
|
|
20
|
-
> - Ghostery
|
|
21
18
|
>
|
|
22
|
-
> Supporting other adblockers is not guaranteed.
|
|
19
|
+
> Supporting other adblockers is not guaranteed and even if requested, it may be rejected.
|
|
23
20
|
|
|
24
21
|
### Quick Start
|
|
25
22
|
Just click the following URL to detect this userscript.
|
package/dist/interface.js
CHANGED
|
@@ -119,4 +119,13 @@ RunTinyShieldUserscript(Win);
|
|
|
119
119
|
export {
|
|
120
120
|
RunTinyShieldUserscript
|
|
121
121
|
};
|
|
122
|
+
/*!
|
|
123
|
+
* @license MPL-2.0
|
|
124
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
125
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
126
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
127
|
+
*
|
|
128
|
+
* Contributors:
|
|
129
|
+
* - See Git history at https://github.com/FilteringDev/tinyShield for detailed authorship information.
|
|
130
|
+
*/
|
|
122
131
|
//# sourceMappingURL=interface.js.map
|
package/dist/interface.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../sources/src/utils.ts", "../sources/src/as-weakmap.ts", "../sources/src/index.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/*!\n * @license MPL-2.0\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Contributors:\n * - See Git history at https://github.com/FilteringDev/tinyShield for detailed authorship information.\n */\n\nexport function CountCommonStrings(ArrayA: string[], ArrayB: string[]): number {\n let SetB = new Set(ArrayB)\n const Common = new Set(ArrayA.filter(Item => SetB.has(Item)))\n return Common.size\n}", "/*!\n * @license MPL-2.0\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Contributors:\n * - See Git history at https://github.com/FilteringDev/tinyShield for detailed authorship information.\n */\n\nimport * as Utils from './utils.js'\nimport { OriginalRegExpTest } from './index.js'\n\nexport function CheckDepthInASWeakMap(Args: [object, unknown]) {\n if (typeof Args[0] !== 'object') {\n return false\n }\n if (Utils.CountCommonStrings(['device', 'id', 'imp', 'regs', 'site', 'source'], Object.keys(Args[0])) < 5) {\n return false\n }\n\n let ASBannerFrameIdRegExp = /^[0-9]+\\/[a-zA-Z0-9]+\\/[a-zA-Z0-9]+\\/[a-z0-9-\\(\\)]+\\/[a-zA-Z0-9_]+_slot[0-9]+_+/\n let ASBannerFrameKey: string = Object.keys(Args[0]).find(Arg => typeof Args[0][Arg] === 'object' && Array.isArray(Args[0][Arg]) &&\n Args[0][Arg].filter(SubArg => typeof SubArg === 'object' && Object.keys(SubArg).filter(InnerArg => {\n return typeof InnerArg === 'string' && OriginalRegExpTest.call(ASBannerFrameIdRegExp, InnerArg) as boolean\n })).length >= 1)\n if (typeof ASBannerFrameKey === 'undefined') {\n return false\n }\n\n return true\n}", "/*!\n * @license MPL-2.0\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Contributors:\n * - See Git history at https://github.com/FilteringDev/tinyShield for detailed authorship information.\n */\n\ntype unsafeWindow = typeof window\n// eslint-disable-next-line @typescript-eslint/naming-convention\ndeclare const unsafeWindow: unsafeWindow\n\nconst Win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window\n\nimport { CheckDepthInASWeakMap } from './as-weakmap.js'\n\nexport const OriginalRegExpTest = Win.RegExp.prototype.test\n\nexport function RunTinyShieldUserscript(BrowserWindow: typeof window, UserscriptName: string = 'tinyShield'): void {\n const OriginalArrayToString = BrowserWindow.Array.prototype.toString\n const OriginalRegExpTest = BrowserWindow.RegExp.prototype.test\n\n const ProtectedFunctionStrings = ['toString', 'get', 'set']\n\n BrowserWindow.Function.prototype.toString = new Proxy(BrowserWindow.Function.prototype.toString, {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n apply(Target: () => string, ThisArg: Function, Args: null) {\n if (ProtectedFunctionStrings.includes(ThisArg.name)) {\n return `function ${ThisArg.name}() { [native code] }`\n } else {\n return Reflect.apply(Target, ThisArg, Args)\n }\n }\n })\n\n const ASInitPositiveRegExps: RegExp[][] = [[\n /[a-zA-Z0-9]+ *=> *{ *const *[a-zA-Z0-9]+ *= *[a-zA-Z0-9]+ *; *if/,\n /===? *[a-zA-Z0-9]+ *\\[ *[a-zA-Z0-9]+\\( *[0-9a-z]+ *\\) *\\] *\\) *return *[a-zA-Z0-9]+ *\\( *{ *('|\")?inventoryId('|\")? *:/,\n /{ *('|\")?inventoryId('|\")? *: *this *\\[[a-zA-Z0-9]+ *\\( *[0-9a-z]+ *\\) *\\] *, *\\.\\.\\. *[a-zA-Z0-9]+ *\\[ *[a-zA-Z0-9]+ *\\( *[0-9a-z]+ * *\\) *\\] *} *\\)/\n ]]\n BrowserWindow.Map.prototype.get = new Proxy(BrowserWindow.Map.prototype.get, {\n apply(Target: (key: unknown) => unknown, ThisArg: Map<unknown, unknown>, Args: [unknown]) {\n if (Args.length > 0 && typeof Args[0] !== 'function') {\n return Reflect.apply(Target, ThisArg, Args)\n }\n\n let ArgText = OriginalArrayToString.call(Args) as string\n if (ASInitPositiveRegExps.filter(ASInitPositiveRegExp => ASInitPositiveRegExp.filter(Index => OriginalRegExpTest.call(Index, ArgText) as boolean).length >= 2).length === 1) {\n console.debug(`[${UserscriptName}]: Map.prototype.get:`, ThisArg, Args)\n throw new Error()\n }\n\n return Reflect.apply(Target, ThisArg, Args)\n }\n })\n\n const ASReinsertedAdvInvenPositiveRegExps: RegExp[][] = [[\n /inventory_id,[a-zA-Z0-9-]+\\/[a-zA-Z0-9]+\\/[a-zA-Z0-9]+/,\n /inventory_id,[a-zA-Z0-9-]+\\/[a-zA-Z0-9]+\\/[a-zA-Z0-9]+/,\n /inventory_id,[a-zA-Z0-9-]+\\/[a-zA-Z0-9]+\\/[a-zA-Z0-9]+/\n ], [\n /[a-z0-9A-Z]+\\.setAttribute\\( *('|\")onload('|\") *, *('|\")! *async *function\\( *\\) *\\{ *let */,\n /confirm\\( *[A-Za-z0-9]+ *\\) *\\) *{ *const *[A-Za-z0-9]+ *= *new *[A-Za-z0-9]+\\.URL\\(('|\")https:\\/\\/report\\.error-report\\.com\\//,\n /\\.forEach *\\( *\\( *[A-Za-z0-9]+ *=> *[A-Za-z0-9]+\\.remove *\\( *\\) *\\) *\\) *\\) *, *[0-9a-f]+ *\\) *; *const *[A-Za-z0-9]+ *= *await *\\( *await *fetch *\\(/\n ]]\n BrowserWindow.Map.prototype.set = new Proxy(BrowserWindow.Map.prototype.set, {\n apply(Target: (key: unknown, value: unknown) => Map<unknown, unknown>, ThisArg: Map<unknown, unknown>, Args: [unknown, unknown]) {\n let ArgText = ''\n try {\n ArgText = OriginalArrayToString.call(Args) as string\n } catch {\n console.warn(`[${UserscriptName}]: Map.prototype.set:`, ThisArg, Args)\n }\n if (ASReinsertedAdvInvenPositiveRegExps.filter(ASReinsertedAdvInvenPositiveRegExp => ASReinsertedAdvInvenPositiveRegExp.filter(Index => OriginalRegExpTest.call(Index, ArgText) as boolean).length >= 3).length === 1) {\n console.debug(`[${UserscriptName}]: Map.prototype.set:`, ThisArg, Args)\n throw new Error()\n }\n return Reflect.apply(Target, ThisArg, Args)\n }\n })\n\n BrowserWindow.WeakMap.prototype.set = new Proxy(BrowserWindow.WeakMap.prototype.set, {\n apply(Target: (key: object, value: unknown) => WeakMap<object, unknown>, ThisArg: WeakMap<object, unknown>, Args: [object, unknown]) {\n if (CheckDepthInASWeakMap(Args)) {\n console.debug(`[${UserscriptName}]: WeakMap.prototype.set:`, ThisArg, Args)\n throw new Error()\n }\n\n return Reflect.apply(Target, ThisArg, Args)\n }\n })\n\n let ASTimerRegExps: RegExp[][] = [[\n /async *\\( *\\) *=> *{ *const *[A-Za-z0-9]+ *= *[A-Za-z0-9]+ *; *await *[A-Za-z0-9]+ *\\( *\\)/,\n /; *await *[A-Za-z0-9]+ *\\( *\\) *, *[A-Za-z0-9]+ *\\( *! *1 *, *new *Error *\\( *[A-Za-z0-9]+ *\\( *[0-9a-f]+ *\\) *\\) *\\) *}/,\n / *\\) *\\) *\\) *}/\n ]]\n BrowserWindow.setTimeout = new Proxy(BrowserWindow.setTimeout, {\n apply(Target: typeof BrowserWindow.setTimeout, ThisArg: undefined, Args: Parameters<typeof setTimeout>) {\n if (ASTimerRegExps.filter(ASTimerRegExp => ASTimerRegExp.filter(Index => Index.test(Args[0].toString())).length >= 3).length === 1) {\n console.debug(`[${UserscriptName}]: setTimeout:`, Args)\n return\n }\n return Reflect.apply(Target, ThisArg, Args)\n }\n })\n BrowserWindow.setInterval = new Proxy(BrowserWindow.setInterval, {\n apply(Target: typeof BrowserWindow.setInterval, ThisArg: undefined, Args: Parameters<typeof setInterval>) {\n if (ASTimerRegExps.filter(ASTimerRegExp => ASTimerRegExp.filter(Index => Index.test(Args[0].toString())).length >= 3).length === 1) {\n console.debug(`[${UserscriptName}]: setInterval:`, Args)\n return\n }\n return Reflect.apply(Target, ThisArg, Args)\n }\n })\n}\n\nRunTinyShieldUserscript(Win)"],
|
|
5
|
+
"mappings": ";AAUO,SAAS,mBAAmB,QAAkB,QAA0B;AAC7E,MAAI,OAAO,IAAI,IAAI,MAAM;AACzB,QAAM,SAAS,IAAI,IAAI,OAAO,OAAO,UAAQ,KAAK,IAAI,IAAI,CAAC,CAAC;AAC5D,SAAO,OAAO;AAChB;;;ACDO,SAAS,sBAAsB,MAAyB;AAC7D,MAAI,OAAO,KAAK,CAAC,MAAM,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAU,mBAAmB,CAAC,UAAU,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GAAG,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG;AACzG,WAAO;AAAA,EACT;AAEA,MAAI,wBAAwB;AAC5B,MAAI,mBAA2B,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE,KAAK,SAAO,OAAO,KAAK,CAAC,EAAE,GAAG,MAAM,YAAY,MAAM,QAAQ,KAAK,CAAC,EAAE,GAAG,CAAC,KAC5H,KAAK,CAAC,EAAE,GAAG,EAAE,OAAO,YAAU,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,EAAE,OAAO,cAAY;AACjG,WAAO,OAAO,aAAa,YAAY,mBAAmB,KAAK,uBAAuB,QAAQ;AAAA,EAChG,CAAC,CAAC,EAAE,UAAU,CAAC;AACjB,MAAI,OAAO,qBAAqB,aAAa;AAC3C,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACjBA,IAAM,MAAM,OAAO,iBAAiB,cAAc,eAAe;AAI1D,IAAM,qBAAqB,IAAI,OAAO,UAAU;AAEhD,SAAS,wBAAwB,eAA8B,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