mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 18:18:43 +00:00
fix(cliproxy): use double-dash flags for cliproxyapi auth (#24)
CLIProxyAPI updated from single-dash to double-dash CLI flags. Changed -login to --login, -codex-login to --codex-login, -antigravity-login to --antigravity-login, -config to --config, and -no-browser to --no-browser.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
* 1. Check if auth exists (token files in CCS auth directory)
|
* 1. Check if auth exists (token files in CCS auth directory)
|
||||||
* 2. Trigger OAuth flow by spawning binary with auth flag
|
* 2. Trigger OAuth flow by spawning binary with auth flag
|
||||||
* 3. Auto-detect headless environments (SSH, no DISPLAY)
|
* 3. Auto-detect headless environments (SSH, no DISPLAY)
|
||||||
* 4. Use -no-browser flag for headless, display OAuth URL for manual auth
|
* 4. Use --no-browser flag for headless, display OAuth URL for manual auth
|
||||||
*
|
*
|
||||||
* Token storage: ~/.ccs/cliproxy/auth/<provider>/
|
* Token storage: ~/.ccs/cliproxy/auth/<provider>/
|
||||||
* Each provider has its own directory to avoid conflicts.
|
* Each provider has its own directory to avoid conflicts.
|
||||||
@@ -84,21 +84,21 @@ const OAUTH_CONFIGS: Record<CLIProxyProvider, ProviderOAuthConfig> = {
|
|||||||
displayName: 'Google Gemini',
|
displayName: 'Google Gemini',
|
||||||
authUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
authUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
||||||
scopes: ['https://www.googleapis.com/auth/generative-language'],
|
scopes: ['https://www.googleapis.com/auth/generative-language'],
|
||||||
authFlag: '-login',
|
authFlag: '--login',
|
||||||
},
|
},
|
||||||
codex: {
|
codex: {
|
||||||
provider: 'codex',
|
provider: 'codex',
|
||||||
displayName: 'Codex',
|
displayName: 'Codex',
|
||||||
authUrl: 'https://auth.openai.com/authorize',
|
authUrl: 'https://auth.openai.com/authorize',
|
||||||
scopes: ['openid', 'profile'],
|
scopes: ['openid', 'profile'],
|
||||||
authFlag: '-codex-login',
|
authFlag: '--codex-login',
|
||||||
},
|
},
|
||||||
agy: {
|
agy: {
|
||||||
provider: 'agy',
|
provider: 'agy',
|
||||||
displayName: 'Antigravity',
|
displayName: 'Antigravity',
|
||||||
authUrl: 'https://antigravity.ai/oauth/authorize',
|
authUrl: 'https://antigravity.ai/oauth/authorize',
|
||||||
scopes: ['api'],
|
scopes: ['api'],
|
||||||
authFlag: '-antigravity-login',
|
authFlag: '--antigravity-login',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ export function clearAuth(provider: CLIProxyProvider): boolean {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger OAuth flow for provider
|
* Trigger OAuth flow for provider
|
||||||
* Auto-detects headless environment and uses -no-browser flag accordingly
|
* Auto-detects headless environment and uses --no-browser flag accordingly
|
||||||
*/
|
*/
|
||||||
export async function triggerOAuth(
|
export async function triggerOAuth(
|
||||||
provider: CLIProxyProvider,
|
provider: CLIProxyProvider,
|
||||||
@@ -319,10 +319,10 @@ export async function triggerOAuth(
|
|||||||
const configPath = generateConfig(provider);
|
const configPath = generateConfig(provider);
|
||||||
log(`Config generated: ${configPath}`);
|
log(`Config generated: ${configPath}`);
|
||||||
|
|
||||||
// Build args: config + auth flag + optional -no-browser for headless
|
// Build args: config + auth flag + optional --no-browser for headless
|
||||||
const args = ['-config', configPath, oauthConfig.authFlag];
|
const args = ['--config', configPath, oauthConfig.authFlag];
|
||||||
if (headless) {
|
if (headless) {
|
||||||
args.push('-no-browser');
|
args.push('--no-browser');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show appropriate message
|
// Show appropriate message
|
||||||
@@ -343,7 +343,7 @@ export async function triggerOAuth(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise<boolean>((resolve) => {
|
return new Promise<boolean>((resolve) => {
|
||||||
// Spawn CLIProxyAPI with auth flag (and -no-browser if headless)
|
// Spawn CLIProxyAPI with auth flag (and --no-browser if headless)
|
||||||
const authProcess = spawn(binaryPath, args, {
|
const authProcess = spawn(binaryPath, args, {
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
env: {
|
env: {
|
||||||
|
|||||||
Reference in New Issue
Block a user