import { createFileRoute } from '@tanstack/react-router' import { route } from '@/constants/routes' import HeaderPage from '@/containers/HeaderPage' import SettingsMenu from '@/containers/SettingsMenu' import { Card, CardItem } from '@/containers/Card' import { Switch } from '@/components/ui/switch' import { useTranslation } from 'react-i18next' import { Input } from '@/components/ui/input' import { EyeOff, Eye } from 'lucide-react' import { useCallback, useEffect, useState } from 'react' import { useProxyConfig } from '@/hooks/useProxyConfig' import { configurePullOptions } from '@/services/models' // eslint-disable-next-line @typescript-eslint/no-explicit-any export const Route = createFileRoute(route.settings.https_proxy as any)({ component: HTTPSProxy, }) function HTTPSProxy() { const { t } = useTranslation() const [showPassword, setShowPassword] = useState(false) const { proxyUrl, proxyEnabled, proxyUsername, proxyPassword, proxyIgnoreSSL, verifyProxySSL, verifyProxyHostSSL, verifyPeerSSL, verifyHostSSL, noProxy, setProxyEnabled, setProxyUsername, setProxyPassword, setProxyIgnoreSSL, setVerifyProxySSL, setVerifyProxyHostSSL, setVerifyPeerSSL, setVerifyHostSSL, setNoProxy, setProxyUrl, } = useProxyConfig() const toggleProxy = useCallback( (checked: boolean) => { setProxyEnabled(checked) configurePullOptions({ proxyUrl, proxyEnabled: checked, proxyUsername, proxyPassword, proxyIgnoreSSL, verifyProxySSL, verifyProxyHostSSL, verifyPeerSSL, verifyHostSSL, noProxy, }) }, [ noProxy, proxyIgnoreSSL, proxyPassword, proxyUrl, proxyUsername, setProxyEnabled, verifyHostSSL, verifyPeerSSL, verifyProxyHostSSL, verifyProxySSL, ] ) useEffect(() => { const handler = setTimeout(() => { configurePullOptions({ proxyUrl, proxyEnabled, proxyUsername, proxyPassword, proxyIgnoreSSL, verifyProxySSL, verifyProxyHostSSL, verifyPeerSSL, verifyHostSSL, noProxy, }) }, 300) return () => clearTimeout(handler) }, [ noProxy, proxyEnabled, proxyIgnoreSSL, proxyPassword, proxyUrl, proxyUsername, verifyHostSSL, verifyPeerSSL, verifyProxyHostSSL, verifyProxySSL, ]) return (
URL and port of your proxy server.
setProxyUrl(e.target.value)} />Credentials for your proxy server (if required).
List of hosts that should bypass the proxy.
setNoProxy(e.target.value)} />