fix(sites): 站点开代理但没填代理地址时沿用容器 HTTPS_PROXY;内置公开 BT 站默认开代理
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
364b24bc33
commit
b2cdf0e106
4 files changed
+17
-5
No files matched your search
@@ -72,14 +72,19 @@ export function fetchVia(client: Deno.HttpClient): typeof globalThis.fetch {
|
||||
globalThis.fetch(input, { ...init, client } as RequestInit)) as typeof globalThis.fetch;
|
||||
}
|
||||
|
||||
/** 站点请求的出口:开代理且有代理地址 → proxy,否则 direct */
|
||||
/** 站点请求的出口:开代理 → 设置里的站点代理地址,没填则用进程的 HTTPS_PROXY / HTTP_PROXY;都没有 → direct */
|
||||
export interface SiteEgress {
|
||||
mode: "direct" | "proxy";
|
||||
proxyUrl: string | null;
|
||||
}
|
||||
|
||||
export function siteEgress(proxy: boolean, proxyUrl: string | null | undefined): SiteEgress {
|
||||
return proxy && proxyUrl ? { mode: "proxy", proxyUrl } : { mode: "direct", proxyUrl: null };
|
||||
export function siteEgress(
|
||||
proxy: boolean,
|
||||
proxyUrl: string | null | undefined,
|
||||
env: Record<string, string | undefined> = ENV_SNAPSHOT,
|
||||
): SiteEgress {
|
||||
const url = proxy ? proxyUrl || env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy : null;
|
||||
return url ? { mode: "proxy", proxyUrl: url } : { mode: "direct", proxyUrl: null };
|
||||
}
|
||||
|
||||
/** 出口的比较键(不含代理口令):direct / proxy:<主机:端口> */
|
||||
|
||||
Reference in new issue
Block a user