mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 20:17:45 +00:00
feat(cliproxy): migrate from CLIProxyAPI to CLIProxyAPIPlus
- Update GitHub repo URL to router-for-me/CLIProxyAPIPlus - Handle new release naming pattern (v6.6.X-0 suffix) - Add version comparison support for Plus releases
This commit is contained in:
@@ -25,10 +25,10 @@ import {
|
||||
ensureBinary,
|
||||
} from './binary';
|
||||
|
||||
/** Default configuration */
|
||||
/** Default configuration (uses CLIProxyAPIPlus fork with Kiro + Copilot support) */
|
||||
const DEFAULT_CONFIG: BinaryManagerConfig = {
|
||||
version: CLIPROXY_FALLBACK_VERSION,
|
||||
releaseUrl: 'https://github.com/router-for-me/CLIProxyAPI/releases/download',
|
||||
releaseUrl: 'https://github.com/router-for-me/CLIProxyAPIPlus/releases/download',
|
||||
binPath: getBinDir(),
|
||||
maxRetries: 3,
|
||||
verbose: false,
|
||||
|
||||
@@ -24,6 +24,6 @@ export const VERSION_CACHE_DURATION_MS = 60 * 60 * 1000;
|
||||
/** Version pin file name - stores user's explicit version choice */
|
||||
export const VERSION_PIN_FILE = '.version-pin';
|
||||
|
||||
/** GitHub API URL for latest release */
|
||||
/** GitHub API URL for latest release (CLIProxyAPIPlus fork with Kiro + Copilot support) */
|
||||
export const GITHUB_API_LATEST_RELEASE =
|
||||
'https://api.github.com/repos/router-for-me/CLIProxyAPI/releases/latest';
|
||||
'https://api.github.com/repos/router-for-me/CLIProxyAPIPlus/releases/latest';
|
||||
|
||||
@@ -9,10 +9,15 @@ import { UpdateCheckResult, GITHUB_API_LATEST_RELEASE } from './types';
|
||||
|
||||
/**
|
||||
* Compare semver versions (true if latest > current)
|
||||
* Handles CLIProxyAPIPlus versioning: strips -0 suffix before comparison
|
||||
*/
|
||||
export function isNewerVersion(latest: string, current: string): boolean {
|
||||
const latestParts = latest.split('.').map((p) => parseInt(p, 10) || 0);
|
||||
const currentParts = current.split('.').map((p) => parseInt(p, 10) || 0);
|
||||
// Strip -0 suffix from CLIProxyAPIPlus versions (e.g., "6.6.40-0" -> "6.6.40")
|
||||
const cleanLatest = latest.replace(/-\d+$/, '');
|
||||
const cleanCurrent = current.replace(/-\d+$/, '');
|
||||
|
||||
const latestParts = cleanLatest.split('.').map((p) => parseInt(p, 10) || 0);
|
||||
const currentParts = cleanCurrent.split('.').map((p) => parseInt(p, 10) || 0);
|
||||
|
||||
// Pad arrays to same length
|
||||
while (latestParts.length < 3) latestParts.push(0);
|
||||
|
||||
Reference in New Issue
Block a user