ClearURLs / Addon

ClearURLs is an add-on based on the new WebExtensions technology and will automatically remove tracking elements from URLs to help protect your privacy.
http://docs.clearurls.xyz
GNU Lesser General Public License v3.0
4.01k stars 110 forks source link

Update Manifest version from v2 to v3 #326

Open inson1 opened 10 months ago

nascentt commented 6 months ago

V2 is being deprecated June 2024 https://developer.chrome.com/docs/extensions/develop/migrate/mv2-deprecation-timeline so 3 months left to migrate.

KevinRoebert commented 6 months ago

V2 is being deprecated June 2024 https://developer.chrome.com/docs/extensions/develop/migrate/mv2-deprecation-timeline so 3 months left to migrate.

The onBeforeRequest API will be removed from Chrome with V3. This means that ClearURLs no longer works in Chrome. As for many other ad blockers and privacy addons, there is no alternative to replace this functionality. ClearURLs will therefore only work in Firefox and Chromium-based browsers that continue to offer the onBeforeRequest API.

KevinRoebert commented 4 months ago

@KevinRoebert Isn't the onBeforeRequest API used by ClearURLs only to redirect urls? In fact even in manifest V3, it is possible to use declarativeNetRequest to redirect to different URLs.

There is a official code example on Github exclusively for this: https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/declarativeNetRequest/url-redirect

See the google article to block and or redirect urls: https://developer.chrome.com/docs/extensions/develop/migrate/blocking-web-requests

EXAMPLE IN MANIFEST V2:

chrome.webRequest.onBeforeRequest.addListener((e) => {
    console.log(e);
    return { redirectUrl: "https://developer.chrome.com/docs/extensions/mv3/intro/" };
  }, { 
    urls: [
      "https://developer.chrome.com/docs/extensions/mv2/"
    ]
  }, 
  ["blocking"]
);

THE SAME EXAMPLE IN MANIFEST V3:

[
  {
    "id" : 1,
    "priority": 1,
    "action": {
      "type": "redirect",
      "redirect": { "url": "https://developer.chrome.com/docs/extensions/mv3/intro/" }
    },
    "condition": {
      "urlFilter": "https://developer.chrome.com/docs/extensions/mv2/",
      "resourceTypes": ["main_frame"]
    }
  }

It is primarily used to filter the tracking parameters.

deathtrip commented 4 days ago

So if it's possible, will ClearURLs work with manifest V3?