mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 08:18:04 +00:00
feat(proxy): improve remote proxy UX defaults
- Change HTTP default port from 80 to 8317 (CLIProxyAPI default) - Keep HTTPS default at 443 (standard SSL behind reverse proxy) - Hide Local Proxy section when in Remote mode to reduce confusion
This commit is contained in:
1 parent
5e1d290865
commit
116b6a15b0
2 files changed
+38
-34
No files matched your search
@@ -48,9 +48,10 @@ const DEFAULT_TIMEOUT_MS = 2000;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get default port for protocol
|
* Get default port for protocol
|
||||||
|
* HTTP defaults to 8317 (CLIProxyAPI default), HTTPS to 443 (standard SSL)
|
||||||
*/
|
*/
|
||||||
function getDefaultPort(protocol: 'http' | 'https'): number {
|
function getDefaultPort(protocol: 'http' | 'https'): number {
|
||||||
return protocol === 'https' ? 443 : 80;
|
return protocol === 'https' ? 443 : 8317;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+36
-33
@@ -1322,7 +1322,8 @@ function ProxyContent({
|
|||||||
const defaultLocal = { port: 8317, auto_start: true };
|
const defaultLocal = { port: 8317, auto_start: true };
|
||||||
|
|
||||||
// Helper to get default port based on protocol
|
// Helper to get default port based on protocol
|
||||||
const getDefaultPort = (protocol: 'http' | 'https') => (protocol === 'https' ? 443 : 80);
|
// HTTP defaults to 8317 (CLIProxyAPI default), HTTPS to 443 (standard SSL)
|
||||||
|
const getDefaultPort = (protocol: 'http' | 'https') => (protocol === 'https' ? 443 : 8317);
|
||||||
|
|
||||||
// Sync local state with config (using refs to avoid lint warnings)
|
// Sync local state with config (using refs to avoid lint warnings)
|
||||||
const hostInput = config?.remote.host ?? '';
|
const hostInput = config?.remote.host ?? '';
|
||||||
@@ -1650,42 +1651,44 @@ function ProxyContent({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Local Proxy Settings */}
|
{/* Local Proxy Settings - Only show in Local mode */}
|
||||||
<div className="space-y-3">
|
{!isRemoteMode && (
|
||||||
<h3 className="text-base font-medium">Local Proxy</h3>
|
<div className="space-y-3">
|
||||||
<div className="space-y-3 p-4 rounded-lg border bg-muted/30">
|
<h3 className="text-base font-medium">Local Proxy</h3>
|
||||||
{/* Port */}
|
<div className="space-y-3 p-4 rounded-lg border bg-muted/30">
|
||||||
<div className="space-y-1">
|
{/* Port */}
|
||||||
<label className="text-sm text-muted-foreground">Port</label>
|
<div className="space-y-1">
|
||||||
<Input
|
<label className="text-sm text-muted-foreground">Port</label>
|
||||||
type="number"
|
<Input
|
||||||
value={displayLocalPort}
|
type="number"
|
||||||
onChange={(e) => setEditedLocalPort(e.target.value)}
|
value={displayLocalPort}
|
||||||
onBlur={saveLocalPort}
|
onChange={(e) => setEditedLocalPort(e.target.value)}
|
||||||
placeholder="8317"
|
onBlur={saveLocalPort}
|
||||||
className="font-mono max-w-32"
|
placeholder="8317"
|
||||||
disabled={saving}
|
className="font-mono max-w-32"
|
||||||
/>
|
disabled={saving}
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Auto-start */}
|
{/* Auto-start */}
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium text-sm">Auto-start</p>
|
<p className="font-medium text-sm">Auto-start</p>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Start local proxy automatically when needed
|
Start local proxy automatically when needed
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={config?.local.auto_start ?? true}
|
||||||
|
onCheckedChange={(checked) =>
|
||||||
|
saveCliproxyServerConfig({ local: { ...localConfig, auto_start: checked } })
|
||||||
|
}
|
||||||
|
disabled={saving}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Switch
|
|
||||||
checked={config?.local.auto_start ?? true}
|
|
||||||
onCheckedChange={(checked) =>
|
|
||||||
saveCliproxyServerConfig({ local: { ...localConfig, auto_start: checked } })
|
|
||||||
}
|
|
||||||
disabled={saving}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</div>
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user