From 4df3d5fecd256f5ccf59fd1c28c55b98649b2078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E7=BB=8D=E5=BA=B7?= <3052147989@qq.com> Date: Tue, 3 Mar 2026 22:53:16 +0800 Subject: [PATCH] feat(accounts): add Outlook register button and auto-fill token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a '🔑 注册' button to account panel header; show only when a non-temp group selected; on successful OAuth exchange auto-open Add Account modal and pre-fill client_id + refresh_token. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- static/js/features/groups.js | 25 +++++++++++++++++++++++++ static/js/main.js | 22 ++++++++++++---------- templates/index.html | 3 ++- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/static/js/features/groups.js b/static/js/features/groups.js index 4225754..5bebcc8 100644 --- a/static/js/features/groups.js +++ b/static/js/features/groups.js @@ -129,6 +129,12 @@ } } + // 显示「注册Outlook账号」按钮(仅在非临时邮箱分组时) + const registerBtn = document.getElementById('registerOutlookBtn'); + if (registerBtn) { + registerBtn.style.display = isTempEmailGroup ? 'none' : ''; + } + // 更新底部按钮 updateAccountPanelFooter(); @@ -173,6 +179,22 @@ } } + // 获取 provider 的中文展示名(账号卡片 tag) + function getProviderLabel(provider) { + const key = (provider || 'outlook').toString().toLowerCase(); + const labels = { + outlook: 'Outlook', + gmail: 'Gmail', + qq: 'QQ邮箱', + '163': '163邮箱', + '126': '126邮箱', + yahoo: 'Yahoo邮箱', + aliyun: '阿里邮箱', + custom: '自定义IMAP' + }; + return labels[key] || provider || '未知'; + } + // 渲染邮箱列表 function renderAccountList(accounts) { const container = document.getElementById('accountList'); @@ -210,6 +232,8 @@ const initial = (acc.email || '?')[0].toUpperCase(); const isFailed = acc.last_refresh_status === 'failed'; const gradient = avatarGradients[index % avatarGradients.length]; + const providerLabel = getProviderLabel(acc.provider || acc.account_type || 'outlook'); + const providerTagHtml = `${escapeHtml(providerLabel)}`; let tokenBadge = '– 未知'; if (acc.token_status === 'valid') { @@ -235,6 +259,7 @@ ${acc.remark && acc.remark.trim() ? `