• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    TypeScript
  • License
    GNU General Publi...
  • Created over 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AdGuard browser extension prototype based on the new Manifest V3

AdGuard MV3 Extension


AdGuard DNS


Starting from January 2023 the old Manifest V2 extensions will be deprecated and the only way to achieve content blocking in Chrome would be to use the new Manifest V3.

In mid-2021, we started working on the prototype of a new extension that would be able to block ads even within the strict limits of Manifest V3. The task was not easy, but we're finally able to present the first working prototype of an MV3-enabled ad blocker.

The prototype is fully functional and if you're not a power-user, you may feel little difference with the existing MV2-blockers. Unfortunately, this does not mean that everything is great and we suggest you to read the blog post to learn about all the limitations.

How to build

Requirements

  • nodejs - only version 16.
  • yarn - nodejs package manager.

Prepare

  • yarn install - install necessary dependencies.
  • yarn filters - download the latest versions of the filter lists built-in the extension and convert them to declarative format.

Build

  • yarn release - release build.
  • yarn dev - dev build.
  • yarn dev --watch - prepare the dev build and monitor the files for changes. Note, that this command will not run filters conversion, you'll need to do it manually.

Test

  • yarn test - run local unit tests using Jest.
  • To run the supported testcases using Playwright:
    • yarn integration-test dev for dev build test;
    • yarn integration-test release for release build test.

For Filters Maintainers

Some of the extension capabilities are only available when you install it as an "unpacked" extension. Also, if you want to test how it works with a different version of your filter, you need to make changes to your list manually and then rebuild & reload the extension.

So here's what you need to do:

  1. Build the extension with yarn dev chrome --watch.
  2. Go to chrome://extensions, enable "Developer mode", click "Load unpacked" and choose the newly built extension (it will be located in build/dev/chrome).
  3. In order to see how it works, open Chrome's Developer Tools and switch to the "AdGuard" tab. Refresh the page to see what has been blocked and by which rule.
  4. Let's try changing something. For instance, you may want to change the Base list. Open src/filters/chrome/filter_1.txt and implement your changes.
  5. Run yarn filters-convert to prepare the static lists.
  6. Since you're running with --watch, the extension will be re-built automatically, but you still need to reload the extension in Chrome. You will also need to reload the "AdGuard" tab in Dev Tools or simply reopen Dev Tools to make it work.

Permissions required

  • tabs - this permission is required in order to get the URL of the options page tab
  • alarms - this permission is required in order to set the pause protection timer
  • contextMenus - this permission is required in order to create a context menu
  • scripting - this permission is required in order to inject assistant script only in the required pages
  • storage - this permission is required in order to save user settings, user rules and custom filters
  • declarativeNetRequest - this permission is required in order to block, redirect and modify URL requests
  • declarativeNetRequestFeedback - this permission is required in order to create a log of the blocked, redirected or modified URL requests
  • unlimitedStorage - this permission is required in order to save large filters
  • webNavigation - this permission is required in order to catch the moment for injecting scriptlets

Dependencies

  1. nodejs - https://nodejs.org/en/download/, only version 16
  2. yarn, nodejs package manager - https://classic.yarnpkg.com/lang/en/docs/install

More Repositories

1

AdGuardHome

Network-wide ads & trackers blocking DNS server
Go
18,381
star
2

AdguardBrowserExtension

AdGuard browser extension
JavaScript
2,427
star
3

AdguardFilters

AdGuard Content Blocking Filters
Adblock Filter List
2,331
star
4

dnsproxy

Simple DNS proxy with DoH, DoT, DoQ and DNSCrypt support
Go
1,791
star
5

AdguardForiOS

The most advanced ad blocker for iOS
JavaScript
1,289
star
6

AdguardForAndroid

Open bug tracker for Android version of AdGuard.
1,060
star
7

AdGuardForSafari

AdGuard for Safari app extension
JavaScript
875
star
8

AdGuardDNS

Public DNS resolver that protects you from ad trackers
Go
634
star
9

AdguardForWindows

AdGuard for Windows open bug tracker
568
star
10

AdGuardSDNSFilter

AdGuard Simplified Domain names filter
Adblock Filter List
491
star
11

ContentBlocker

Content blocking extension for Samsung Internet and Yandex Browser
Java
402
star
12

cname-trackers

This repository contains a list of popular CNAME trackers
JavaScript
334
star
13

AdGuardExtra

AdGuard Extra is designed to solve complicated cases when regular ad blocking rules aren't enough.
270
star
14

AdguardForMac

Open bug tracker for Mac version of AdGuard
269
star
15

PopupBlocker

Popup blocking userscript
TypeScript
220
star
16

gomitmproxy

Simple golang mitm proxy implementation
Go
155
star
17

FiltersRegistry

Known filters subscriptions transformed for better compatibility with AdGuard
Adblock Filter List
152
star
18

AdguardKnowledgeBase

Adguard Knowledge Base
140
star
19

HostlistsRegistry

Known hosts blocklists that are made available to the users of AdGuard products
JavaScript
113
star
20

AdguardAssistant

Adguard Assistant userscript
JavaScript
110
star
21

Scriptlets

AdGuard scriptlets library
JavaScript
109
star
22

HostlistCompiler

A simple tool that compiles hosts blocklists from multiple sources
JavaScript
95
star
23

BlockYouTubeAdsShortcut

This repo contains the code for blocking YouTube ads that is supposed to be run by an iOS shortcut
JavaScript
85
star
24

AdGuardVPNForAndroid

AdGuard VPN Android app open bug tracker
81
star
25

DisableAMP

Disable AMP userscript
JavaScript
76
star
26

DnsLibs

DNS filtering library
C++
75
star
27

urlfilter

AdGuard content blocking library in golang
Go
71
star
28

AdGuardVPNExtension

AdGuard VPN Chrome and Firefox extension
TypeScript
57
star
29

AnonymousRedirect

Very simple HTML page that is used for anonymous redirect
HTML
55
star
30

ExtendedCss

A TypeScript library for non-standard element selecting β€” :contains(), :matches-css(), etc., and applying CSS styles with extended properties.
TypeScript
54
star
31

HttpsExclusions

Centralized repo for HTTPS exclusions
JavaScript
48
star
32

KnowledgeBaseDNS

AdGuard DNS knowledge base
JavaScript
47
star
33

StealthMode

JavaScript
46
star
34

Userscripts

Userscripts made by our team
JavaScript
42
star
35

AdGuardVPNForWindows

AdGuard VPN Windows app open bug tracker
39
star
36

VscodeAdblockSyntax

TM language plugin with ad blocking rules syntax
37
star
37

FiltersCompiler

A tool that compiles & validates filters
JavaScript
36
star
38

tsurlfilter

AdGuard content blocking library
TypeScript
35
star
39

CoreLibs

Core Adguard libraries
33
star
40

BrowserAssistant

AdGuard Browser Assistant
JavaScript
33
star
41

AGLint

Universal adblock filter list parser, linter and converter
TypeScript
28
star
42

KnowledgeBase

AdGuard knowledge base
JavaScript
26
star
43

AdGuardVPNForiOS

AdGuard VPN iOS app open bug tracker
25
star
44

SafariConverterLib

Swift library that converts AdGuard rules to Safari content blocking rules
Swift
21
star
45

AdGuardVPNForMac

AdGuard VPN Mac app open bug tracker
21
star
46

AdguardTeam.github.io

HTML
17
star
47

companiesdb

This is a companies DB that we use in AdGuard Home and AdGuard DNS.
JavaScript
16
star
48

ProxiesSetup

A simple script that sets up an HTTP and a SOCKS5 proxy (squid and danted)
Shell
16
star
49

WebBatteryTester

This application allows you to test how quick is your battery drained by web-browsing.
Java
14
star
50

golibs

Small helper Go libraries
Go
13
star
51

SafariConverter

Converter: ad blocking rules -> safari content blocker
JavaScript
12
star
52

deep-override

TypeScript
10
star
53

VerificationLibrary

Certificates verification library
C
9
star
54

go-webext

Automation for working with extension stores
Go
9
star
55

FiltersDownloader

Pre-processing library for filters subscriptions
JavaScript
9
star
56

translate

Simple internationalization library with react integration
TypeScript
8
star
57

AdGuardFiltersStats

The repo where we collect AdguardFilters statistics
JavaScript
8
star
58

ecsstree

Adblock Extended CSS supplement for CSSTree
JavaScript
7
star
59

ReportsWebApp

Allows users to report a problem with Adguard filters
JavaScript
7
star
60

NativeLibsCommon

Native libs common
C++
6
star
61

Recovery

JavaScript
5
star
62

VpnLibs

Open bug tracker for AdGuard VPN core library
5
star
63

KnowledgeBaseVPN

AdGuard VPN knowledge base
JavaScript
5
star
64

AdGuardVpnKnowledgeBase

AdGuard VPN Knowledge Base
5
star
65

LegalDocs

AdGuard's legal documents
4
star
66

SafariContentBlockerTester

Utility Safari extension for content blocker format testing.
JavaScript
4
star
67

TestCases

Used for testing puproses
JavaScript
3
star
68

SafariContentBlockerConverterCompiler

Utility scripts for building safari content blocker converter.
JavaScript
3
star
69

github-stats

Tool for calculating AdguardFilters contributors statistics
JavaScript
3
star
70

DeadDomainsLinter

Simple tool to check adblock filtering rules for dead domains.
JavaScript
2
star
71

AdGuardVPNCLI

AdGuard VPN command-line version
2
star
72

AdGuardDNSClient

Client tool for AdGuard DNS
Go
2
star
73

closure-tools-helper

TypeScript
1
star
74

dns-sde-extension

Proof-of-concept browser extension for Structured DNS errors
1
star