From 8180d5170b877faa63c09a9186cb3f23e7d697b9 Mon Sep 17 00:00:00 2001 From: Nikita Gorskikh Date: Thu, 1 Feb 2024 22:51:58 +0300 Subject: [PATCH 1/4] Update documentation --- docs/general/ad-filtering/create-own-filters.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 13c3782e75a..8bc6f8f0cd1 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -1715,8 +1715,11 @@ In case if multiple `$permissions` rules match a single request, AdGuard will ap **Syntax** -`$permissions` value syntax is similar to the `Permissions-Policy` header [syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy) with one exception: comma that separates several features **MUST** be escaped — see examples below. -The list of the available directives is available [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#directives). +`$permissions` value syntax is identical to that of the `Permissions-Policy` header [syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy) with the following exceptions: +1. A comma that separates multiple features **MUST** be escaped — see examples below. +2. A pipe character (`|`) can be used to separate features instead of a comma. + +The list of available directives is available [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#directives). `$permissions` value can be empty in the case of exception rules — see examples below. @@ -1726,6 +1729,7 @@ The list of the available directives is available [here](https://developer.mozil - `@@||example.org/page/*$permissions=autoplay=()` disables all rules with the `$permissions` modifier exactly matching `autoplay=()` on all the pages matching the rule pattern. For instance, the rule above. - `@@||example.org/page/*$permissions` disables all the `$permissions` rules on all the pages matching the rule pattern. - `$domain=example.org|example.com,permissions=storage-access=()\, camera=()` disallows using the Storage Access API to request access to unpartitioned cookies and using video input devices across `example.org` and `example.com`. +- `$domain=example.org|example.com,permissions=storage-access=()|camera=()` does the same -- a `|` can be used to separate the features instead of an escaped comma. - `@@||example.org^$document` or `@@||example.org^$urlblock` disables all the `$permission` rules on all the pages matching the rule pattern. :::caution Restrictions From cc3aab2dbc797db5dab73311457633069523ca2e Mon Sep 17 00:00:00 2001 From: Nikita Gorskikh Date: Tue, 13 Feb 2024 13:00:32 +0300 Subject: [PATCH 2/4] Add a warning about content-type modifiers, fix a dash symbol --- docs/general/ad-filtering/create-own-filters.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 8bc6f8f0cd1..10a243a1a66 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -1729,13 +1729,14 @@ The list of available directives is available [here](https://developer.mozilla.o - `@@||example.org/page/*$permissions=autoplay=()` disables all rules with the `$permissions` modifier exactly matching `autoplay=()` on all the pages matching the rule pattern. For instance, the rule above. - `@@||example.org/page/*$permissions` disables all the `$permissions` rules on all the pages matching the rule pattern. - `$domain=example.org|example.com,permissions=storage-access=()\, camera=()` disallows using the Storage Access API to request access to unpartitioned cookies and using video input devices across `example.org` and `example.com`. -- `$domain=example.org|example.com,permissions=storage-access=()|camera=()` does the same -- a `|` can be used to separate the features instead of an escaped comma. +- `$domain=example.org|example.com,permissions=storage-access=()|camera=()` does the same — a `|` can be used to separate the features instead of an escaped comma. - `@@||example.org^$document` or `@@||example.org^$urlblock` disables all the `$permission` rules on all the pages matching the rule pattern. :::caution Restrictions -1. Characters forbidden in the `$permissions` value: `$` -1. `$permissions` is compatible with the limited list of modifiers: `$domain`, `$important`, and `$subdocument` +1. Characters forbidden in the `$permissions` value: `$`. +2. `$permissions` is compatible with a limited set of modifiers: `$domain`, `$important`, `$subdocument`, and the [content type modifiers](#content-type-modifiers). +3. `$permissions` rules that do not have any [content type modifiers](#content-type-modifiers) will match only requests where content type is `document`. ::: From 4dcf4f7d0a9e933e02adf87884e134d4af2cb2d7 Mon Sep 17 00:00:00 2001 From: Nikita Gorskikh Date: Tue, 27 Feb 2024 13:34:15 +0300 Subject: [PATCH 3/4] Edit --- docs/general/ad-filtering/create-own-filters.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 10a243a1a66..68fc5e0f421 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -1735,8 +1735,8 @@ The list of available directives is available [here](https://developer.mozilla.o :::caution Restrictions 1. Characters forbidden in the `$permissions` value: `$`. -2. `$permissions` is compatible with a limited set of modifiers: `$domain`, `$important`, `$subdocument`, and the [content type modifiers](#content-type-modifiers). -3. `$permissions` rules that do not have any [content type modifiers](#content-type-modifiers) will match only requests where content type is `document`. +2. `$permissions` is compatible with a limited set of modifiers: `$domain`, `$important`, `$subdocument`, and [content-type modifiers](#content-type-modifiers). +3. `$permissions` rules that do not have any [content-type modifiers](#content-type-modifiers) will match only requests where content type is `document`. ::: From f8d06dcee6de69f7e6d356a925205fedac25809e Mon Sep 17 00:00:00 2001 From: Nikita Gorskikh Date: Fri, 26 Jul 2024 23:15:06 +0300 Subject: [PATCH 4/4] Make linter shut up --- docs/general/ad-filtering/create-own-filters.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 76dde8a2d6f..a20b2770b72 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -1955,6 +1955,7 @@ For the requests matching a `$permissions` rule, AdGuard strengthens response's **Syntax** `$permissions` value syntax is identical to that of the `Permissions-Policy` header [syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy) with the following exceptions: + 1. A comma that separates multiple features **MUST** be escaped — see examples below. 2. A pipe character (`|`) can be used to separate features instead of a comma.