mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 14:19:56 +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
|
// Pre-flight read: check running state before acquiring write lock
|
||||||
const currentConfig = loadOrCreateUnifiedConfig();
|
const currentConfig = loadOrCreateUnifiedConfig();
|
||||||
const currentBackend = currentConfig.cliproxy?.backend ?? DEFAULT_BACKEND;
|
const currentBackend = currentConfig.cliproxy?.backend ?? DEFAULT_BACKEND;
|
||||||
const localPort =
|
const localPort = validatePort(
|
||||||
currentConfig.cliproxy_server?.local?.port ?? DEFAULT_CLIPROXY_SERVER_CONFIG.local.port;
|
currentConfig.cliproxy_server?.local?.port ?? DEFAULT_CLIPROXY_SERVER_CONFIG.local.port
|
||||||
|
);
|
||||||
if (currentBackend !== backend && isProxyRunning() && !force) {
|
if (currentBackend !== backend && isProxyRunning() && !force) {
|
||||||
res.status(409).json({
|
res.status(409).json({
|
||||||
error: 'Proxy is running. Stop proxy first or use force=true to change backend.',
|
error: 'Proxy is running. Stop proxy first or use force=true to change backend.',
|
||||||
|
|||||||
Reference in New Issue
Block a user