chore: remove all proxy black magic

can be configured per env via PROXY_CONFIG instead
This commit is contained in:
WebStreamr 2026-01-10 20:11:03 +00:00
parent baf5c9143d
commit 66fb0e2e6d
No known key found for this signature in database
2 changed files with 4 additions and 9 deletions

View file

@ -24,7 +24,7 @@ export class RgShows extends Extractor {
nonSubDomainUrl.hostname = nonSubDomainUrl.hostname.split('.').slice(-2).join('.');
const headers = { 'Referer': `${nonSubDomainUrl.origin}/`, 'Origin': nonSubDomainUrl.origin, 'User-Agent': 'Mozilla' };
const data = await this.fetcher.json(ctx, url, { headers, noProxy: true }) as RgShowsApiData;
const data = await this.fetcher.json(ctx, url, { headers }) as RgShowsApiData;
const playlistUrl = new URL(data.stream.url);
@ -36,7 +36,7 @@ export class RgShows extends Extractor {
ttl: this.ttl,
meta: {
...meta,
height: await guessHeightFromPlaylist(ctx, this.fetcher, playlistUrl, url, { headers, noProxy: true }),
height: await guessHeightFromPlaylist(ctx, this.fetcher, playlistUrl, url, { headers }),
},
requestHeaders: headers,
},

View file

@ -42,7 +42,6 @@ type ProxyConfig = Pick<AxiosRequestConfig, 'httpAgent' | 'httpsAgent' | 'proxy'
export type CustomRequestConfig = AxiosRequestConfig & {
minCacheTtl?: number;
noProxy?: boolean;
noProxyHeaders?: boolean;
queueLimit?: number;
queueTimeout?: number;
@ -123,7 +122,7 @@ export class Fetcher {
}
protected async fetchWithTimeout(ctx: Context, url: URL, requestConfig?: CustomRequestConfig, tryCount = 0): Promise<AxiosResponse> {
const proxyUrl = requestConfig?.noProxy ? null : this.getProxyForUrl(ctx, url);
const proxyUrl = this.getProxyForUrl(url);
let message = `Fetch ${requestConfig?.method ?? 'GET'} ${url}`;
/* istanbul ignore if */
@ -338,11 +337,7 @@ export class Fetcher {
return new Promise(sleep => setTimeout(sleep, ms));
}
private getProxyForUrl(ctx: Context, url: URL): URL | undefined {
if (ctx.config.mediaFlowProxyUrl && url.href.startsWith(ctx.config.mediaFlowProxyUrl)) {
return undefined;
}
private getProxyForUrl(url: URL): URL | undefined {
const proxyConfig = process.env['PROXY_CONFIG'];
if (proxyConfig) {