Skip to content

Commit

Permalink
Update modifiers compatibility table
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 2ad793f
Author: Adam Wróblewski <[email protected]>
Date:   Wed May 8 12:03:48 2024 +0200

    Update `$to` modifier

commit c8a7d67
Author: Adam Wróblewski <[email protected]>
Date:   Wed May 8 11:53:09 2024 +0200

    Rename defined variable to common_props

commit ba6622d
Author: Adam Wróblewski <[email protected]>
Date:   Wed May 8 11:42:18 2024 +0200

    Use re-useable blocks

commit 1fa6ad2
Author: Adam Wróblewski <[email protected]>
Date:   Wed May 8 10:11:14 2024 +0200

    Update modifiers compatibility table
    `$to` modifier is now supported by AdGuard
    `$replace` modifier is supported by uBlock Origin for Firefox
  • Loading branch information
AdamWr committed May 8, 2024
1 parent 3028ee0 commit 2a02638
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 41 deletions.
3 changes: 3 additions & 0 deletions packages/agtree/scripts/check-compatibility-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ for (const [globPattern, schema] of Object.entries(SCHEMA_MAP)) {
// In order to avoid type errors, we need to cast the schema to 'Struct<unknown>'.
// It is safe to do so because we don't use create()'s return value.
// TODO: Better way to do this? Is it necessary?
if (typeof data === 'object' && data !== null && 'define' in data) {
delete data.define;
}
ss.create(data, schema as ss.Struct<unknown>);
} catch (error: unknown) {
if (error instanceof Error) {
Expand Down
47 changes: 12 additions & 35 deletions packages/agtree/src/compatibility-tables/modifiers/replace.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
adg_os_any:
name: replace
define: &common_props
description: |-
This modifier completely changes the rule behavior.
If it is applied, the rule will not block the request. The response is going to be modified instead.
docs: https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier
conflicts:
- app
- domain
Expand Down Expand Up @@ -35,38 +33,17 @@ adg_os_any:
([gimuy]*)?
$
adg_os_any:
name: replace
docs: https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier
<<: *common_props

adg_ext_firefox:
name: replace
description: |-
This modifier completely changes the rule behavior.
If it is applied, the rule will not block the request. The response is going to be modified instead.
docs: https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier
conflicts:
- domain
- document
- subdocument
- script
- stylesheet
- other
- xmlhttprequest
- first-party
- third-party
- important
- badfilter
inverse_conflicts: true
assignable: true
negatable: false
value_format: |-
(?xi)
^
\/
# the regexp to match by
(.+)
# separator
\/
# replacement
(.+)?
\/
# flags
([gimuy]*)?
$
<<: *common_props

ubo_ext_firefox:
name: replace
docs: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#replace
<<: *common_props
27 changes: 21 additions & 6 deletions packages/agtree/src/compatibility-tables/modifiers/to.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# TODO: add adg_os_any after CoreLibs 1.13 release
# https://adguard.app/kb/general/ad-filtering/create-own-filters/#to-modifier
define:
- &common_props
name: to
conflicts:
- denyallow
assignable: true
negatable: false
value_format: pipe_separated_domains
- &common_adg_props
<<: *common_props
description: |-
`$to` limits the rule scope to requests made to the specified domains and their subdomains.
To add multiple domains to one rule, use the `|` character as a separator.
docs: https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier

adg_os_any:
<<: *common_adg_props

adg_ext_any:
<<: *common_adg_props

ubo_ext_any:
name: to
<<: *common_props
description: |-
The main motivation of this option is
to give static network filtering engine an equivalent of DNR's `requestDomains` and `excludedRequestDomains`.
docs: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#to
assignable: true
negatable: false
value_format: pipe_separated_domains

0 comments on commit 2a02638

Please sign in to comment.