Compare commits
No commits in common. "263c0497f30b9014f54ac6a04dca8e5bba77844c" and "2ca4aeefb7eca9951b77472612000e42354e2e9a" have entirely different histories.
263c0497f3
...
2ca4aeefb7
|
@ -70,7 +70,8 @@
|
||||||
{
|
{
|
||||||
"files": "tests/**/*.test.ts",
|
"files": "tests/**/*.test.ts",
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/triple-slash-reference": "off"
|
"@typescript-eslint/triple-slash-reference": "off",
|
||||||
|
"no-await-in-loop": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -78,8 +79,7 @@
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/consistent-type-definitions": "off",
|
"@typescript-eslint/consistent-type-definitions": "off",
|
||||||
"@typescript-eslint/consistent-type-imports": "off",
|
"@typescript-eslint/consistent-type-imports": "off",
|
||||||
"n/file-extension-in-import": "off",
|
"n/file-extension-in-import": "off"
|
||||||
"no-await-in-loop": "off"
|
|
||||||
},
|
},
|
||||||
"space": true
|
"space": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
import browser from 'webextension-polyfill';
|
|
||||||
|
|
||||||
import {parseRedirect} from '../redirect/exports.js';
|
|
||||||
|
|
||||||
async function browserActionClicked() {
|
|
||||||
await browser.runtime.openOptionsPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (import.meta.env.VITE_BROWSER === 'chromium') {
|
|
||||||
browser.action.onClicked.addListener(browserActionClicked);
|
|
||||||
} else {
|
|
||||||
browser.browserAction.onClicked.addListener(browserActionClicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
browser.runtime.onInstalled.addListener(async () => {
|
|
||||||
if (import.meta.env.DEV) {
|
|
||||||
await browser.runtime.openOptionsPage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
browser.webNavigation.onBeforeNavigate.addListener(async (details) => {
|
|
||||||
const url = new URL(details.url);
|
|
||||||
|
|
||||||
for (const parameters of Object.values(await browser.storage.local.get())) {
|
|
||||||
const redirect = parseRedirect(parameters);
|
|
||||||
if (redirect === undefined) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (redirect.isMatch(url)) {
|
|
||||||
const redirectedUrl = redirect.redirect(url);
|
|
||||||
await browser.tabs.update({url: redirectedUrl.href});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
Loading…
Reference in New Issue