diff --git a/src-tauri/src/database/dao/proxy.rs b/src-tauri/src/database/dao/proxy.rs index a517d292e..806c14abb 100644 --- a/src-tauri/src/database/dao/proxy.rs +++ b/src-tauri/src/database/dao/proxy.rs @@ -41,7 +41,7 @@ impl Database { Ok(GlobalProxyConfig { proxy_enabled: false, listen_address: "127.0.0.1".to_string(), - listen_port: 5000, + listen_port: 15721, enable_logging: true, }) } diff --git a/src-tauri/src/database/schema.rs b/src-tauri/src/database/schema.rs index 295f48372..46d74df85 100644 --- a/src-tauri/src/database/schema.rs +++ b/src-tauri/src/database/schema.rs @@ -112,7 +112,7 @@ impl Database { conn.execute("CREATE TABLE IF NOT EXISTS proxy_config ( app_type TEXT PRIMARY KEY CHECK (app_type IN ('claude','codex','gemini')), proxy_enabled INTEGER NOT NULL DEFAULT 0, listen_address TEXT NOT NULL DEFAULT '127.0.0.1', - listen_port INTEGER NOT NULL DEFAULT 5000, enable_logging INTEGER NOT NULL DEFAULT 1, + listen_port INTEGER NOT NULL DEFAULT 15721, enable_logging INTEGER NOT NULL DEFAULT 1, enabled INTEGER NOT NULL DEFAULT 0, auto_failover_enabled INTEGER NOT NULL DEFAULT 0, max_retries INTEGER NOT NULL DEFAULT 3, streaming_first_byte_timeout INTEGER NOT NULL DEFAULT 60, streaming_idle_timeout INTEGER NOT NULL DEFAULT 120, non_streaming_timeout INTEGER NOT NULL DEFAULT 600, @@ -253,7 +253,7 @@ impl Database { [], ); let _ = conn.execute( - "ALTER TABLE proxy_config ADD COLUMN listen_port INTEGER NOT NULL DEFAULT 5000", + "ALTER TABLE proxy_config ADD COLUMN listen_port INTEGER NOT NULL DEFAULT 15721", [], ); let _ = conn.execute( @@ -469,7 +469,7 @@ impl Database { conn, "proxy_config", "listen_port", - "INTEGER NOT NULL DEFAULT 5000", + "INTEGER NOT NULL DEFAULT 15721", )?; Self::add_column_if_missing( conn, @@ -664,7 +664,7 @@ impl Database { conn.execute("CREATE TABLE proxy_config_new ( app_type TEXT PRIMARY KEY CHECK (app_type IN ('claude','codex','gemini')), proxy_enabled INTEGER NOT NULL DEFAULT 0, listen_address TEXT NOT NULL DEFAULT '127.0.0.1', - listen_port INTEGER NOT NULL DEFAULT 5000, enable_logging INTEGER NOT NULL DEFAULT 1, + listen_port INTEGER NOT NULL DEFAULT 15721, enable_logging INTEGER NOT NULL DEFAULT 1, enabled INTEGER NOT NULL DEFAULT 0, auto_failover_enabled INTEGER NOT NULL DEFAULT 0, max_retries INTEGER NOT NULL DEFAULT 3, streaming_first_byte_timeout INTEGER NOT NULL DEFAULT 60, streaming_idle_timeout INTEGER NOT NULL DEFAULT 120, non_streaming_timeout INTEGER NOT NULL DEFAULT 600, diff --git a/src/components/proxy/ProxyPanel.tsx b/src/components/proxy/ProxyPanel.tsx index 537b8ff68..2f41ce501 100644 --- a/src/components/proxy/ProxyPanel.tsx +++ b/src/components/proxy/ProxyPanel.tsx @@ -40,7 +40,7 @@ export function ProxyPanel() { // 监听地址/端口的本地状态 const [listenAddress, setListenAddress] = useState("127.0.0.1"); - const [listenPort, setListenPort] = useState(5000); + const [listenPort, setListenPort] = useState(15721); // 同步全局配置到本地状态 useEffect(() => { @@ -389,7 +389,9 @@ export function ProxyPanel() { id="listen-address" value={listenAddress} onChange={(e) => setListenAddress(e.target.value)} - placeholder="127.0.0.1" + placeholder={t("proxy.settings.fields.listenAddress.placeholder", { + defaultValue: "127.0.0.1", + })} />
{t("proxy.settings.fields.listenAddress.description", { @@ -410,9 +412,11 @@ export function ProxyPanel() { type="number" value={listenPort} onChange={(e) => - setListenPort(parseInt(e.target.value) || 5000) + setListenPort(parseInt(e.target.value) || 15721) } - placeholder="5000" + placeholder={t("proxy.settings.fields.listenPort.placeholder", { + defaultValue: "15721", + })} />
{t("proxy.settings.fields.listenPort.description", { diff --git a/src/components/proxy/ProxyToggle.tsx b/src/components/proxy/ProxyToggle.tsx index 7b007c63c..2b9b8cb9d 100644 --- a/src/components/proxy/ProxyToggle.tsx +++ b/src/components/proxy/ProxyToggle.tsx @@ -23,7 +23,11 @@ export function ProxyToggle({ className, activeApp }: ProxyToggleProps) { useProxyStatus(); const handleToggle = async (checked: boolean) => { - await setTakeoverForApp({ appType: activeApp, enabled: checked }); + try { + await setTakeoverForApp({ appType: activeApp, enabled: checked }); + } catch (error) { + console.error("[ProxyToggle] Toggle takeover failed:", error); + } }; const takeoverEnabled = takeoverStatus?.[activeApp] || false; diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index ef413521c..22de036fc 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1058,7 +1058,7 @@ }, "listenPort": { "label": "Listen Port", - "placeholder": "5000", + "placeholder": "15721", "description": "Port number the proxy server listens on (1024 ~ 65535)" }, "maxRetries": { diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index f5af02997..12effdc8a 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -1058,7 +1058,7 @@ }, "listenPort": { "label": "リッスンポート", - "placeholder": "5000", + "placeholder": "15721", "description": "プロキシサーバーがリッスンするポート番号(1024 ~ 65535)" }, "maxRetries": { diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 690e62482..2ca98528b 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -1058,7 +1058,7 @@ }, "listenPort": { "label": "监听端口", - "placeholder": "5000", + "placeholder": "15721", "description": "代理服务器监听的端口号(1024 ~ 65535)" }, "maxRetries": {