AdguardTeam / AdguardTeam/Scriptlets

Access to the compatibility table via the Scriptlet API

未关闭
#237 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
195
派生
33
PR 合并指标
30 天内没有已合并 PR

描述

TSUrlFilter issue reference: https://github.com/AdguardTeam/tsurlfilter/issues/60

Compatibility table contains **ALL** ABP/uBO scriptlets, _even if AdGuard doesn't yet support one of them_. However, the API currently only allows to determine whether a scriptlet is supported by Adguard or not. This function is called `isValidScriptletRule`. This function is also [used by](https://github.com/AdguardTeam/tsurlfilter/blob/d5d820d315e362e44d74890ecc3203d87baf6ba6/packages/tsurlfilter/src/rules/rule-converter.ts#L190) the TSUrlFilter converter.

Take the example below:
```ts
RuleConverter.convertRule('ebay.com#$#hide-if-contains-visible-text /Sponsored/ div[aria-label] div[class]');
```
This will produce the following array (i.e. the rule remains unchanged, since `hide-if-contains-visible-text` isn't supported by ADG):
```ts
['ebay.com#$#hide-if-contains-visible-text /Sponsored/ div[aria-label] div[class]']
```
If we pass this rule to `RuleFactory.createRule`, it will detect it as a bad CSS injection rule. After all, the unsupported rule is not created, only an incorrect error message is displayed.

**I think it would be a good idea to somehow make the compatibility table available through the API.** This would increase compatibility and make the above case also solvable, since it could be checked if a script exists (the compatibility table contains ALL scriptlets) but not supported by ADG. For example, `hide-if-contains-visible-text` is a valid ABP scriptlet, only ADG does not support it yet.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。