Skip to content

Commit

Permalink
AG-31746 Move redirects compatibility tables to AGTree
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/tsurlfilter from fix/AG-31746-2 to master

Squashed commit of the following:

commit c4e588b
Merge: 5a521f6 b8ec1fa
Author: Stanislav Atroschenko <[email protected]>
Date:   Fri Apr 26 17:55:55 2024 +0300

    Merge branch 'master' into fix/AG-31746-2

commit 5a521f6
Author: Stanislav Atroschenko <[email protected]>
Date:   Fri Apr 26 17:41:18 2024 +0300

    ignore max len for anchor link line

commit ba4cdb5
Author: Stanislav Atroschenko <[email protected]>
Date:   Fri Apr 26 16:57:41 2024 +0300

    add todo to review redirects

commit 00fff20
Author: Stanislav Atroschenko <[email protected]>
Date:   Fri Apr 26 13:28:23 2024 +0300

    fix comment about apps not supporting redirects

commit 64eb9a1
Author: Stanislav Atroschenko <[email protected]>
Date:   Wed Apr 24 21:15:09 2024 +0300

    disallow duplicate aliases

commit 7cfd4a3
Author: Stanislav Atroschenko <[email protected]>
Date:   Wed Apr 24 20:52:10 2024 +0300

    format ymls

commit ab4da5e
Author: Stanislav Atroschenko <[email protected]>
Date:   Wed Apr 24 16:29:03 2024 +0300

    add todos about docs and descriptions

commit 658f685
Author: Stanislav Atroschenko <[email protected]>
Date:   Wed Apr 24 16:18:08 2024 +0300

    fix redirects readme

commit 1f7599b
Author: Stanislav Atroschenko <[email protected]>
Date:   Tue Apr 23 21:42:38 2024 +0300

    add redirects ymls (no docs)

commit b6e622d
Author: Stanislav Atroschenko <[email protected]>
Date:   Tue Apr 23 14:24:43 2024 +0300

    restore previously added redirects
  • Loading branch information
stanislav-atr committed Apr 26, 2024
1 parent b8ec1fa commit 3028ee0
Show file tree
Hide file tree
Showing 56 changed files with 609 additions and 0 deletions.
68 changes: 68 additions & 0 deletions packages/agtree/scripts/check-compatibility-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,77 @@ const SCHEMA_MAP = {
return 'deprecation_message is only allowed for deprecated modifiers';
}

if (config.aliases.length !== new Set(config.aliases).size) {
return 'Aliases must be unique';
}

return true;
},
)),

/**
* Check [## File structure](../src/compatibility-tables/redirects/README.md)
*/
'src/compatibility-tables/redirects/**.yml': ss.record(
platforms,
ss.refine(
ss.object({
name: ss.nonempty(ss.string()),
aliases: ss.defaulted(ss.array(ss.nonempty(ss.string())), []),
is_blocking: ss.defaulted(ss.boolean(), false),
description: ss.defaulted(ss.nullable(ss.string()), null),
docs: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
version_added: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
version_removed: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
deprecated: ss.defaulted(ss.boolean(), false),
deprecation_message: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
}),
'redirects',
(config) => {
if (config.aliases.length !== new Set(config.aliases).size) {
return 'Aliases must be unique';
}

return true;
},
),
),

/**
* Check [## File structure](../src/compatibility-tables/scriptlets/README.md)
*/
'src/compatibility-tables/scriptlets/**.yml': ss.record(
platforms,
ss.refine(
ss.object({
name: ss.nonempty(ss.string()),
aliases: ss.defaulted(ss.array(ss.nonempty(ss.string())), []),
description: ss.defaulted(ss.nullable(ss.string()), null),
docs: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
version_added: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
version_removed: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
debug: ss.defaulted(ss.boolean(), false),
deprecated: ss.defaulted(ss.boolean(), false),
deprecation_message: ss.defaulted(ss.nullable(ss.nonempty(ss.string())), null),
parameters: ss.defaulted(ss.array(ss.object({
name: ss.nonempty(ss.string()),
required: ss.boolean(),
description: ss.defaulted(ss.nullable(ss.string()), null),
pattern: ss.defaulted(ss.nullable(ss.string()), null),
default: ss.defaulted(ss.nullable(ss.string()), null),
debug: ss.defaulted(ss.boolean(), false),
})), []),
}),
'scriptlets',
(config) => {
if (config.aliases.length !== new Set(config.aliases).size) {
return 'Aliases must be unique';
}

return true;
},
),
),
};

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/agtree/src/compatibility-tables/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
need to optimize it before using it in the API.
- [ ] Create API endpoints for the tables.
- [ ] Wiki generation (`.md` files from the tables / gh-pages).
- [ ] Review redirects' aliases in compatibility table:
- [ ] check if `ubo-` and `abp-` prefixes should be deprecated,
<!-- markdownlint-disable MD013 -->
- [ ] make compatibility table does not miss any [ubo aliases](https://raw.githubusercontent.com/gorhill/uBlock/master/src/js/redirect-resources.js).
<!-- markdownlint-enable MD013 -->

## Linter rules

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: 1x1-transparent.gif
aliases:
- 1x1.gif
- 1x1-transparent-gif
description: Redirects to a 1x1 transparent GIF.
docs: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#1x1-transparent.gif

ubo_any:
name: 1x1.gif
description: Redirects to a 1x1 transparent GIF.
docs: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources

abp_any:
name: 1x1-transparent-gif
description: Redirects to a 1x1 transparent GIF.
docs: https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: 2x2-transparent.png
aliases:
- 2x2.png
- 2x2-transparent-png
description: Redirects to a 2x2 transparent PNG.
docs: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#2x2-transparent.png

ubo_any:
name: 2x2.png
description: Redirects to a 2x2 transparent PNG.
docs: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources

abp_any:
name: 2x2-transparent-png
description: Redirects to a 2x2 transparent PNG.
docs: https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: 32x32-transparent.png
aliases:
- 32x32.png
- 32x32-transparent-png
description: Redirects to a 32x32 transparent PNG.
docs: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#32x32-transparent.png

ubo_any:
name: 32x32.png
description: Redirects to a 32x32 transparent PNG.
docs: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources

abp_any:
name: 32x32-transparent-png
description: Redirects to a 32x32 transparent PNG.
docs: https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: 3x2-transparent.png
aliases:
- 3x2.png
- 3x2-transparent-png
description: Redirects to a 3x2 transparent PNG.
docs: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#3x2-transparent.png

ubo_any:
name: 3x2.png
description: Redirects to a 3x2 transparent PNG.
docs: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources

abp_any:
name: 3x2-transparent-png
description: Redirects to a 3x2 transparent PNG.
docs: https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite
26 changes: 26 additions & 0 deletions packages/agtree/src/compatibility-tables/redirects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Redirects compatibility tables

Each file represents a specific redirect. The file name is the name of the redirect. For example, `1x1-transparent.gif`
is represented by the file `1x1-transparent.gif.yml`.

## File structure

Each file contains an object, where the key is the
[actual adblocker ID](../README.md#supported-adblockers-and-platforms) and the value is the object
with the following fields:

<!-- markdownlint-disable MD013 -->
| Field | Description | Type | Default value |
| --- | --- | --- | --- |
| `name`\* | Name of the actual redirect. | `string` | |
| `aliases` | List of aliases for the redirect (if any). | `string[]` | `[]` (no aliases) |
| `is_blocking` | Whether the redirect is blocking. | `boolean` | `false` |
| `description` | Short description of the actual redirect. If not specified or it's value is `null`, then the description is not available. | `string\|null` | `null` |
| `docs` | Link to the documentation. If not specified or it's value is `null`, then the documentation is not available. | `string\|null` | `null` |
| `version_added` | The version of the adblocker when the redirect was added. | `string\|null` | `null` |
| `version_removed` | The version of the adblocker when the redirect was removed. | `string\|null` | `null` |
| `deprecated` | Describes whether the redirect is deprecated. | `boolean` | `false` |
| `deprecation_message` | Message that describes why the redirect is deprecated. If not specified or it's value is `null`, then the message is not available. It's value is omitted if the redirect is not marked as deprecated. | `string\|null` | `null` |
<!-- markdownlint-enable MD013 -->

\*: The field is required.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: amazon-apstag
aliases:
- ubo-amazon_apstag.js
- amazon_apstag.js
description: Mocks Amazon's apstag.js
docs: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#amazon-apstag

ubo_any:
name: amazon_apstag.js
description: Mocks Amazon's apstag.js
docs: https://github.com/gorhill/uBlock/wiki/Resources-Library#amazon_apstagjs-
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: add description and documentation reference
ubo_any:
name: amazon_ads.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: add description and documentation reference
ubo_any:
name: ampproject_v0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO: add description and documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: ati-smarttag
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: add description and documentation reference
ubo_any:
name: chartbeat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: click2load.html
aliases:
- click2load.html
- ubo-click2load.html
description: Redirects resource and replaces supposed content by decoy frame with button for original content recovering.
is_blocking: true

ubo_any:
name: click2load.html
description: Redirects resource and replaces supposed content by decoy frame with button for original content recovering.
is_blocking: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: didomi-loader
description: Mocks Didomi's CMP loader script.
8 changes: 8 additions & 0 deletions packages/agtree/src/compatibility-tables/redirects/empty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# TODO: add documentation reference
adg_any_not_cb:
name: empty
description: Redirects to an empty file.

ubo_any:
name: empty
description: Redirects to an empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: fingerprintjs2
aliases:
- fingerprint2.js
description: Mocks FingerprintJS2 script.

ubo_any:
name: fingerprint2.js
description: Mocks FingerprintJS2 script.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: fingerprintjs3
aliases:
- fingerprint3.js
description: Mocks FingerprintJS v3.

ubo_any:
name: fingerprint3.js
description: Mocks FingerprintJS v3.
5 changes: 5 additions & 0 deletions packages/agtree/src/compatibility-tables/redirects/gemius.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: gemius
description: Mocks Gemius Analytics.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: google-analytics-ga
aliases:
- ubo-google-analytics_ga.js
- google-analytics_ga.js
description: Mocks old Google Analytics API.

ubo_any:
name: google-analytics_ga.js
description: Mocks old Google Analytics API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: google-analytics
aliases:
- ubo-google-analytics_analytics.js
- google-analytics_analytics.js
- googletagmanager-gtm
- ubo-googletagmanager_gtm.js
- googletagmanager_gtm.js
description: Mocks Google's Analytics and Tag Manager APIs.

ubo_any:
name: google-analytics_analytics.js
description: Mocks Google's Analytics and Tag Manager APIs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: add description and documentation reference
ubo_any:
name: google-analytics_cx_api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: add description and documentation reference
ubo_any:
name: google-analytics_inpage_linkid.js
12 changes: 12 additions & 0 deletions packages/agtree/src/compatibility-tables/redirects/google-ima3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: google-ima3
aliases:
- ubo-google-ima.js
- google-ima.js
description: Mocks the IMA SDK of Google.

ubo_any:
name: google-ima.js
description: Mocks the IMA SDK of Google.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: googlesyndication-adsbygoogle
aliases:
- ubo-googlesyndication_adsbygoogle.js
- googlesyndication_adsbygoogle.js
description: Mocks Google AdSense API.

ubo_any:
name: googlesyndication_adsbygoogle.js
description: Mocks Google AdSense API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: googletagservices-gpt
aliases:
- ubo-googletagservices_gpt.js
- googletagservices_gpt.js
description: Mocks Google Publisher Tag API.

ubo_any:
name: googletagservices_gpt.js
description: Mocks Google Publisher Tag API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: add description and documentation reference
ubo_any:
name: hd-main.js
5 changes: 5 additions & 0 deletions packages/agtree/src/compatibility-tables/redirects/matomo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: matomo
description: Mocks the piwik.js file of Matomo (formerly Piwik).
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: metrika-yandex-tag
description: Mocks Yandex Metrika API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: metrika-yandex-watch
description: Mocks the old Yandex Metrika API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: naver-wcslog
description: Mocks wcslog.js of Naver Analytics.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: no-protected-audience
description: Prevents using the Protected Audience API.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TODO: add documentation reference
# Note: content blocking products do not support redirects
adg_any_not_cb:
name: no-topics
description: Prevents using the Topics API.
Loading

0 comments on commit 3028ee0

Please sign in to comment.