Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

May you please migrate it to manifest version 3? #1

Open
crysosancher opened this issue Feb 14, 2022 · 2 comments
Open

May you please migrate it to manifest version 3? #1

crysosancher opened this issue Feb 14, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@crysosancher
Copy link

No description provided.

@picatz
Copy link
Owner

picatz commented Jan 2, 2024

Looking at Chrome's developer documentation:

Note

As of Manifest V3, the webRequestBlocking permission is no longer available for most extensions. Consider declarativeNetRequest, which enables use of the declarativeNetRequest API. Aside from webRequestBlocking, the webRequest API will be unchanged and available for normal use. Policy installed extensions can continue to use webRequestBlocking.

The declarativeNetRequest API is used to block or modify network requests by specifying declarative rules. This lets extensions modify network requests without intercepting them and viewing their content, thus providing more privacy.
https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest


It looks like the manifest.json would look something like:

{                                                                                                                 
      "manifest_version": 3,                                                                                          
      ...,                                                                                           
      "permissions": [                                                                                                
        "declarativeNetRequest",                                                                                      
        "declarativeNetRequestFeedback"                                                                               
      ],                                                                                                              
      "host_permissions": [                                                                                           
        "<all_urls>"                                                                                   
      ],                                                                                                                                                                                                                   
      ...,                                                                                                         
      "declarative_net_request": {                                                                                    
        "rule_resources": [{                                                                                          
          "id": "ruleset_1",                                                                                          
          "enabled": true,                                                                                            
          "path": "rules.json"                                                                                        
        }]                                                                                                            
      }                                                                                                               
}       

And the rules.json file would look something like:

[                                                                                                                 
      {                                                                                                               
        "id": 1,                                                                                                      
        "priority": 1,                                                                                                
        "action": { "type": "block" },                                                                                
        "condition": { "urlFilter": "example.com", "resourceTypes": ["main_frame"] }                                  
      },                                                                                                              
      {                                                                                                               
        "id": 2,                                                                                                      
        "priority": 1,                                                                                                
        "action": { "type": "block" },                                                                                
        "condition": { "urlFilter": "anotherexample.com", "resourceTypes": ["main_frame"] }                           
      }                                                                                                               
      ...                                                                                    
]  

@picatz picatz added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jan 2, 2024
@picatz
Copy link
Owner

picatz commented Jan 2, 2024

There's also the concept of "dynamic rules" to consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants