fix: CCGO 凭证引导优化 —— Cookie 说明改为全选复制 + 帮助弹窗

- 帮助弹窗 Cookie 步骤改为"全选复制全部 Cookie",无需逐个挑选
- 输入框 placeholder 改为 F12 全选复制粘贴操作提示
- 新增"如何获取 API Key 和 Cookie?"帮助按钮
- README 警告文字更新(含 CommandCode Go)
This commit is contained in:
WaterRain 2026-06-26 20:48:07 +00:00
parent cc7aecc331
commit ef30cad3a4
No known key found for this signature in database
2 changed files with 39 additions and 6 deletions

View File

@ -31,7 +31,7 @@ Android AI 余额查询 APP —— 统一查看 DeepSeek、OpenCode Go 和 Comma
前往 [Releases](https://github.com/CATMIAOZHI/Rainytoken/releases) 下载最新 APK。 前往 [Releases](https://github.com/CATMIAOZHI/Rainytoken/releases) 下载最新 APK。
> ⚠️ 需要配置 DeepSeek API Key 和/或 OpenCode Go 登录凭据才能拉取数据。 > ⚠️ 需要配置 DeepSeek API Key、OpenCode Go 登录凭据或 CommandCode Go API Key 才能拉取数据。
--- ---

View File

@ -70,6 +70,7 @@ fun CredentialEditScreen(
val context = LocalContext.current val context = LocalContext.current
var showCookieHelp by remember { mutableStateOf(false) } var showCookieHelp by remember { mutableStateOf(false) }
var showGoHelp by remember { mutableStateOf(false) } var showGoHelp by remember { mutableStateOf(false) }
var showOpenCcgoHelp by remember { mutableStateOf(false) }
LaunchedEffect(uiState.message) { LaunchedEffect(uiState.message) {
uiState.message?.let { msg -> uiState.message?.let { msg ->
@ -117,7 +118,8 @@ fun CredentialEditScreen(
onApiKeyChange = viewModel::updateApiKey, onApiKeyChange = viewModel::updateApiKey,
onCookieChange = viewModel::updateCookieInput, onCookieChange = viewModel::updateCookieInput,
onSave = viewModel::saveCommandCodeGoCredential, onSave = viewModel::saveCommandCodeGoCredential,
onTestAndSave = viewModel::testAndSaveCommandCodeGo onTestAndSave = viewModel::testAndSaveCommandCodeGo,
onShowHelp = { showOpenCcgoHelp = true }
) )
} else { } else {
ApiKeyForm( 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 @Composable
@ -303,7 +332,8 @@ private fun CommandCodeGoForm(
onApiKeyChange: (String) -> Unit, onApiKeyChange: (String) -> Unit,
onCookieChange: (String) -> Unit, onCookieChange: (String) -> Unit,
onSave: () -> Unit, onSave: () -> Unit,
onTestAndSave: () -> Unit onTestAndSave: () -> Unit,
onShowHelp: () -> Unit
) { ) {
Text(text = "CommandCode Go 凭据", style = MaterialTheme.typography.titleMedium) Text(text = "CommandCode Go 凭据", style = MaterialTheme.typography.titleMedium)
Text( Text(
@ -315,7 +345,7 @@ private fun CommandCodeGoForm(
value = apiKey, value = apiKey,
onValueChange = onApiKeyChange, onValueChange = onApiKeyChange,
label = { Text("API Key") }, label = { Text("API Key") },
placeholder = { Text("从 Studio → API Keys 生成") }, placeholder = { Text("从 Settings → API Keys 生成") },
singleLine = true, singleLine = true,
visualTransformation = PasswordVisualTransformation(), visualTransformation = PasswordVisualTransformation(),
keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(keyboardType = KeyboardType.Password), keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(keyboardType = KeyboardType.Password),
@ -324,8 +354,8 @@ private fun CommandCodeGoForm(
OutlinedTextField( OutlinedTextField(
value = cookieInput, value = cookieInput,
onValueChange = onCookieChange, onValueChange = onCookieChange,
label = { Text("Session Cookie") }, label = { Text("Session Cookie(可选)") },
placeholder = { Text("Secure-commandcode_prod_.session_token=xxx; Secure-commandcode_prod_.session_data=xxx") }, placeholder = { Text("F12 → Cookies → commandcode.ai → 全选复制粘贴即可") },
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
minLines = 2 minLines = 2
) )
@ -339,6 +369,9 @@ private fun CommandCodeGoForm(
) { ) {
Text(text = "测试并保存") Text(text = "测试并保存")
} }
OutlinedButton(onClick = onShowHelp, modifier = Modifier.fillMaxWidth()) {
Text(text = "如何获取 API Key 和 Cookie?")
}
} }
@Composable @Composable