From 65eb48440fb1148f0ab6390321b264f93735ddb0 Mon Sep 17 00:00:00 2001
From: QLHazyCoder <2825305047@qq.com>
Date: Mon, 13 Apr 2026 14:25:56 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=82=AE=E7=AE=B1?=
=?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=99=BB=E5=BD=95=E6=8C=89=E9=92=AE=E5=B9=B6?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sidepanel/sidepanel.html | 17 +++++++++-------
sidepanel/sidepanel.js | 43 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/sidepanel/sidepanel.html b/sidepanel/sidepanel.html
index 0672064..890936e 100644
--- a/sidepanel/sidepanel.html
+++ b/sidepanel/sidepanel.html
@@ -129,13 +129,16 @@
邮箱服务
-
+
+
+
+
邮箱生成
diff --git a/sidepanel/sidepanel.js b/sidepanel/sidepanel.js
index 1f7ef0f..65aee43 100644
--- a/sidepanel/sidepanel.js
+++ b/sidepanel/sidepanel.js
@@ -57,6 +57,7 @@ const inputSub2ApiPassword = document.getElementById('input-sub2api-password');
const rowSub2ApiGroup = document.getElementById('row-sub2api-group');
const inputSub2ApiGroup = document.getElementById('input-sub2api-group');
const selectMailProvider = document.getElementById('select-mail-provider');
+const btnMailLogin = document.getElementById('btn-mail-login');
const rowEmailGenerator = document.getElementById('row-email-generator');
const selectEmailGenerator = document.getElementById('select-email-generator');
const hotmailSection = document.getElementById('hotmail-section');
@@ -140,6 +141,20 @@ const filterHotmailAccountsByUsage = window.HotmailUtils?.filterHotmailAccountsB
const getHotmailBulkActionLabel = window.HotmailUtils?.getHotmailBulkActionLabel;
const getHotmailListToggleLabel = window.HotmailUtils?.getHotmailListToggleLabel;
const HOTMAIL_LIST_EXPANDED_STORAGE_KEY = 'multipage-hotmail-list-expanded';
+const MAIL_PROVIDER_LOGIN_CONFIGS = {
+ '163': {
+ label: '163 邮箱',
+ url: 'https://mail.163.com/',
+ },
+ '163-vip': {
+ label: '163 VIP 邮箱',
+ url: 'https://webmail.vip.163.com/',
+ },
+ qq: {
+ label: 'QQ 邮箱',
+ url: 'https://wx.mail.qq.com/',
+ },
+};
// ============================================================
// Toast Notifications
@@ -926,6 +941,10 @@ function getCurrentHotmailEmail(state = latestState) {
return String(getCurrentHotmailAccount(state)?.email || '').trim();
}
+function getMailProviderLoginConfig(provider = selectMailProvider.value) {
+ return MAIL_PROVIDER_LOGIN_CONFIGS[String(provider || '').trim()] || null;
+}
+
function isCurrentEmailManagedByHotmail(state = latestState) {
const hotmailEmail = getCurrentHotmailEmail(state);
if (!hotmailEmail) {
@@ -937,6 +956,16 @@ function isCurrentEmailManagedByHotmail(state = latestState) {
return inputEmailValue === hotmailEmail || stateEmailValue === hotmailEmail;
}
+function updateMailLoginButtonState() {
+ if (!btnMailLogin) {
+ return;
+ }
+
+ const config = getMailProviderLoginConfig();
+ btnMailLogin.disabled = !config;
+ btnMailLogin.title = config ? `打开 ${config.label} 登录页` : '当前邮箱服务无需网页登录';
+}
+
function getHotmailAccountsByUsage(mode = 'all', state = latestState) {
const accounts = getHotmailAccounts(state);
if (typeof filterHotmailAccountsByUsage === 'function') {
@@ -1145,6 +1174,7 @@ function updateMailProviderUI() {
const useInbucket = selectMailProvider.value === 'inbucket';
const useHotmail = selectMailProvider.value === 'hotmail-api';
const useEmailGenerator = !useHotmail;
+ updateMailLoginButtonState();
rowInbucketHost.style.display = useInbucket ? '' : 'none';
rowInbucketMailbox.style.display = useInbucket ? '' : 'none';
const useCloudflare = selectEmailGenerator.value === 'cloudflare';
@@ -1975,6 +2005,19 @@ btnToggleVpsPassword.addEventListener('click', () => {
syncVpsPasswordToggleLabel();
});
+btnMailLogin?.addEventListener('click', async () => {
+ const config = getMailProviderLoginConfig();
+ if (!config) {
+ return;
+ }
+
+ try {
+ await chrome.tabs.create({ url: config.url, active: true });
+ } catch (err) {
+ showToast(`打开${config.label}失败:${err.message}`, 'error');
+ }
+});
+
localCpaStep9ModeButtons.forEach((button) => {
button.addEventListener('click', () => {
const nextMode = button.dataset.localCpaStep9Mode;