mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 16:19:27 +00:00
fix(doctor): use actual installed clipproxy version instead of hardcoded
This commit is contained in:
@@ -900,4 +900,20 @@ export function getCLIProxyPath(): string {
|
|||||||
return manager.getBinaryPath();
|
return manager.getBinaryPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get installed CLIProxyAPI version from .version file
|
||||||
|
* Returns the fallback version if not installed or version file missing
|
||||||
|
*/
|
||||||
|
export function getInstalledCliproxyVersion(): string {
|
||||||
|
const versionFile = path.join(getBinDir(), '.version');
|
||||||
|
if (fs.existsSync(versionFile)) {
|
||||||
|
try {
|
||||||
|
return fs.readFileSync(versionFile, 'utf8').trim();
|
||||||
|
} catch {
|
||||||
|
return CLIPROXY_FALLBACK_VERSION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CLIPROXY_FALLBACK_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
export default BinaryManager;
|
export default BinaryManager;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export {
|
|||||||
ensureCLIProxyBinary,
|
ensureCLIProxyBinary,
|
||||||
isCLIProxyInstalled,
|
isCLIProxyInstalled,
|
||||||
getCLIProxyPath,
|
getCLIProxyPath,
|
||||||
|
getInstalledCliproxyVersion,
|
||||||
} from './binary-manager';
|
} from './binary-manager';
|
||||||
|
|
||||||
// Config generation
|
// Config generation
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
isPortAvailable,
|
isPortAvailable,
|
||||||
getAllAuthStatus,
|
getAllAuthStatus,
|
||||||
getConfigPath,
|
getConfigPath,
|
||||||
CLIPROXY_VERSION,
|
getInstalledCliproxyVersion,
|
||||||
CLIPROXY_DEFAULT_PORT,
|
CLIPROXY_DEFAULT_PORT,
|
||||||
} from '../cliproxy';
|
} from '../cliproxy';
|
||||||
|
|
||||||
@@ -775,11 +775,12 @@ class Doctor {
|
|||||||
|
|
||||||
if (isCLIProxyInstalled()) {
|
if (isCLIProxyInstalled()) {
|
||||||
const binaryPath = getCLIProxyPath();
|
const binaryPath = getCLIProxyPath();
|
||||||
|
const installedVersion = getInstalledCliproxyVersion();
|
||||||
binarySpinner.succeed();
|
binarySpinner.succeed();
|
||||||
console.log(` ${ok('CLIProxy Binary'.padEnd(22))} v${CLIPROXY_VERSION}`);
|
console.log(` ${ok('CLIProxy Binary'.padEnd(22))} v${installedVersion}`);
|
||||||
this.results.addCheck('CLIProxy Binary', 'success', undefined, undefined, {
|
this.results.addCheck('CLIProxy Binary', 'success', undefined, undefined, {
|
||||||
status: 'OK',
|
status: 'OK',
|
||||||
info: `v${CLIPROXY_VERSION} (${binaryPath})`,
|
info: `v${installedVersion} (${binaryPath})`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
binarySpinner.info();
|
binarySpinner.info();
|
||||||
|
|||||||
Reference in New Issue
Block a user