mirror of
https://github.com/younesaassila/ttv-lol-pro.git
synced 2025-04-29 22:14:27 +02:00
Improvements
This commit is contained in:
parent
c3924c17b1
commit
832fb16251
@ -20,6 +20,17 @@ import { ProxyInfo, ProxyRequestType } from "../../types";
|
||||
export default async function onProxyRequest(
|
||||
details: Proxy.OnRequestDetailsType
|
||||
): Promise<ProxyInfo | ProxyInfo[]> {
|
||||
// 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() || "<empty>"
|
||||
|
@ -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 &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user