mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Added "trusted-replace-outbound-text" description + updated "trusted-set-local-storage-item' description"
parent
7d45ffc1cf
commit
296e68c505
1 changed files with 43 additions and 3 deletions
|
|
@ -42,6 +42,7 @@
|
|||
- [remove-class](#remove-classjs-) _(rc)_
|
||||
- [remove-node-text](#remove-node-textjs-) _(rmnt)_
|
||||
- [trusted-replace-node-text](#trusted-replace-node-textjs-) _(trusted-rpnt)_ [Trusted]
|
||||
- [trusted-replace-outbound-text](#trusted-replace-outbound-textjs-) _(trusted-rpot)_ [Trusted]
|
||||
- [spoof-css](#spoof-cssjs-)
|
||||
- [href-sanitizer](#href-sanitizerjs-)
|
||||
- [disable-newtab-links](#disable-newtab-linksjs-)
|
||||
|
|
@ -865,6 +866,42 @@ Also see: [trusted-replace-node-text](#trusted-replace-node-textjs-)
|
|||
|
||||
***
|
||||
|
||||
### trusted-rpot.js /
|
||||
### trusted-replace-outbound-text.js [↪](https://github.com/gorhill/uBlock/blob/21e1ee30ee36c1b9a7a3c9f43ac97e52d8e79661/assets/resources/scriptlets.js#L4708)
|
||||
|
||||
#### _Trusted scriptlet_
|
||||
|
||||
New in [1.57.1b1](https://github.com/gorhill/uBlock/commit/21e1ee30ee)
|
||||
|
||||
(currently alias `trusted-rpot` is unsupported yet)
|
||||
|
||||
Intercepts atob call and prunes its text output.
|
||||
|
||||
Parameters:
|
||||
- required, a name of method for which the text content must be substituted
|
||||
- required, a string or regex to match in the outbound text as the target of substitution,
|
||||
if not provided or empty, the scriptlet will only log the outbound text without modifying it.
|
||||
- optional, the replacement string for the matched part,
|
||||
can be omitted if the goal is to delete the text which matches the pattern.
|
||||
|
||||
Examples:
|
||||
- `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify)` (logging only)
|
||||
- `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify, '/"csrf_token":"[^"]+",/')`
|
||||
matches and removes: `"csrf_token":"ed5ce21c7d7c95c8662c7844c0f4a4dc",` from the whole JSON payload
|
||||
- `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify, '/(?<="csrf_token":")[^"]+?(?=")/'` or
|
||||
`www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify, '/("csrf_token":")(?:[^"]+?)(")/', /$1$2/)`
|
||||
matches `ed5ce21c7d7c95c8662c7844c0f4a4dc` or any similiar value in `"csrf_token":"..."` and removes it resulting in empty value: `"csrf_token":""`
|
||||
- `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify, '/(?<="adblock":{"enabled":)true/', false)`
|
||||
matches `true` in `"adblock":{"enabled":true` and replaces it with `false` resulting in a new spoofed value: `"adblock":{"enabled":false`
|
||||
|
||||
Solves related issues / discussions:
|
||||
- [Add a scriptlet to intercept atob call and prune its text output](https://github.com/uBlockOrigin/uBlock-issues/issues/3157)
|
||||
- [Add new scriptlet — 'trusted-replace-outbound-text'](https://github.com/AdguardTeam/Scriptlets/issues/410)
|
||||
- [reddit.com: privacy](https://github.com/uBlockOrigin/uAssets/issues/18938)
|
||||
- [trusted-replace-outbound-text](https://github.com/uBlockOrigin/uBlock-issues/discussions/3292)
|
||||
|
||||
***
|
||||
|
||||
### href-sanitizer.js [↪](https://github.com/gorhill/uBlock/blob/d7b7dea7faaf17486d5c54454852c4a117f50fd1/assets/resources/scriptlets.js#L1845)
|
||||
|
||||
#### _Experimental_
|
||||
|
|
@ -1176,9 +1213,12 @@ Parameters:
|
|||
- required, key name to be set.
|
||||
- required, key value; possible values:
|
||||
- arbitrary value
|
||||
- `$now$`: keyword for setting current time in ms, corresponds to `Date.now()` and `(new Date).getTime()` calls
|
||||
- `$currentDate$`: keyword for setting string representation of the current date and time, corresponds to `Date()` and `(new Date).toString()` calls
|
||||
- `$currentISODate$`: keyword for setting string representation of the current date and time in ISO format, corresponds to `Date()` and `(new Date).toISOString()` calls
|
||||
- `$now$`: keyword for setting current time in ms,
|
||||
corresponds to `Date.now()` and `(new Date).getTime()` calls, can be used inside a string since [1.57.3b8](https://github.com/gorhill/uBlock/commit/2ccc3135c1)
|
||||
- `$currentDate$`: keyword for setting string representation of the current date and time,
|
||||
corresponds to `Date()` and `(new Date).toString()` calls, can be used inside a string since [1.57.3b8](https://github.com/gorhill/uBlock/commit/2ccc3135c1)
|
||||
- `$currentISODate$`: keyword for setting string representation of the current date and time in ISO format,
|
||||
corresponds to `Date()` and `(new Date).toISOString()` calls, can be used inside a string since [1.57.3b8](https://github.com/gorhill/uBlock/commit/2ccc3135c1)
|
||||
|
||||
Examples:
|
||||
- `example.com##+js(trusted-set-local-storage-item, COOKIE_CONSENTS, {"preferences":3\,"flag":false})`
|
||||
|
|
|
|||
Loading…
Reference in a new issue