mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 14:19:56 +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) => {
|
return new Promise((resolve, reject) => {
|
||||||
const options = {
|
const options = {
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'CCS-CLIProxyAPI-Updater/1.0',
|
'User-Agent': 'CCS-CLIProxyPlus-Updater/1.0',
|
||||||
Accept: 'application/vnd.github.v3+json',
|
Accept: 'application/vnd.github.v3+json',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export async function downloadAndInstall(
|
|||||||
|
|
||||||
fs.mkdirSync(config.binPath, { recursive: true });
|
fs.mkdirSync(config.binPath, { recursive: true });
|
||||||
const archivePath = path.join(config.binPath, `cliproxy-archive.${platform.extension}`);
|
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();
|
spinner.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -64,7 +64,7 @@ export async function downloadAndInstall(
|
|||||||
|
|
||||||
spinner.update('Extracting binary');
|
spinner.update('Extracting binary');
|
||||||
await extractArchive(archivePath, config.binPath, platform.extension, verbose);
|
await extractArchive(archivePath, config.binPath, platform.extension, verbose);
|
||||||
spinner.succeed('CLIProxyAPI ready');
|
spinner.succeed('CLIProxy Plus ready');
|
||||||
fs.unlinkSync(archivePath);
|
fs.unlinkSync(archivePath);
|
||||||
|
|
||||||
const binaryPath = path.join(config.binPath, getExecutableName());
|
const binaryPath = path.join(config.binPath, getExecutableName());
|
||||||
@@ -74,7 +74,7 @@ export async function downloadAndInstall(
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeInstalledVersion(config.binPath, config.version);
|
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) {
|
} catch (error) {
|
||||||
spinner.fail('Installation failed');
|
spinner.fail('Installation failed');
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ async function handleAutoUpdate(config: BinaryManagerConfig, verbose: boolean):
|
|||||||
if (!updateResult.hasUpdate) return;
|
if (!updateResult.hasUpdate) return;
|
||||||
|
|
||||||
const proxyRunning = await isCliproxyRunning(CLIPROXY_DEFAULT_PORT);
|
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) {
|
if (proxyRunning) {
|
||||||
console.log(info(updateMsg));
|
console.log(info(updateMsg));
|
||||||
console.log(info('Run "ccs cliproxy stop" then restart to apply update'));
|
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 {
|
} else {
|
||||||
console.log(info(updateMsg));
|
console.log(info(updateMsg));
|
||||||
console.log(info('Updating CLIProxyAPI...'));
|
console.log(info('Updating CLIProxy Plus...'));
|
||||||
deleteBinary(config.binPath, verbose);
|
deleteBinary(config.binPath, verbose);
|
||||||
config.version = updateResult.latestVersion;
|
config.version = updateResult.latestVersion;
|
||||||
await downloadAndInstall(config, verbose);
|
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 extension: ArchiveExtension = os === 'windows' ? 'zip' : 'tar.gz';
|
||||||
const binaryName = `CLIProxyAPI_${version}_${os}_${arch}.${extension}`;
|
const binaryName = `CLIProxyAPIPlus_${version}_${os}_${arch}.${extension}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
os,
|
os,
|
||||||
@@ -70,11 +70,11 @@ export function detectPlatform(version: string = CLIPROXY_FALLBACK_VERSION): Pla
|
|||||||
/**
|
/**
|
||||||
* Get executable name based on platform
|
* Get executable name based on platform
|
||||||
* @returns Binary executable name (with .exe on Windows)
|
* @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 {
|
export function getExecutableName(): string {
|
||||||
const platform = detectPlatform();
|
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 {
|
export function getArchiveBinaryName(): string {
|
||||||
const platform = detectPlatform();
|
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 {
|
export function getDownloadUrl(version: string = CLIPROXY_FALLBACK_VERSION): string {
|
||||||
const platform = detectPlatform(version);
|
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}`;
|
return `${baseUrl}/${platform.binaryName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ export function getDownloadUrl(version: string = CLIPROXY_FALLBACK_VERSION): str
|
|||||||
* @returns Full URL to checksums.txt
|
* @returns Full URL to checksums.txt
|
||||||
*/
|
*/
|
||||||
export function getChecksumsUrl(version: string = CLIPROXY_FALLBACK_VERSION): string {
|
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