diff --git a/public/app.js b/public/app.js index 8c7344f..104ef3b 100644 --- a/public/app.js +++ b/public/app.js @@ -77,6 +77,9 @@ function geminiApp() { showOpenAIAuthModal: false, showAgCredentialModal: false, showCliAcCredentialModal: false, + showAistudioKeysModal: false, + aistudioKeyRecord: null, + aistudioKeyEmail: '', showRechargeModal: false, showRechargeCardModal: false, showGoogleAccountAgModal: false, @@ -179,7 +182,7 @@ function geminiApp() { email: true, password: true, recovery_email: true, secret_key: true, country: false, sheerid_link: false, status: false, message: false, customer_name: false, account_refund_status: false, refund_deadline_at: false, sms_url: false, recharged_at: false, ag_refresh_token: false, - cli_ac_credential: false, chatgpt_session: false, openai_auth_json: false + cli_ac_credential: false, chatgpt_session: false, openai_auth_json: false, aistudio_api_key: false }, exportMode: { file: false, csv: false, sub2api_json: false, clipboard: true, staging: false }, exportFieldDefs: [ @@ -200,6 +203,7 @@ function geminiApp() { { key: 'cli_ac_credential', label: 'Cli_AC凭证' }, { key: 'chatgpt_session', label: 'ChatGPT Session' }, { key: 'openai_auth_json', label: '授权JSON' }, + { key: 'aistudio_api_key', label: 'AI Studio Key' }, ], _exportList: [], problemExportCategories: { @@ -305,6 +309,7 @@ function geminiApp() { { value: 'has_cli_ac_credential', label: 'Cli_AC凭证' }, { value: 'gmail_app_password', label: '16位应用密码' }, { value: 'openai_plan_type', label: '账号套餐' }, + { value: 'is_pro', label: 'Pro' }, { value: 'ag_status', label: 'AG状态' }, ], rechargeStatusOptions: ['未充值', '充值中', '等待已确认', '充值成功', '充值失败', '账号本身已有会员'], @@ -642,6 +647,11 @@ function geminiApp() { if (field === 'has_ag_credential') return (acc.has_ag_credential || acc.ag_refresh_token) ? '有AC凭证' : ''; // Gemini CLI 凭证只依据列表中的存在标记筛选,不在前端读取完整凭证。 if (field === 'has_cli_ac_credential') return acc.has_cli_ac_credential ? '有Cli_AC凭证' : ''; + // 是否 Google AI Pro:三态 —— 1=Pro / 0=非Pro / null=未检测。 + if (field === 'is_pro') { + if (acc.is_pro == null) return '未检测'; + return (acc.is_pro === true || Number(acc.is_pro) === 1) ? 'Pro' : '非Pro'; + } return acc[field] == null ? '' : acc[field]; }, @@ -2549,6 +2559,19 @@ function geminiApp() { } catch (_) { return '解析错误'; } }, + // AI Studio 一键组合流程日志:鼠标悬停显示完整信息 + formatAistudioFlowTitle(account) { + if (!account || !account.aistudio_flow_status) return ''; + const lines = []; + lines.push(account.aistudio_flow_status === 'success' ? '结果:成功(全部步骤通过)' : '结果:失败'); + if (account.aistudio_flow_status !== 'success' && account.aistudio_flow_failed_step) { + lines.push(`失败步骤:${account.aistudio_flow_failed_step}`); + } + if (account.aistudio_flow_detail) lines.push(`详情:${account.aistudio_flow_detail}`); + if (account.aistudio_flow_at) lines.push(`时间:${this.formatDate(account.aistudio_flow_at)}`); + return lines.join('\n'); + }, + // ==================== 静态代理池 ==================== async loadStaticProxies() { try { @@ -2916,6 +2939,8 @@ function geminiApp() { check_restrictions: '等待检查账号限制...', check_security_dates: '等待检查安全日期...', ag_get_credential: '等待获取凭证...', + aistudio_combo: '等待处理 AI Studio...', + open_manual_aistudio: '浏览器已打开,等待人工创建 AI Studio Key...', gemini_cli_get_credential: '等待获取 Cli 凭证...', google_account_ag_credential: '等待链接取号并获取凭证...', ag_revoke_authorization: '等待取消授权...', @@ -2944,9 +2969,9 @@ function geminiApp() { workspace_refund: '退款', security_chatgpt: '改密+2FA', check_restrictions: '检查账号限制', check_security_dates: '检查安全日期', - ag_get_credential: '获取凭证', gemini_cli_get_credential: '获取Cli凭证', ag_revoke_authorization: '取消授权', + ag_get_credential: '获取凭证', aistudio_combo: 'AI Studio 一键组合', aistudio_sync_key: '同步人工AI Key', gemini_cli_get_credential: '获取Cli凭证', ag_revoke_authorization: '取消授权', google_account_ag_credential: '链接提取+获取凭证', - open: '打开浏览器', open_url: '打开网页', delete: '删除浏览器', + open: '打开浏览器', open_manual_aistudio: '打开浏览器(自动保存人工 Key)', open_url: '打开网页', delete: '删除浏览器', import_setup: '账号初始化', }; return labels[taskType] || taskType || '任务'; @@ -3197,6 +3222,12 @@ function geminiApp() { if (data.password_changed_at !== undefined) account.password_changed_at = data.password_changed_at; if (data.security_dates !== undefined) account.security_dates = data.security_dates; if (data.gmail_app_password !== undefined) account.gmail_app_password = data.gmail_app_password; + if (data.aistudio_api_key !== undefined) account.aistudio_api_key = data.aistudio_api_key; + if (data.aistudio_api_key_json !== undefined) account.aistudio_api_key_json = data.aistudio_api_key_json; + if (data.aistudio_flow_status !== undefined) account.aistudio_flow_status = data.aistudio_flow_status; + if (data.aistudio_flow_failed_step !== undefined) account.aistudio_flow_failed_step = data.aistudio_flow_failed_step; + if (data.aistudio_flow_detail !== undefined) account.aistudio_flow_detail = data.aistudio_flow_detail; + if (data.aistudio_flow_at !== undefined) account.aistudio_flow_at = data.aistudio_flow_at; if (data.browser_id !== undefined) account.browser_id = data.browser_id; if (data.browser_seq !== undefined) account.browser_seq = data.browser_seq; if (data.screenshot_path !== undefined) account.screenshot_path = data.screenshot_path; @@ -3400,7 +3431,9 @@ function geminiApp() { // 各操作快捷方法 runCreateAccounts() { this.runTask('create_accounts'); }, runChangeProxy() { this.runTask('change_proxy'); }, - runOpenBrowsers() { this.runTask('open'); }, + runOpenBrowsers() { + this.runTask('open_manual_aistudio', { watchTimeoutMs: 30 * 60 * 1000 }); + }, runDeleteBrowsers() { if (this.selectedCount === 0) { this.addLog('⚠️ 请先勾选要删除浏览器的账号', 'warn'); @@ -3583,6 +3616,29 @@ function geminiApp() { runChangeCountry() { this.runTask('open_url', { url: 'https://policies.google.com/country-association-form?hl=en' }); }, runChangeLanguage() { this.runTask('change_language'); }, runAgGetCredential() { this.runTask('ag_get_credential'); }, + runAistudioCombo() { this.runTask('aistudio_combo'); }, + async openAistudioKeyModal(account) { + if (!account || !account.email) return; + this.aistudioKeyEmail = account.email; + this.aistudioKeyRecord = null; + try { + const url = `/api/operations/aistudio-api-keys?email=${encodeURIComponent(account.email)}`; + const r = await fetch(url).then(x => x.json()); + this.aistudioKeyRecord = (r && r.success && r.data) || null; + if (!this.aistudioKeyRecord) this.addLog(`⚠️ ${account.email} 暂无已保存的 AI Studio API Key`, 'warn'); + } catch (e) { + this.aistudioKeyRecord = null; + this.addLog(`⚠️ 读取 ${account.email} 的 AI Studio API Key 失败`, 'warn'); + } + this.showAistudioKeysModal = true; + }, + copyAistudioKeys() { + const text = JSON.stringify(this.aistudioKeyRecord || {}, null, 2); + const done = () => { this.copyToastVisible = true; setTimeout(() => { this.copyToastVisible = false; }, 1500); }; + if (navigator.clipboard && navigator.clipboard.writeText) { + navigator.clipboard.writeText(text).then(done).catch(() => {}); + } + }, runGeminiCliGetCredential() { this.runTask('gemini_cli_get_credential'); }, async openGoogleAccountAgModal() { if (this.isRunning) return; diff --git a/public/index.html b/public/index.html index 7c0e94c..af70252 100644 --- a/public/index.html +++ b/public/index.html @@ -295,7 +295,15 @@ -