Prechádzať zdrojové kódy

更新 Hotmail 服务模式为本地助手,禁用远程服务选项,并添加使用教程按钮及相关逻辑

QLHazyCoder 4 mesiacov pred
rodič
commit
91142271aa
4 zmenil súbory, kde vykonal 42 pridanie a 16 odobranie
  1. 2 4
      background.js
  2. 19 5
      sidepanel/sidepanel.css
  3. 3 3
      sidepanel/sidepanel.html
  4. 18 4
      sidepanel/sidepanel.js

+ 2 - 4
background.js

@@ -67,7 +67,7 @@ const PERSISTED_SETTING_DEFAULTS = {
   emailGenerator: 'duck', // 注册邮箱生成方式:duck / cloudflare。
   inbucketHost: '', // 仅当 mailProvider 为 inbucket 时填写 Inbucket 地址,其他情况保持为空。
   inbucketMailbox: '', // 仅当 mailProvider 为 inbucket 时填写邮箱名,其他情况保持为空。
-  hotmailServiceMode: HOTMAIL_SERVICE_MODE_REMOTE, // Hotmail 服务模式:远程服务 / 本地助手。
+  hotmailServiceMode: HOTMAIL_SERVICE_MODE_LOCAL, // Hotmail 服务模式:远程服务 / 本地助手。
   hotmailRemoteBaseUrl: DEFAULT_HOTMAIL_REMOTE_BASE_URL, // Hotmail 远程服务地址。
   hotmailLocalBaseUrl: DEFAULT_HOTMAIL_LOCAL_BASE_URL, // Hotmail 本地 helper 地址。
   cloudflareDomain: '', // 仅当 emailGenerator=cloudflare 时填写自定义域名。
@@ -198,9 +198,7 @@ function normalizeCloudflareDomains(values) {
 }
 
 function normalizeHotmailServiceMode(rawValue = '') {
-  return String(rawValue || '').trim().toLowerCase() === HOTMAIL_SERVICE_MODE_LOCAL
-    ? HOTMAIL_SERVICE_MODE_LOCAL
-    : HOTMAIL_SERVICE_MODE_REMOTE;
+  return HOTMAIL_SERVICE_MODE_LOCAL;
 }
 
 function normalizeHotmailRemoteBaseUrl(rawValue = '') {

+ 19 - 5
sidepanel/sidepanel.css

@@ -327,6 +327,11 @@ header {
   gap: 2px;
 }
 
+.section-mini-copy .section-label {
+  font-size: 14px;
+  letter-spacing: 0.04em;
+}
+
 .section-mini-actions {
   display: flex;
   align-items: center;
@@ -335,11 +340,6 @@ header {
   justify-content: flex-end;
 }
 
-.section-hint {
-  color: var(--text-muted);
-  font-size: 12px;
-}
-
 .data-row {
   display: flex;
   align-items: center;
@@ -496,6 +496,20 @@ header {
   box-shadow: 0 0 0 1px var(--blue-glow);
 }
 
+.choice-btn:disabled {
+  border-color: var(--border);
+  background: var(--bg-elevated);
+  color: var(--text-muted);
+  cursor: not-allowed;
+  box-shadow: none;
+}
+
+.choice-btn:disabled:hover {
+  border-color: var(--border);
+  background: var(--bg-elevated);
+  color: var(--text-muted);
+}
+
 #btn-fetch-email,
 #btn-save-settings {
   padding-inline: 10px;

+ 3 - 3
sidepanel/sidepanel.html

@@ -130,7 +130,7 @@
       <div class="data-row">
         <span class="data-label">邮箱服务</span>
         <select id="select-mail-provider" class="data-select">
-          <option value="hotmail-api">Hotmail(远程/本地)</option>
+          <option value="hotmail-api">Hotmail(本地助手)</option>
           <option value="163">163 邮箱 (mail.163.com)</option>
           <option value="163-vip">163 VIP 邮箱 (webmail.vip.163.com)</option>
           <option value="qq">QQ 邮箱 (wx.mail.qq.com)</option>
@@ -205,9 +205,9 @@
       <div class="section-mini-header">
         <div class="section-mini-copy">
           <span class="section-label">Hotmail 账号池</span>
-          <span class="section-hint">支持远程服务与本地助手两种接码模式</span>
         </div>
         <div class="section-mini-actions">
+          <button id="btn-hotmail-usage-guide" class="btn btn-ghost btn-xs" type="button">使用教程</button>
           <button id="btn-clear-used-hotmail-accounts" class="btn btn-ghost btn-xs" type="button">清空已用</button>
           <button id="btn-delete-all-hotmail-accounts" class="btn btn-ghost btn-xs" type="button">全部删除</button>
           <button id="btn-toggle-hotmail-list" class="btn btn-ghost btn-xs" type="button" aria-expanded="false">展开列表</button>
@@ -216,7 +216,7 @@
       <div class="data-row" id="row-hotmail-service-mode">
         <span class="data-label">接码模式</span>
         <div id="hotmail-service-mode-group" class="choice-group" role="group" aria-label="Hotmail 接码模式">
-          <button type="button" class="choice-btn" data-hotmail-service-mode="remote">远程服务</button>
+          <button type="button" class="choice-btn" data-hotmail-service-mode="remote" disabled title="远程服务暂时禁用">远程服务</button>
           <button type="button" class="choice-btn" data-hotmail-service-mode="local">本地助手</button>
         </div>
       </div>

+ 18 - 4
sidepanel/sidepanel.js

@@ -73,6 +73,7 @@ const inputHotmailRefreshToken = document.getElementById('input-hotmail-refresh-
 const inputHotmailImport = document.getElementById('input-hotmail-import');
 const btnAddHotmailAccount = document.getElementById('btn-add-hotmail-account');
 const btnImportHotmailAccounts = document.getElementById('btn-import-hotmail-accounts');
+const btnHotmailUsageGuide = document.getElementById('btn-hotmail-usage-guide');
 const btnClearUsedHotmailAccounts = document.getElementById('btn-clear-used-hotmail-accounts');
 const btnDeleteAllHotmailAccounts = document.getElementById('btn-delete-all-hotmail-accounts');
 const btnToggleHotmailList = document.getElementById('btn-toggle-hotmail-list');
@@ -623,9 +624,7 @@ function normalizeLocalCpaStep9Mode(value = '') {
 }
 
 function normalizeHotmailServiceMode(value = '') {
-  return String(value || '').trim().toLowerCase() === HOTMAIL_SERVICE_MODE_LOCAL
-    ? HOTMAIL_SERVICE_MODE_LOCAL
-    : HOTMAIL_SERVICE_MODE_REMOTE;
+  return HOTMAIL_SERVICE_MODE_LOCAL;
 }
 
 function getSelectedLocalCpaStep9Mode() {
@@ -650,7 +649,10 @@ function getSelectedHotmailServiceMode() {
 function setHotmailServiceMode(mode) {
   const resolvedMode = normalizeHotmailServiceMode(mode);
   hotmailServiceModeButtons.forEach((button) => {
+    const isRemoteMode = button.dataset.hotmailServiceMode === HOTMAIL_SERVICE_MODE_REMOTE;
     const active = button.dataset.hotmailServiceMode === resolvedMode;
+    button.disabled = isRemoteMode;
+    button.setAttribute('aria-disabled', String(isRemoteMode));
     button.classList.toggle('is-active', active);
     button.setAttribute('aria-pressed', String(active));
   });
@@ -1221,7 +1223,7 @@ function updateMailProviderUI() {
   }
   if (autoHintText) {
     autoHintText.textContent = useHotmail
-      ? `请先校验并选择一个 Hotmail 账号(当前:${hotmailServiceMode === HOTMAIL_SERVICE_MODE_LOCAL ? '本地助手' : '远程服务'})`
+      ? '请先校验并选择一个 Hotmail 账号'
       : '先自动获取邮箱,或手动粘贴邮箱后再继续';
   }
   if (useHotmail) {
@@ -1790,6 +1792,15 @@ btnToggleHotmailList?.addEventListener('click', () => {
   setHotmailListExpanded(!hotmailListExpanded);
 });
 
+btnHotmailUsageGuide?.addEventListener('click', async () => {
+  await openConfirmModal({
+    title: '使用教程',
+    message: '由于第三方服务接口结构不同,所以暂时无法使用,如果您的token可以直连微软,请测试本地功能,详细功能请看项目根目录的readme文件',
+    confirmLabel: '确定',
+    confirmVariant: 'btn-primary',
+  });
+});
+
 btnClearUsedHotmailAccounts?.addEventListener('click', async () => {
   if (hotmailActionInFlight) return;
   hotmailActionInFlight = true;
@@ -2037,6 +2048,9 @@ localCpaStep9ModeButtons.forEach((button) => {
 
 hotmailServiceModeButtons.forEach((button) => {
   button.addEventListener('click', () => {
+    if (button.disabled) {
+      return;
+    }
     const nextMode = button.dataset.hotmailServiceMode;
     if (getSelectedHotmailServiceMode() === normalizeHotmailServiceMode(nextMode)) {
       return;