diff --git a/src/background/handlers/onProxyRequest.ts b/src/background/handlers/onProxyRequest.ts index 6669af8..b59b39c 100644 --- a/src/background/handlers/onProxyRequest.ts +++ b/src/background/handlers/onProxyRequest.ts @@ -20,6 +20,17 @@ import { ProxyInfo, ProxyRequestType } from "../../types"; export default async function onProxyRequest( details: Proxy.OnRequestDetailsType ): Promise { + // Wait for the store to be ready. + if (store.readyState !== "complete") { + await new Promise(resolve => { + const listener = () => { + store.removeEventListener("load", listener); + resolve(onProxyRequest(details)); + }; + store.addEventListener("load", listener); + }); + } + const host = getHostFromUrl(details.url); if (!host) return { type: "direct" }; @@ -35,17 +46,6 @@ export default async function onProxyRequest( return { type: "direct" }; } - // Wait for the store to be ready. - if (store.readyState !== "complete") { - await new Promise(resolve => { - const listener = () => { - store.removeEventListener("load", listener); - resolve(onProxyRequest(details)); - }; - store.addEventListener("load", listener); - }); - } - const proxies = store.state.optimizedProxiesEnabled ? store.state.optimizedProxies : store.state.normalProxies; @@ -136,7 +136,6 @@ export default async function onProxyRequest( // Twitch webpage requests. if (proxyTwitchWebpageRequest && twitchTvHostRegex.test(host)) { - // No check for `isFromTwitchTvHost` here because `documentHost` is null. console.log( `⌛ Proxying ${details.url} through one of: ${ proxies.toString() || "" diff --git a/src/common/ts/isRequestTypeProxied.ts b/src/common/ts/isRequestTypeProxied.ts index 0ef25c8..9ded14b 100644 --- a/src/common/ts/isRequestTypeProxied.ts +++ b/src/common/ts/isRequestTypeProxied.ts @@ -54,7 +54,7 @@ export default function isRequestTypeProxied( if (type === ProxyRequestType.GraphQL) { // Proxy all GQL requests when passport is unoptimized official+ (Chromium) - // or unoptimized diplomatic (Firefox). + // or unoptimized diplomatic+ (Firefox). if ( params.isChromium && !params.optimizedProxiesEnabled &&