mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 12:18:35 -05:00
fix(proxy): apply all proxy settings to Axios (#1741)
This commit is contained in:
@@ -37,6 +37,8 @@ class ExternalAPI {
|
|||||||
...options.headers,
|
...options.headers,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
this.axios.interceptors.request = axios.interceptors.request;
|
||||||
|
this.axios.interceptors.response = axios.interceptors.response;
|
||||||
|
|
||||||
if (options.rateLimit) {
|
if (options.rateLimit) {
|
||||||
this.axios = rateLimit(this.axios, {
|
this.axios = rateLimit(this.axios, {
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ class TautulliAPI {
|
|||||||
}${settings.urlBase ?? ''}`,
|
}${settings.urlBase ?? ''}`,
|
||||||
params: { apikey: settings.apiKey },
|
params: { apikey: settings.apiKey },
|
||||||
});
|
});
|
||||||
|
this.axios.interceptors.request = axios.interceptors.request;
|
||||||
|
this.axios.interceptors.response = axios.interceptors.response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getInfo(): Promise<TautulliInfo> {
|
public async getInfo(): Promise<TautulliInfo> {
|
||||||
|
|||||||
@@ -150,6 +150,8 @@ class ImageProxy {
|
|||||||
baseURL: baseUrl,
|
baseURL: baseUrl,
|
||||||
headers: options.headers,
|
headers: options.headers,
|
||||||
});
|
});
|
||||||
|
this.axios.interceptors.request = axios.interceptors.request;
|
||||||
|
this.axios.interceptors.response = axios.interceptors.response;
|
||||||
|
|
||||||
if (options.rateLimitOptions) {
|
if (options.rateLimitOptions) {
|
||||||
this.axios = rateLimit(this.axios, options.rateLimitOptions);
|
this.axios = rateLimit(this.axios, options.rateLimitOptions);
|
||||||
|
|||||||
@@ -56,12 +56,9 @@ export default async function createCustomProxyAgent(
|
|||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const proxyUrl =
|
const proxyUrl = `${proxySettings.useSsl ? 'https' : 'http'}://${
|
||||||
(proxySettings.useSsl ? 'https://' : 'http://') +
|
proxySettings.hostname
|
||||||
proxySettings.hostname +
|
}:${proxySettings.port}`;
|
||||||
':' +
|
|
||||||
proxySettings.port;
|
|
||||||
|
|
||||||
const proxyAgent = new ProxyAgent({
|
const proxyAgent = new ProxyAgent({
|
||||||
uri: proxyUrl,
|
uri: proxyUrl,
|
||||||
token,
|
token,
|
||||||
@@ -70,10 +67,17 @@ export default async function createCustomProxyAgent(
|
|||||||
|
|
||||||
setGlobalDispatcher(proxyAgent.compose(noProxyInterceptor));
|
setGlobalDispatcher(proxyAgent.compose(noProxyInterceptor));
|
||||||
|
|
||||||
axios.defaults.httpAgent = new HttpProxyAgent(proxyUrl);
|
axios.defaults.httpAgent = new HttpProxyAgent(proxyUrl, {
|
||||||
axios.defaults.httpsAgent = new HttpsProxyAgent(proxyUrl);
|
headers: token ? { 'proxy-authorization': token } : undefined,
|
||||||
|
});
|
||||||
|
axios.defaults.httpsAgent = new HttpsProxyAgent(proxyUrl, {
|
||||||
|
headers: token ? { 'proxy-authorization': token } : undefined,
|
||||||
|
});
|
||||||
axios.interceptors.request.use((config) => {
|
axios.interceptors.request.use((config) => {
|
||||||
if (config.url && skipUrl(config.url)) {
|
const url = config.baseURL
|
||||||
|
? new URL(config.baseURL + (config.url || ''))
|
||||||
|
: config.url;
|
||||||
|
if (url && skipUrl(url)) {
|
||||||
config.httpAgent = false;
|
config.httpAgent = false;
|
||||||
config.httpsAgent = false;
|
config.httpsAgent = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user