mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 10:16:49 +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,
|
||||
GetModelDefinitionsResponse,
|
||||
} from './management-api-types';
|
||||
import { CLIPROXY_DEFAULT_PORT } from './config/port-manager';
|
||||
|
||||
/** Default timeout for management operations (longer than health check) */
|
||||
const DEFAULT_TIMEOUT_MS = 5000;
|
||||
|
||||
/** Default port for HTTP protocol */
|
||||
const DEFAULT_HTTP_PORT = 8317;
|
||||
|
||||
/** Default port for HTTPS protocol */
|
||||
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) {
|
||||
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,
|
||||
} from '../../cliproxy/platform-detector';
|
||||
import { loadOrCreateUnifiedConfig } from '../../config/unified-config-loader';
|
||||
import { CLIPROXY_DEFAULT_PORT } from '../../cliproxy/config/port-manager';
|
||||
|
||||
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
|
||||
res.json({
|
||||
running: true,
|
||||
port: 8317, // Default port
|
||||
port: CLIPROXY_DEFAULT_PORT,
|
||||
sessionCount: 0, // Unknown sessions
|
||||
// No pid/startedAt since we don't have session lock
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user