mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 22:17:14 +00:00
refactor(cliproxy): use shared default port in management paths
- replace 8317 literals with CLIPROXY_DEFAULT_PORT constant - keep http/https fallback behavior unchanged in runtime checks
This commit is contained in:
@@ -16,13 +16,11 @@ import type {
|
|||||||
RemoteModelInfo,
|
RemoteModelInfo,
|
||||||
GetModelDefinitionsResponse,
|
GetModelDefinitionsResponse,
|
||||||
} from './management-api-types';
|
} from './management-api-types';
|
||||||
|
import { CLIPROXY_DEFAULT_PORT } from './config/port-manager';
|
||||||
|
|
||||||
/** Default timeout for management operations (longer than health check) */
|
/** Default timeout for management operations (longer than health check) */
|
||||||
const DEFAULT_TIMEOUT_MS = 5000;
|
const DEFAULT_TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
/** Default port for HTTP protocol */
|
|
||||||
const DEFAULT_HTTP_PORT = 8317;
|
|
||||||
|
|
||||||
/** Default port for HTTPS protocol */
|
/** Default port for HTTPS protocol */
|
||||||
const DEFAULT_HTTPS_PORT = 443;
|
const DEFAULT_HTTPS_PORT = 443;
|
||||||
|
|
||||||
@@ -33,7 +31,7 @@ function getEffectivePort(port: number | undefined, protocol: 'http' | 'https'):
|
|||||||
if (port !== undefined && Number.isInteger(port) && port > 0 && port <= 65535) {
|
if (port !== undefined && Number.isInteger(port) && port > 0 && port <= 65535) {
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
return protocol === 'https' ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT;
|
return protocol === 'https' ? DEFAULT_HTTPS_PORT : CLIPROXY_DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import {
|
|||||||
DEFAULT_BACKEND,
|
DEFAULT_BACKEND,
|
||||||
} from '../../cliproxy/platform-detector';
|
} from '../../cliproxy/platform-detector';
|
||||||
import { loadOrCreateUnifiedConfig } from '../../config/unified-config-loader';
|
import { loadOrCreateUnifiedConfig } from '../../config/unified-config-loader';
|
||||||
|
import { CLIPROXY_DEFAULT_PORT } from '../../cliproxy/config/port-manager';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ router.get('/proxy-status', async (_req: Request, res: Response): Promise<void>
|
|||||||
// Proxy running but no session lock - legacy/untracked instance
|
// Proxy running but no session lock - legacy/untracked instance
|
||||||
res.json({
|
res.json({
|
||||||
running: true,
|
running: true,
|
||||||
port: 8317, // Default port
|
port: CLIPROXY_DEFAULT_PORT,
|
||||||
sessionCount: 0, // Unknown sessions
|
sessionCount: 0, // Unknown sessions
|
||||||
// No pid/startedAt since we don't have session lock
|
// No pid/startedAt since we don't have session lock
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user