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
1c622d7ce0
commit
c3924c17b1
@ -12,24 +12,22 @@ export default function onInstalledStoreCleanup(
|
||||
|
||||
if (details.reason === "update") {
|
||||
// Remove old Chromium normal proxy.
|
||||
if (
|
||||
store.state.normalProxies.includes("chrome.api.cdn-perfprod.com:4023")
|
||||
) {
|
||||
const oldChromiumProxy = "chrome.api.cdn-perfprod.com:4023";
|
||||
if (store.state.normalProxies.includes(oldChromiumProxy)) {
|
||||
store.state.normalProxies = store.state.normalProxies.filter(
|
||||
proxy => proxy !== "chrome.api.cdn-perfprod.com:4023"
|
||||
proxy => proxy !== oldChromiumProxy
|
||||
);
|
||||
if (store.state.normalProxies.length === 0) {
|
||||
store.state.optimizedProxiesEnabled = true;
|
||||
}
|
||||
}
|
||||
// Add new Chromium optimized proxy.
|
||||
const newChromiumProxy = "chromium.api.cdn-perfprod.com:2023";
|
||||
if (
|
||||
isChromium &&
|
||||
!store.state.optimizedProxies.includes(
|
||||
"chromium.api.cdn-perfprod.com:2023"
|
||||
)
|
||||
!store.state.optimizedProxies.includes(newChromiumProxy)
|
||||
) {
|
||||
store.state.optimizedProxies.push("chromium.api.cdn-perfprod.com:2023");
|
||||
store.state.optimizedProxies.push(newChromiumProxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,14 @@ export default async function onProxyRequest(
|
||||
const documentHost = details.documentUrl
|
||||
? getHostFromUrl(details.documentUrl)
|
||||
: null;
|
||||
const isFromTwitchTvHost =
|
||||
documentHost != null && documentHost.endsWith(".twitch.tv");
|
||||
// Twitch requests from non-Twitch hosts are not supported.
|
||||
if (
|
||||
documentHost != null && // Twitch webpage requests have no document URL.
|
||||
!passportHostRegex.test(documentHost) && // Passport requests have a `passport.twitch.tv` document URL.
|
||||
!twitchTvHostRegex.test(documentHost)
|
||||
) {
|
||||
return { type: "direct" };
|
||||
}
|
||||
|
||||
// Wait for the store to be ready.
|
||||
if (store.readyState !== "complete") {
|
||||
@ -74,12 +80,6 @@ export default async function onProxyRequest(
|
||||
|
||||
// Passport requests.
|
||||
if (proxyPassportRequest && passportHostRegex.test(host)) {
|
||||
if (!isFromTwitchTvHost) {
|
||||
console.log(
|
||||
`✋ '${details.url}' from host '${documentHost}' is not supported.`
|
||||
);
|
||||
return { type: "direct" };
|
||||
}
|
||||
console.log(
|
||||
`⌛ Proxying ${details.url} through one of: ${
|
||||
proxies.toString() || "<empty>"
|
||||
@ -90,12 +90,6 @@ export default async function onProxyRequest(
|
||||
|
||||
// Usher requests.
|
||||
if (proxyUsherRequest && usherHostRegex.test(host)) {
|
||||
if (!isFromTwitchTvHost) {
|
||||
console.log(
|
||||
`✋ '${details.url}' from host '${documentHost}' is not supported.`
|
||||
);
|
||||
return { type: "direct" };
|
||||
}
|
||||
if (details.url.includes("/vod/")) {
|
||||
console.log(`✋ '${details.url}' is a VOD manifest.`);
|
||||
return { type: "direct" };
|
||||
@ -115,12 +109,6 @@ export default async function onProxyRequest(
|
||||
|
||||
// Video Weaver requests.
|
||||
if (proxyVideoWeaverRequest && videoWeaverHostRegex.test(host)) {
|
||||
if (!isFromTwitchTvHost) {
|
||||
console.log(
|
||||
`✋ '${details.url}' from host '${documentHost}' is not supported.`
|
||||
);
|
||||
return { type: "direct" };
|
||||
}
|
||||
const channelName =
|
||||
findChannelFromVideoWeaverUrl(details.url) ??
|
||||
findChannelFromTwitchTvUrl(details.documentUrl);
|
||||
@ -138,12 +126,6 @@ export default async function onProxyRequest(
|
||||
|
||||
// Twitch GraphQL requests.
|
||||
if (proxyGraphQLRequest && twitchGqlHostRegex.test(host)) {
|
||||
if (!isFromTwitchTvHost) {
|
||||
console.log(
|
||||
`✋ '${details.url}' from host '${documentHost}' is not supported.`
|
||||
);
|
||||
return { type: "direct" };
|
||||
}
|
||||
console.log(
|
||||
`⌛ Proxying ${details.url} through one of: ${
|
||||
proxies.toString() || "<empty>"
|
||||
|
@ -69,7 +69,8 @@ export default function isRequestTypeProxied(
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
// Proxy flagged GQL requests when passport is official+.
|
||||
// Proxy flagged GQL requests when passport is official+ (Chromium) or
|
||||
// ordinary+ (Firefox).
|
||||
if (params.isChromium && params.fullModeEnabled === false) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user