mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 02:11:28 +00:00
refactor(ui): use shared default proxy port in settings cards
- replace inline 8317 defaults with CLIPROXY_DEFAULT_PORT - keep HTTPS fallback behavior at 443 unchanged
This commit is contained in:
@@ -24,6 +24,7 @@ import { LocalProxyCard } from './local-proxy-card';
|
||||
import { RemoteProxyCard } from './remote-proxy-card';
|
||||
import { ProxyStatusWidget } from '@/components/monitoring/proxy-status-widget';
|
||||
import { api } from '@/lib/api-client';
|
||||
import { CLIPROXY_DEFAULT_PORT } from '@/lib/preset-utils';
|
||||
|
||||
/** LocalStorage key for debug mode preference */
|
||||
const DEBUG_MODE_KEY = 'ccs_debug_mode';
|
||||
@@ -165,7 +166,7 @@ export default function ProxySection() {
|
||||
const portInput = config.remote.port !== undefined ? config.remote.port.toString() : '';
|
||||
const authTokenInput = config.remote.auth_token ?? '';
|
||||
const managementKeyInput = config.remote.management_key ?? '';
|
||||
const localPortInput = (config.local.port ?? 8317).toString();
|
||||
const localPortInput = (config.local.port ?? CLIPROXY_DEFAULT_PORT).toString();
|
||||
|
||||
const displayHost = editedHost ?? hostInput;
|
||||
const displayPort = editedPort ?? portInput;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { CLIPROXY_DEFAULT_PORT } from '@/lib/preset-utils';
|
||||
import type { CliproxyServerConfig } from '../../types';
|
||||
|
||||
interface LocalProxyCardProps {
|
||||
@@ -38,7 +39,7 @@ export function LocalProxyCard({
|
||||
value={displayLocalPort}
|
||||
onChange={(e) => setEditedLocalPort(e.target.value)}
|
||||
onBlur={onSaveLocalPort}
|
||||
placeholder="8317"
|
||||
placeholder={`${CLIPROXY_DEFAULT_PORT}`}
|
||||
className="font-mono max-w-32"
|
||||
disabled={saving}
|
||||
/>
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { Cloud, RefreshCw, Wifi, WifiOff, CheckCircle2 } from 'lucide-react';
|
||||
import { CLIPROXY_DEFAULT_PORT } from '@/lib/preset-utils';
|
||||
import type { CliproxyServerConfig, RemoteProxyStatus } from '../../types';
|
||||
|
||||
interface RemoteProxyCardProps {
|
||||
@@ -59,7 +60,8 @@ export function RemoteProxyCard({
|
||||
const remoteConfig = config.remote;
|
||||
|
||||
// HTTP defaults to 8317 (CLIProxyAPI default), HTTPS to 443 (standard SSL)
|
||||
const getDefaultPort = (protocol: 'http' | 'https') => (protocol === 'https' ? 443 : 8317);
|
||||
const getDefaultPort = (protocol: 'http' | 'https') =>
|
||||
protocol === 'https' ? 443 : CLIPROXY_DEFAULT_PORT;
|
||||
|
||||
return (
|
||||
<div className="space-y-4 p-4 rounded-lg border bg-muted/30">
|
||||
|
||||
Reference in New Issue
Block a user