mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 08:17:11 +00:00
fix(cliproxy): sanitize local port before config regeneration (#1342)
This commit is contained in:
@@ -155,8 +155,9 @@ router.put('/backend', (req: Request, res: Response) => {
|
||||
// Pre-flight read: check running state before acquiring write lock
|
||||
const currentConfig = loadOrCreateUnifiedConfig();
|
||||
const currentBackend = currentConfig.cliproxy?.backend ?? DEFAULT_BACKEND;
|
||||
const localPort =
|
||||
currentConfig.cliproxy_server?.local?.port ?? DEFAULT_CLIPROXY_SERVER_CONFIG.local.port;
|
||||
const localPort = validatePort(
|
||||
currentConfig.cliproxy_server?.local?.port ?? DEFAULT_CLIPROXY_SERVER_CONFIG.local.port
|
||||
);
|
||||
if (currentBackend !== backend && isProxyRunning() && !force) {
|
||||
res.status(409).json({
|
||||
error: 'Proxy is running. Stop proxy first or use force=true to change backend.',
|
||||
|
||||
Reference in New Issue
Block a user