diff --git a/CLAUDE.md b/CLAUDE.md index b03a4ea..fabcc9b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,6 +27,7 @@ ByeByeCode 是一个 Rust 编写的 Claude Code 状态栏增强工具,用于 | `fix/issue-9-subscription-usage-display` | Issue #9 修复 | PR #10 | ✅ 已合并 | | `feature/progress-bar-usage-display` | 进度条功能 | PR #11 | ✅ 已合并 | | `fix/skip-free-subscription` | 跳过 FREE 套餐 | PR #12 | ✅ 已合并 | +| `feature/simplify-subscription-display` | 精简订阅显示格式 | PR #15 | 🔄 待审核 | ### 分支工作流 diff --git a/src/api/mod.rs b/src/api/mod.rs index ae2721f..8d81d44 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -26,8 +26,8 @@ impl Default for ApiConfig { Self { enabled: false, api_key: String::new(), - usage_url: "https://www.88code.org/api/usage".to_string(), - subscription_url: "https://www.88code.org/api/subscription".to_string(), + usage_url: "https://www.88code.ai/api/usage".to_string(), + subscription_url: "https://www.88code.ai/api/subscription".to_string(), } } } @@ -257,7 +257,7 @@ fn get_claude_settings_path() -> Option { dirs::home_dir().map(|home| home.join(".claude").join("settings.json")) } -/// Read API key from Claude settings.json if base URL is 88code.org or packyapi.com +/// Read API key from Claude settings.json if base URL is 88code or packyapi pub fn get_api_key_from_claude_settings() -> Option { let settings_path = get_claude_settings_path()?; @@ -270,9 +270,13 @@ pub fn get_api_key_from_claude_settings() -> Option { let env = settings.env?; - // Support both 88code.org and packyapi.com + // Support 88code (both .org and .ai), packyapi.com, and rainapp.top (国内线路) if let Some(base_url) = env.base_url { - if base_url.contains("88code.org") || base_url.contains("packyapi.com") { + if base_url.contains("88code.org") + || base_url.contains("88code.ai") + || base_url.contains("packyapi.com") + || base_url.contains("rainapp.top") + { return env.auth_token; } } @@ -295,7 +299,11 @@ pub fn get_usage_url_from_claude_settings() -> Option { if base_url.contains("packyapi.com") { Some("https://www.packyapi.com/api/usage/token/".to_string()) + } else if base_url.contains("88code.ai") || base_url.contains("rainapp.top") { + // 新域名:88code.ai 和国内线路 rainapp.top + Some("https://www.88code.ai/api/usage".to_string()) } else if base_url.contains("88code.org") { + // 旧域名兼容 Some("https://www.88code.org/api/usage".to_string()) } else { None diff --git a/src/core/segments/byebyecode_subscription.rs b/src/core/segments/byebyecode_subscription.rs index e4d7910..fd01aed 100644 --- a/src/core/segments/byebyecode_subscription.rs +++ b/src/core/segments/byebyecode_subscription.rs @@ -68,7 +68,7 @@ pub fn collect(config: &Config, input: &InputData) -> Option { .map(|s| s.to_string()) }) .or_else(crate::api::get_usage_url_from_claude_settings) - .unwrap_or_else(|| "https://www.88code.org/api/usage".to_string()); + .unwrap_or_else(|| "https://www.88code.ai/api/usage".to_string()); if usage_url.contains("packyapi.com") { return None; diff --git a/src/core/segments/byebyecode_usage.rs b/src/core/segments/byebyecode_usage.rs index 0ee9431..eeef087 100644 --- a/src/core/segments/byebyecode_usage.rs +++ b/src/core/segments/byebyecode_usage.rs @@ -22,7 +22,7 @@ pub fn collect(config: &Config, input: &InputData) -> Option { .filter(|s| !s.is_empty()) .map(|s| s.to_string()) .or_else(crate::api::get_usage_url_from_claude_settings) - .unwrap_or_else(|| "https://www.88code.org/api/usage".to_string()); + .unwrap_or_else(|| "https://www.88code.ai/api/usage".to_string()); // 根据 usage_url 判断是哪个服务,并设置动态图标 let service_name = if usage_url.contains("packyapi.com") { @@ -58,7 +58,7 @@ pub fn collect(config: &Config, input: &InputData) -> Option { .get("subscription_url") .and_then(|v| v.as_str()) .map(|s| s.to_string()) - .unwrap_or_else(|| "https://www.88code.org/api/subscription".to_string()); + .unwrap_or_else(|| "https://www.88code.ai/api/subscription".to_string()); // 从输入数据获取当前使用的模型 let model_id = &input.model.id;