Compare commits
No commits in common. "16ba17eb9c110e2681b13a2b16987c457d2089a9" and "a93b5ed92d801e318f3de50b7453b6459304bfb3" have entirely different histories.
16ba17eb9c
...
a93b5ed92d
|
@ -39,13 +39,13 @@ browser.webNavigation.onBeforeNavigate.addListener(async (details) => {
|
|||
await browser.storage.local.get(),
|
||||
)) {
|
||||
const redirect = parseRedirect(parameters, id);
|
||||
if (redirect === undefined || !redirect.parameters.enabled) {
|
||||
if (redirect === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (redirect.isMatch(url)) {
|
||||
const redirectedUrl = redirect.redirect(url);
|
||||
await browser.tabs.update(details.tabId, {url: redirectedUrl.href});
|
||||
await browser.tabs.update({url: redirectedUrl.href});
|
||||
await browser.storage.local.set({
|
||||
latestTime: Date.now(),
|
||||
latestUrl: url.href,
|
||||
|
|
|
@ -15,7 +15,6 @@ export function narrowRedirectType(value: string): value is RedirectType {
|
|||
}
|
||||
|
||||
export type RedirectParameters = {
|
||||
enabled: boolean;
|
||||
matcherType: MatcherType;
|
||||
matcherValue: string;
|
||||
redirectType: RedirectType;
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
} from '../source/redirect/exports.js';
|
||||
|
||||
const hostnameParameters: RedirectParameters = {
|
||||
enabled: true,
|
||||
matcherType: 'hostname',
|
||||
matcherValue: 'example.com',
|
||||
redirectType: 'hostname',
|
||||
|
@ -24,7 +23,6 @@ const hostnameParameters: RedirectParameters = {
|
|||
};
|
||||
|
||||
const simpleParameters: RedirectParameters = {
|
||||
enabled: true,
|
||||
matcherType: 'hostname',
|
||||
matcherValue: 'example.com',
|
||||
redirectType: 'simple',
|
||||
|
@ -91,7 +89,6 @@ test('Redirect.isMatch', (t) => {
|
|||
} as unknown as HostnameRedirect['parameters']);
|
||||
|
||||
const regexMatch = new HostnameRedirect({
|
||||
enabled: true,
|
||||
matcherType: 'regex',
|
||||
matcherValue: String.raw`^https://(www\.)?example.org/$`,
|
||||
redirectType: 'simple',
|
||||
|
|
|
@ -11,7 +11,6 @@ Generated by [AVA](https://avajs.dev).
|
|||
HostnameRedirect {
|
||||
id: 'id',
|
||||
parameters: {
|
||||
enabled: true,
|
||||
matcherType: 'hostname',
|
||||
matcherValue: 'example.com',
|
||||
redirectType: 'hostname',
|
||||
|
@ -24,7 +23,6 @@ Generated by [AVA](https://avajs.dev).
|
|||
SimpleRedirect {
|
||||
id: 'id',
|
||||
parameters: {
|
||||
enabled: true,
|
||||
matcherType: 'hostname',
|
||||
matcherValue: 'example.com',
|
||||
redirectType: 'simple',
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue