mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 08:17:11 +00:00
fix(cliproxy): complete backend param propagation per code review
- Add backend param to checkLatestVersion() - Add backend param to isPinned(), getPinned(), clearPin() wrappers - Use getBackendLabel() consistently in showStatus() Addresses review feedback from PR #359.
This commit is contained in:
@@ -70,10 +70,13 @@ export function getBinaryStatus(backend?: CLIProxyBackend): BinaryStatusResult {
|
||||
/**
|
||||
* Check for latest version
|
||||
*/
|
||||
export async function checkLatestVersion(): Promise<LatestVersionResult> {
|
||||
export async function checkLatestVersion(backend?: CLIProxyBackend): Promise<LatestVersionResult> {
|
||||
const effectiveBackend =
|
||||
backend ?? loadOrCreateUnifiedConfig().cliproxy?.backend ?? DEFAULT_BACKEND;
|
||||
|
||||
try {
|
||||
const latestVersion = await fetchLatestCliproxyVersion();
|
||||
const currentVersion = getInstalledCliproxyVersion();
|
||||
const currentVersion = getInstalledCliproxyVersion(effectiveBackend);
|
||||
const updateAvailable = latestVersion !== currentVersion;
|
||||
|
||||
return {
|
||||
@@ -177,20 +180,26 @@ export async function installLatest(
|
||||
/**
|
||||
* Check if a version is pinned
|
||||
*/
|
||||
export function isPinned(): boolean {
|
||||
return isVersionPinned();
|
||||
export function isPinned(backend?: CLIProxyBackend): boolean {
|
||||
const effectiveBackend =
|
||||
backend ?? loadOrCreateUnifiedConfig().cliproxy?.backend ?? DEFAULT_BACKEND;
|
||||
return isVersionPinned(effectiveBackend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pinned version if any
|
||||
*/
|
||||
export function getPinned(): string | null {
|
||||
return getPinnedVersion();
|
||||
export function getPinned(backend?: CLIProxyBackend): string | null {
|
||||
const effectiveBackend =
|
||||
backend ?? loadOrCreateUnifiedConfig().cliproxy?.backend ?? DEFAULT_BACKEND;
|
||||
return getPinnedVersion(effectiveBackend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear version pin
|
||||
*/
|
||||
export function clearPin(): void {
|
||||
clearPinnedVersion();
|
||||
export function clearPin(backend?: CLIProxyBackend): void {
|
||||
const effectiveBackend =
|
||||
backend ?? loadOrCreateUnifiedConfig().cliproxy?.backend ?? DEFAULT_BACKEND;
|
||||
clearPinnedVersion(effectiveBackend);
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ async function showStatus(verbose: boolean, backend: CLIProxyBackend): Promise<v
|
||||
const status = getBinaryStatus(backend);
|
||||
|
||||
console.log('');
|
||||
const backendLabel = backend === 'plus' ? 'CLIProxy Plus' : 'CLIProxy (Original)';
|
||||
const backendLabel = getBackendLabel(backend);
|
||||
console.log(color(`${backendLabel} Status`, 'primary'));
|
||||
console.log('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user