feat: 接入hotmail api对接与跨域规则
This commit is contained in:
@@ -153,7 +153,7 @@
|
||||
<div class="data-inline">
|
||||
<select id="select-mail-provider" class="data-select">
|
||||
<option value="custom">自定义邮箱</option>
|
||||
<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 邮箱 (vip.163.com)</option>
|
||||
<option value="qq">QQ 邮箱 (wx.mail.qq.com)</option>
|
||||
@@ -271,13 +271,13 @@
|
||||
<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" disabled title="远程服务暂时禁用">远程服务</button>
|
||||
<button type="button" class="choice-btn" data-hotmail-service-mode="remote">API对接</button>
|
||||
<button type="button" class="choice-btn" data-hotmail-service-mode="local">本地助手</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row" id="row-hotmail-remote-base-url">
|
||||
<span class="data-label">远程服务</span>
|
||||
<input type="text" id="input-hotmail-remote-base-url" class="data-input mono" placeholder="请输入远程服务地址" />
|
||||
<span class="data-label">API对接</span>
|
||||
<input type="text" id="input-hotmail-remote-base-url" class="data-input mono" placeholder="微软邮箱 API 对接模式无需填写地址" />
|
||||
</div>
|
||||
<div class="data-row" id="row-hotmail-local-base-url" style="display:none;">
|
||||
<span class="data-label">本地助手</span>
|
||||
|
||||
+10
-5
@@ -177,6 +177,7 @@ const EYE_OPEN_ICON = '<svg width="14" height="14" viewBox="0 0 24 24" fill="non
|
||||
const EYE_CLOSED_ICON = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17.94 17.94A10.94 10.94 0 0 1 12 19C5 19 1 12 1 12a21.77 21.77 0 0 1 5.06-6.94"/><path d="M9.9 4.24A10.94 10.94 0 0 1 12 5c7 0 11 7 11 7a21.86 21.86 0 0 1-2.16 3.19"/><path d="M1 1l22 22"/><path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/></svg>';
|
||||
const COPY_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
||||
const parseHotmailImportText = window.HotmailUtils?.parseHotmailImportText;
|
||||
const normalizeHotmailServiceModeFromUtils = window.HotmailUtils?.normalizeHotmailServiceMode;
|
||||
const shouldClearHotmailCurrentSelection = window.HotmailUtils?.shouldClearHotmailCurrentSelection;
|
||||
const upsertHotmailAccountInList = window.HotmailUtils?.upsertHotmailAccountInList;
|
||||
const filterHotmailAccountsByUsage = window.HotmailUtils?.filterHotmailAccountsByUsage;
|
||||
@@ -950,7 +951,12 @@ function normalizeLocalCpaStep9Mode(value = '') {
|
||||
}
|
||||
|
||||
function normalizeHotmailServiceMode(value = '') {
|
||||
return HOTMAIL_SERVICE_MODE_LOCAL;
|
||||
if (typeof normalizeHotmailServiceModeFromUtils === 'function') {
|
||||
return normalizeHotmailServiceModeFromUtils(value);
|
||||
}
|
||||
return String(value || '').trim().toLowerCase() === HOTMAIL_SERVICE_MODE_REMOTE
|
||||
? HOTMAIL_SERVICE_MODE_REMOTE
|
||||
: HOTMAIL_SERVICE_MODE_LOCAL;
|
||||
}
|
||||
|
||||
function getSelectedLocalCpaStep9Mode() {
|
||||
@@ -975,10 +981,9 @@ 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.disabled = false;
|
||||
button.setAttribute('aria-disabled', 'false');
|
||||
button.classList.toggle('is-active', active);
|
||||
button.setAttribute('aria-pressed', String(active));
|
||||
});
|
||||
@@ -2457,7 +2462,7 @@ btnToggleHotmailList?.addEventListener('click', () => {
|
||||
btnHotmailUsageGuide?.addEventListener('click', async () => {
|
||||
await openConfirmModal({
|
||||
title: '使用教程',
|
||||
message: '由于第三方服务接口结构不同,所以暂时无法使用,如果您的token可以直连微软,请测试本地功能,详细功能请看项目根目录的readme文件',
|
||||
message: 'API对接模式会直接调用微软邮箱接口取件;本地助手模式仍走本地服务。两种模式继续共用同一套 Hotmail 账号池与导入格式。',
|
||||
confirmLabel: '确定',
|
||||
confirmVariant: 'btn-primary',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user