mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 04:17:11 +00:00
fix: update download URLs and binary names for CLIProxyAPIPlus
- Change binaryName from CLIProxyAPI_ to CLIProxyAPIPlus_ prefix - Update download URL to use CLIProxyAPIPlus repository - Update checksums URL to use CLIProxyAPIPlus repository - Change executable name from cli-proxy-api to cli-proxy-api-plus - Update User-Agent header to CCS-CLIProxyPlus-Updater - Update status messages to say "CLIProxy Plus" Fixes HTTP 404 error when running `ccs cliproxy --latest`
This commit is contained in:
@@ -180,7 +180,7 @@ export function fetchJson(url: string, verbose = false): Promise<Record<string,
|
||||
return new Promise((resolve, reject) => {
|
||||
const options = {
|
||||
headers: {
|
||||
'User-Agent': 'CCS-CLIProxyAPI-Updater/1.0',
|
||||
'User-Agent': 'CCS-CLIProxyPlus-Updater/1.0',
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function downloadAndInstall(
|
||||
|
||||
fs.mkdirSync(config.binPath, { recursive: true });
|
||||
const archivePath = path.join(config.binPath, `cliproxy-archive.${platform.extension}`);
|
||||
const spinner = new ProgressIndicator(`Downloading CLIProxyAPI v${config.version}`);
|
||||
const spinner = new ProgressIndicator(`Downloading CLIProxy Plus v${config.version}`);
|
||||
spinner.start();
|
||||
|
||||
try {
|
||||
@@ -64,7 +64,7 @@ export async function downloadAndInstall(
|
||||
|
||||
spinner.update('Extracting binary');
|
||||
await extractArchive(archivePath, config.binPath, platform.extension, verbose);
|
||||
spinner.succeed('CLIProxyAPI ready');
|
||||
spinner.succeed('CLIProxy Plus ready');
|
||||
fs.unlinkSync(archivePath);
|
||||
|
||||
const binaryPath = path.join(config.binPath, getExecutableName());
|
||||
@@ -74,7 +74,7 @@ export async function downloadAndInstall(
|
||||
}
|
||||
|
||||
writeInstalledVersion(config.binPath, config.version);
|
||||
console.log(ok(`CLIProxyAPI v${config.version} installed successfully`));
|
||||
console.log(ok(`CLIProxy Plus v${config.version} installed successfully`));
|
||||
} catch (error) {
|
||||
spinner.fail('Installation failed');
|
||||
throw error;
|
||||
|
||||
@@ -22,15 +22,15 @@ async function handleAutoUpdate(config: BinaryManagerConfig, verbose: boolean):
|
||||
if (!updateResult.hasUpdate) return;
|
||||
|
||||
const proxyRunning = await isCliproxyRunning(CLIPROXY_DEFAULT_PORT);
|
||||
const updateMsg = `CLIProxyAPI update available: v${updateResult.currentVersion} -> v${updateResult.latestVersion}`;
|
||||
const updateMsg = `CLIProxy Plus update available: v${updateResult.currentVersion} -> v${updateResult.latestVersion}`;
|
||||
|
||||
if (proxyRunning) {
|
||||
console.log(info(updateMsg));
|
||||
console.log(info('Run "ccs cliproxy stop" then restart to apply update'));
|
||||
log('Skipping update: CLIProxyAPI is currently running', verbose);
|
||||
log('Skipping update: CLIProxy Plus is currently running', verbose);
|
||||
} else {
|
||||
console.log(info(updateMsg));
|
||||
console.log(info('Updating CLIProxyAPI...'));
|
||||
console.log(info('Updating CLIProxy Plus...'));
|
||||
deleteBinary(config.binPath, verbose);
|
||||
config.version = updateResult.latestVersion;
|
||||
await downloadAndInstall(config, verbose);
|
||||
|
||||
@@ -57,7 +57,7 @@ export function detectPlatform(version: string = CLIPROXY_FALLBACK_VERSION): Pla
|
||||
}
|
||||
|
||||
const extension: ArchiveExtension = os === 'windows' ? 'zip' : 'tar.gz';
|
||||
const binaryName = `CLIProxyAPI_${version}_${os}_${arch}.${extension}`;
|
||||
const binaryName = `CLIProxyAPIPlus_${version}_${os}_${arch}.${extension}`;
|
||||
|
||||
return {
|
||||
os,
|
||||
@@ -70,11 +70,11 @@ export function detectPlatform(version: string = CLIPROXY_FALLBACK_VERSION): Pla
|
||||
/**
|
||||
* Get executable name based on platform
|
||||
* @returns Binary executable name (with .exe on Windows)
|
||||
* Note: The actual binary inside the archive is named 'cli-proxy-api'
|
||||
* Note: The actual binary inside the archive is named 'cli-proxy-api-plus'
|
||||
*/
|
||||
export function getExecutableName(): string {
|
||||
const platform = detectPlatform();
|
||||
return platform.os === 'windows' ? 'cli-proxy-api.exe' : 'cli-proxy-api';
|
||||
return platform.os === 'windows' ? 'cli-proxy-api-plus.exe' : 'cli-proxy-api-plus';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ export function getExecutableName(): string {
|
||||
*/
|
||||
export function getArchiveBinaryName(): string {
|
||||
const platform = detectPlatform();
|
||||
return platform.os === 'windows' ? 'cli-proxy-api.exe' : 'cli-proxy-api';
|
||||
return platform.os === 'windows' ? 'cli-proxy-api-plus.exe' : 'cli-proxy-api-plus';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ export function getArchiveBinaryName(): string {
|
||||
*/
|
||||
export function getDownloadUrl(version: string = CLIPROXY_FALLBACK_VERSION): string {
|
||||
const platform = detectPlatform(version);
|
||||
const baseUrl = `https://github.com/router-for-me/CLIProxyAPI/releases/download/v${version}`;
|
||||
const baseUrl = `https://github.com/router-for-me/CLIProxyAPIPlus/releases/download/v${version}`;
|
||||
return `${baseUrl}/${platform.binaryName}`;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export function getDownloadUrl(version: string = CLIPROXY_FALLBACK_VERSION): str
|
||||
* @returns Full URL to checksums.txt
|
||||
*/
|
||||
export function getChecksumsUrl(version: string = CLIPROXY_FALLBACK_VERSION): string {
|
||||
return `https://github.com/router-for-me/CLIProxyAPI/releases/download/v${version}/checksums.txt`;
|
||||
return `https://github.com/router-for-me/CLIProxyAPIPlus/releases/download/v${version}/checksums.txt`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user