AdguardTeam / AdGuardMV3

AdGuard browser extension prototype based on the new Manifest V3
https://adguard.com/
GNU General Public License v3.0
144 stars 13 forks source link

Will it be possible to use the mv3 version of the extension as the basis for my ad blocker, just like in mv2 and how? #13

Closed Eugene706 closed 1 year ago

105th commented 2 years ago

@Eugene706 Yes, I think it is possible because the license is the same as in the MV2 extension we updated the license, you can read it here - https://github.com/AdguardTeam/AdGuardMV3/blob/master/LICENSE

Eugene706 commented 2 years ago

@105th Is there any instruction on how to set your own rules for the extension? Like this in MV2 - https://github.com/AdguardTeam/AdguardBrowserExtension/blob/master/Extension/api/sample-extension/adguard-api.md

Rutuj-Runwal commented 2 years ago

@105th Is there any instruction on how to set your own rules for the extension? Like this in MV2 - https://github.com/AdguardTeam/AdguardBrowserExtension/blob/master/Extension/api/sample-extension/adguard-api.md

MV3 uses declarativeNet Request and every rule has a unique id and rules with duplicate id's are not allowed so the method to declare them will be programmatically a little different. You can however add rules for the settings/options page directly. It supports nearly all parameters mentioned in https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters

Eugene706 commented 2 years ago

@Rutuj-Runwal I thought only network rules use declarativeNetRequest

Rutuj-Runwal commented 2 years ago

@Rutuj-Runwal I thought only network rules use declarativeNetRequest

Yes only network rules are governed by declarativeNetRequest. Cosmetic filters are handled separately and they follow the rules mentioned in the link that I shared in the discussion above.

Eugene706 commented 2 years ago

@Rutuj-Runwal My question was to which function in the code of the extension I need to pass these rules in order to see the result of their execution on the page

105th commented 2 years ago

@Eugene706 we decided to separate the work with Chrome Declarative API in our open library - tswebextension

So you only need to pass the configuration there (with declarative rule sets included, which are prepared when the extension is built) - https://github.com/AdguardTeam/AdGuardMV3/blob/master/src/background/tswebextension.ts#L40

Also, if you want to change the static filter rules, check the following https://github.com/AdguardTeam/AdGuardMV3/blob/master/README.md#for-filters-maintainers (step 4)