diff --git a/src/cli.rs b/src/cli.rs index 6f03f8c..9e3005a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -45,8 +45,6 @@ pub enum Commands { #[arg(long)] json: bool, }, - /// Refresh OAuth tokens for a saved account. - RefreshToken { account: String }, /// Account management commands. Account { #[command(subcommand)] diff --git a/src/main.rs b/src/main.rs index 0cf224c..673f2bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -79,7 +79,6 @@ async fn main() -> Result<()> { .await } Commands::Quota { accounts, json } => quota::quota_command(accounts, json).await, - Commands::RefreshToken { account } => token::refresh_token_command(&account).await, Commands::Account { command } => match command { AccountCommands::List { json, force } => account::list_accounts(json, force).await, AccountCommands::Current { json } => account::current_account(json), diff --git a/src/token.rs b/src/token.rs index b7d936c..78e5e31 100644 --- a/src/token.rs +++ b/src/token.rs @@ -14,20 +14,6 @@ const CLIENT_ID: &str = "app_EMoamEEZ73f0CkXaXp7hrann"; const TOKEN_ENDPOINT: &str = "https://auth.openai.com/oauth/token"; const TOKEN_REFRESH_SKEW_SECONDS: i64 = 300; -pub async fn refresh_token_command(query: &str) -> Result<()> { - let home = crate::paths::codex_home(None)?; - let mut store = Store::load(&home)?; - let account_id = store - .find_account(query) - .ok_or_else(|| anyhow!("账号不存在: {query}"))? - .id - .clone(); - refresh_account(&mut store, &account_id).await?; - store.save(&home)?; - println!("已刷新账号 token: {account_id}"); - Ok(()) -} - pub async fn refresh_account_if_needed(store: &mut Store, account_id: &str) -> Result { // Refresh shortly before expiry to avoid writing an auth.json that Codex // immediately rejects.