diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsx index 2beade1..27ac897 100644 --- a/src/components/SettingsView.tsx +++ b/src/components/SettingsView.tsx @@ -802,13 +802,13 @@ runEngineChecks(false);
Proxy host - Host name, IP address, or URL with scheme. + Host name, IP address, or HTTP proxy URL.
settings.setProxyHost(e.target.value)} - placeholder="127.0.0.1 or socks5://127.0.0.1" + placeholder="127.0.0.1 or http://127.0.0.1" className="app-control settings-network-input font-mono" />
diff --git a/src/store/useDownloadStore.test.ts b/src/store/useDownloadStore.test.ts index 3466ab2..52d6a3d 100644 --- a/src/store/useDownloadStore.test.ts +++ b/src/store/useDownloadStore.test.ts @@ -68,8 +68,9 @@ describe('useDownloadStore', () => { it('normalizes proxy settings for download dispatch', async () => { expect(normalizeCustomProxy('127.0.0.1', 8080)).toBe('http://127.0.0.1:8080'); - expect(normalizeCustomProxy(' socks5://127.0.0.1 ', 1080)).toBe('socks5://127.0.0.1:1080'); expect(normalizeCustomProxy('http://proxy.local:9000', 8080)).toBe('http://proxy.local:9000'); + expect(normalizeCustomProxy(' socks5://127.0.0.1 ', 1080)).toBeNull(); + expect(normalizeCustomProxy('https://proxy.local', 8443)).toBeNull(); expect(normalizeCustomProxy('127.0.0.1', NaN)).toBeNull(); expect(await getProxyArgs({ @@ -87,9 +88,9 @@ describe('useDownloadStore', () => { expect(await getProxyArgs({ proxyMode: 'custom', - proxyHost: 'socks5://127.0.0.1', + proxyHost: 'http://127.0.0.1', proxyPort: 1080 - } as ReturnType)).toBe('socks5://127.0.0.1:1080'); + } as ReturnType)).toBe('http://127.0.0.1:1080'); }); it('matches site logins by host, wildcard host, path, and full URL patterns', () => { diff --git a/src/store/useDownloadStore.ts b/src/store/useDownloadStore.ts index b7e53fb..48e2245 100644 --- a/src/store/useDownloadStore.ts +++ b/src/store/useDownloadStore.ts @@ -102,6 +102,7 @@ export const normalizeCustomProxy = (host: string, port: number): string | null if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmedHost)) { try { const parsed = new URL(trimmedHost); + if (parsed.protocol !== 'http:') return null; if (!parsed.port) parsed.port = String(normalizedPort); return parsed.toString().replace(/\/$/, ''); } catch {