From ef30cad3a45015bc075f206da42d1da9e4b083db Mon Sep 17 00:00:00 2001 From: WaterRain <109326062+CATMIAOZHI@users.noreply.github.com> Date: Fri, 26 Jun 2026 20:48:07 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20CCGO=20=E5=87=AD=E8=AF=81=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E4=BC=98=E5=8C=96=20=E2=80=94=E2=80=94=20Cookie=20?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=94=B9=E4=B8=BA=E5=85=A8=E9=80=89=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=20+=20=E5=B8=AE=E5=8A=A9=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 帮助弹窗 Cookie 步骤改为"全选复制全部 Cookie",无需逐个挑选 - 输入框 placeholder 改为 F12 全选复制粘贴操作提示 - 新增"如何获取 API Key 和 Cookie?"帮助按钮 - README 警告文字更新(含 CommandCode Go) --- README.md | 2 +- .../token/ui/settings/CredentialEditScreen.kt | 43 ++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 11d51d9..32d3a9f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Android AI 余额查询 APP —— 统一查看 DeepSeek、OpenCode Go 和 Comma 前往 [Releases](https://github.com/CATMIAOZHI/Rainytoken/releases) 下载最新 APK。 -> ⚠️ 需要配置 DeepSeek API Key 和/或 OpenCode Go 登录凭据才能拉取数据。 +> ⚠️ 需要配置 DeepSeek API Key、OpenCode Go 登录凭据或 CommandCode Go API Key 才能拉取数据。 --- diff --git a/app/src/main/java/com/rainy/token/ui/settings/CredentialEditScreen.kt b/app/src/main/java/com/rainy/token/ui/settings/CredentialEditScreen.kt index b0188d9..4388066 100644 --- a/app/src/main/java/com/rainy/token/ui/settings/CredentialEditScreen.kt +++ b/app/src/main/java/com/rainy/token/ui/settings/CredentialEditScreen.kt @@ -70,6 +70,7 @@ fun CredentialEditScreen( val context = LocalContext.current var showCookieHelp by remember { mutableStateOf(false) } var showGoHelp by remember { mutableStateOf(false) } + var showOpenCcgoHelp by remember { mutableStateOf(false) } LaunchedEffect(uiState.message) { uiState.message?.let { msg -> @@ -117,7 +118,8 @@ fun CredentialEditScreen( onApiKeyChange = viewModel::updateApiKey, onCookieChange = viewModel::updateCookieInput, onSave = viewModel::saveCommandCodeGoCredential, - onTestAndSave = viewModel::testAndSaveCommandCodeGo + onTestAndSave = viewModel::testAndSaveCommandCodeGo, + onShowHelp = { showOpenCcgoHelp = true } ) } else { ApiKeyForm( @@ -223,6 +225,33 @@ fun CredentialEditScreen( } ) } + + if (showOpenCcgoHelp) { + AlertDialog( + onDismissRequest = { showOpenCcgoHelp = false }, + title = { Text("如何获取 CommandCode Go 凭据?") }, + text = { + Column { + Text("1. 打开 https://commandcode.ai 并登录 GitHub") + Text("") + Text("▸ 获取 API Key(必填):") + Text(" 右上角头像 → Settings → API Keys → 创建一个 Key") + Text("") + Text("▸ 获取全部 Cookie(用于用量记录):") + Text(" F12 → Application → Cookies → commandcode.ai") + Text(" 选中所有 Cookie,复制整个 Cookie 字符串") + Text(" 粘贴到下方输入框即可,无需逐个挑选") + Text("") + Text("提示:不填 Cookie 也能正常查看余额,只是用量记录为空。") + } + }, + confirmButton = { + TextButton(onClick = { showOpenCcgoHelp = false }) { + Text("我知道了") + } + } + ) + } } @Composable @@ -303,7 +332,8 @@ private fun CommandCodeGoForm( onApiKeyChange: (String) -> Unit, onCookieChange: (String) -> Unit, onSave: () -> Unit, - onTestAndSave: () -> Unit + onTestAndSave: () -> Unit, + onShowHelp: () -> Unit ) { Text(text = "CommandCode Go 凭据", style = MaterialTheme.typography.titleMedium) Text( @@ -315,7 +345,7 @@ private fun CommandCodeGoForm( value = apiKey, onValueChange = onApiKeyChange, label = { Text("API Key") }, - placeholder = { Text("从 Studio → API Keys 生成") }, + placeholder = { Text("从 Settings → API Keys 生成") }, singleLine = true, visualTransformation = PasswordVisualTransformation(), keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(keyboardType = KeyboardType.Password), @@ -324,8 +354,8 @@ private fun CommandCodeGoForm( OutlinedTextField( value = cookieInput, onValueChange = onCookieChange, - label = { Text("Session Cookie") }, - placeholder = { Text("Secure-commandcode_prod_.session_token=xxx; Secure-commandcode_prod_.session_data=xxx") }, + label = { Text("Session Cookie(可选)") }, + placeholder = { Text("F12 → Cookies → commandcode.ai → 全选复制粘贴即可") }, modifier = Modifier.fillMaxWidth(), minLines = 2 ) @@ -339,6 +369,9 @@ private fun CommandCodeGoForm( ) { Text(text = "测试并保存") } + OutlinedButton(onClick = onShowHelp, modifier = Modifier.fillMaxWidth()) { + Text(text = "如何获取 API Key 和 Cookie?") + } } @Composable