Pail/background.js

25 lines
592 B
JavaScript

chrome.webRequest.onBeforeRequest.addListener(details => {
const url = new URL(details.url)
if (url.hostname !== "git.add123.com") return
if (!url.pathname.endsWith("plugins/servlet/search")) return
if (details.url.includes("fork:") || details.url.includes("fork%3A")) return
return { redirectUrl: `${details.url}%20fork%3Afalse` }
},
{
urls: [ "https://git.add123.com/*" ],
types: [
"main_frame",
"sub_frame",
"stylesheet",
"script",
"image",
"object",
"xmlhttprequest",
"other",
],
},
["blocking"]
)