Merge remote-tracking branch 'origin/dev' into pr-112
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
constants = {},
|
||||
} = context;
|
||||
|
||||
const contributionUploadUrl = constants.contributionUploadUrl || 'https://apikey.qzz.io';
|
||||
const contributionPortalUrl = constants.contributionPortalUrl || 'https://apikey.qzz.io';
|
||||
const contributionUploadUrl = constants.contributionUploadUrl || 'https://apikey.qzz.io/upload';
|
||||
const pollIntervalMs = Math.max(1500, Math.floor(Number(constants.pollIntervalMs) || 2500));
|
||||
|
||||
const hiddenRows = [
|
||||
@@ -175,10 +176,22 @@
|
||||
return normalizeString(currentState.contributionStatusMessage) || DEFAULT_COPY;
|
||||
}
|
||||
|
||||
function getContributionPortalPageUrl() {
|
||||
return normalizeString(contributionPortalUrl);
|
||||
}
|
||||
|
||||
function getContributionUploadPageUrl() {
|
||||
return normalizeString(contributionUploadUrl);
|
||||
}
|
||||
|
||||
function openContributionPortalPage() {
|
||||
const targetUrl = getContributionPortalPageUrl();
|
||||
if (!targetUrl) {
|
||||
return;
|
||||
}
|
||||
helpers.openExternalUrl?.(targetUrl);
|
||||
}
|
||||
|
||||
function openContributionUploadPage() {
|
||||
const targetUrl = getContributionUploadPageUrl();
|
||||
if (!targetUrl) {
|
||||
@@ -375,9 +388,9 @@
|
||||
}
|
||||
actionInFlight = true;
|
||||
try {
|
||||
openContributionUploadPage();
|
||||
openContributionPortalPage();
|
||||
} catch (error) {
|
||||
helpers.showToast?.(`打开上传页面失败:${error.message}`, 'error');
|
||||
helpers.showToast?.(`打开官网页面失败:${error.message}`, 'error');
|
||||
}
|
||||
render();
|
||||
try {
|
||||
|
||||
@@ -523,6 +523,18 @@ header {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.update-card-reminder {
|
||||
margin: 0;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid color-mix(in srgb, var(--orange) 28%, var(--border));
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--orange-soft) 70%, var(--bg-base));
|
||||
color: var(--orange);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.update-release-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
+63
-37
@@ -16,8 +16,7 @@
|
||||
<body>
|
||||
<header>
|
||||
<div class="header-left">
|
||||
<button id="btn-repo-home" class="header-icon-link" type="button" aria-label="打开 GitHub 仓库"
|
||||
title="打开 GitHub 仓库">
|
||||
<button id="btn-repo-home" class="header-icon-link" type="button" aria-label="打开 GitHub 仓库" title="打开 GitHub 仓库">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" />
|
||||
@@ -35,7 +34,7 @@
|
||||
<div class="header-btns">
|
||||
<div class="run-group">
|
||||
<button id="btn-contribution-mode" class="btn btn-outline btn-sm btn-contribution-mode" type="button"
|
||||
aria-pressed="false" title="进入贡献模式并打开上传页">贡献/使用</button>
|
||||
aria-pressed="false" title="进入贡献模式并打开官网页">贡献/使用教程</button>
|
||||
<input type="number" id="input-run-count" class="run-count-input" value="1" min="1" title="运行次数" />
|
||||
<button id="btn-auto-run" class="btn btn-success" title="自动执行全部步骤">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
|
||||
@@ -84,7 +83,7 @@
|
||||
<div id="contribution-update-layer" class="contribution-update-layer" hidden>
|
||||
<div id="contribution-update-hint" class="contribution-update-hint" aria-live="polite" hidden>
|
||||
<p id="contribution-update-hint-text" class="contribution-update-hint-text">
|
||||
公告 / 使用教程有更新了,可点上方“贡献/使用”查看。
|
||||
公告 / 使用教程有更新了,可点上方“贡献/使用教程”查看。
|
||||
</p>
|
||||
<button id="btn-dismiss-contribution-update-hint" class="contribution-update-hint-close" type="button"
|
||||
aria-label="关闭更新提示" title="关闭更新提示">×</button>
|
||||
@@ -101,6 +100,7 @@
|
||||
</div>
|
||||
<button id="btn-open-release" class="btn btn-primary btn-sm" type="button">前往更新</button>
|
||||
</div>
|
||||
<p class="update-card-reminder">一定请先导出配置,再执行更新</p>
|
||||
<div id="update-release-list" class="update-release-list"></div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -120,14 +120,16 @@
|
||||
<span class="section-label">贡献模式</span>
|
||||
<span class="contribution-mode-badge">CPA</span>
|
||||
</div>
|
||||
<p id="contribution-mode-text" class="contribution-mode-text">当前账号将用于支持项目维护。扩展会自动申请贡献登录地址并持续跟踪授权状态;如检测到回调地址,会自动提交,无需手动复制。</p>
|
||||
<p id="contribution-mode-text" class="contribution-mode-text">
|
||||
当前账号将用于支持项目维护。扩展会自动申请贡献登录地址并持续跟踪授权状态;如检测到回调地址,会自动提交,无需手动复制。</p>
|
||||
<div class="data-row contribution-mode-field">
|
||||
<span class="data-label">贡献昵称</span>
|
||||
<input type="text" id="input-contribution-nickname" class="data-input" placeholder="可留空,将显示为匿名贡献者" />
|
||||
</div>
|
||||
<div class="data-row contribution-mode-field">
|
||||
<span class="data-label">QQ</span>
|
||||
<input type="text" id="input-contribution-qq" class="data-input" inputmode="numeric" placeholder="可留空,只能填写数字" />
|
||||
<input type="text" id="input-contribution-qq" class="data-input" inputmode="numeric"
|
||||
placeholder="可留空,只能填写数字" />
|
||||
</div>
|
||||
<div class="contribution-mode-status-grid">
|
||||
<div class="contribution-mode-status-card">
|
||||
@@ -190,8 +192,7 @@
|
||||
</div>
|
||||
<div class="data-row" id="row-sub2api-default-proxy" style="display:none;">
|
||||
<span class="data-label">默认代理</span>
|
||||
<input type="text" id="input-sub2api-default-proxy" class="data-input"
|
||||
placeholder="留空则不使用代理;或填写代理名称 / ID" />
|
||||
<input type="text" id="input-sub2api-default-proxy" class="data-input" placeholder="留空则不使用代理;或填写代理名称 / ID" />
|
||||
</div>
|
||||
<div class="data-row" id="row-codex2api-url" style="display:none;">
|
||||
<span class="data-label">Codex2API</span>
|
||||
@@ -271,7 +272,8 @@
|
||||
<div class="data-row" id="row-mail2925-pool-settings" style="display:none;">
|
||||
<span class="data-label">2925 号池</span>
|
||||
<div class="data-inline mail2925-base-inline">
|
||||
<label class="toggle-switch mail2925-pool-toggle" id="label-mail2925-use-account-pool" for="input-mail2925-use-account-pool" style="display:none;" title="开启后启用 2925 账号池">
|
||||
<label class="toggle-switch mail2925-pool-toggle" id="label-mail2925-use-account-pool"
|
||||
for="input-mail2925-use-account-pool" style="display:none;" title="开启后启用 2925 账号池">
|
||||
<input type="checkbox" id="input-mail2925-use-account-pool" />
|
||||
<span class="toggle-switch-track" aria-hidden="true">
|
||||
<span class="toggle-switch-thumb"></span>
|
||||
@@ -286,7 +288,8 @@
|
||||
<div class="data-row" id="row-email-prefix" style="display:none;">
|
||||
<span class="data-label" id="label-email-prefix">别名基邮箱</span>
|
||||
<div class="data-inline">
|
||||
<input type="text" id="input-email-prefix" class="data-input mail2925-base-input" placeholder="例如 yourname@example.com" />
|
||||
<input type="text" id="input-email-prefix" class="data-input mail2925-base-input"
|
||||
placeholder="例如 yourname@example.com" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row" id="row-inbucket-host" style="display:none;">
|
||||
@@ -344,8 +347,8 @@
|
||||
<div class="setting-group setting-group-secondary">
|
||||
<span class="setting-caption">线程间隔</span>
|
||||
<div class="setting-controls">
|
||||
<input type="number" id="input-auto-skip-failures-thread-interval-minutes" class="data-input auto-delay-input" value="0"
|
||||
min="0" max="1440" step="1" title="兜底模式下,两轮线程之间的等待分钟数" />
|
||||
<input type="number" id="input-auto-skip-failures-thread-interval-minutes"
|
||||
class="data-input auto-delay-input" value="0" min="0" max="1440" step="1" title="兜底模式下,两轮线程之间的等待分钟数" />
|
||||
<span class="data-unit">分钟</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -374,19 +377,20 @@
|
||||
</div>
|
||||
<div class="data-row" id="row-account-run-history-helper-base-url" style="display:none;">
|
||||
<span class="data-label">同步服务</span>
|
||||
<input type="text" id="input-account-run-history-helper-base-url" class="data-input mono" placeholder="http://127.0.0.1:17373" />
|
||||
<input type="text" id="input-account-run-history-helper-base-url" class="data-input mono"
|
||||
placeholder="http://127.0.0.1:17373" />
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">OAuth</span>
|
||||
<span id="display-oauth-url" class="data-value mono truncate">等待中...</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">回调</span>
|
||||
<div class="data-inline data-value-actions">
|
||||
<span id="display-localhost-url" class="data-value data-value-fill mono truncate">等待中...</span>
|
||||
<button id="btn-save-settings" class="btn btn-outline btn-sm data-inline-btn" type="button">保存</button>
|
||||
<span class="data-label">OAuth</span>
|
||||
<span id="display-oauth-url" class="data-value mono truncate">等待中...</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">回调</span>
|
||||
<div class="data-inline data-value-actions">
|
||||
<span id="display-localhost-url" class="data-value data-value-fill mono truncate">等待中...</span>
|
||||
<button id="btn-save-settings" class="btn btn-outline btn-sm data-inline-btn" type="button">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cloudflare-temp-email-section" class="data-card hotmail-card" style="display:none;">
|
||||
<div class="section-mini-header">
|
||||
@@ -405,20 +409,24 @@
|
||||
</div>
|
||||
<div class="data-row" id="row-temp-email-admin-auth" style="display:none;">
|
||||
<span class="data-label">Admin Auth</span>
|
||||
<input type="password" id="input-temp-email-admin-auth" class="data-input data-input-with-icon" placeholder="Cloudflare Temp Email admin password" />
|
||||
<input type="password" id="input-temp-email-admin-auth" class="data-input data-input-with-icon"
|
||||
placeholder="Cloudflare Temp Email admin password" />
|
||||
</div>
|
||||
<div class="data-row" id="row-temp-email-custom-auth" style="display:none;">
|
||||
<span class="data-label">Custom Auth</span>
|
||||
<input type="password" id="input-temp-email-custom-auth" class="data-input data-input-with-icon" placeholder="仅当站点启用了访问密码时再填写;这是额外鉴权,不替代 Admin Auth。" />
|
||||
<input type="password" id="input-temp-email-custom-auth" class="data-input data-input-with-icon"
|
||||
placeholder="仅当站点启用了访问密码时再填写;这是额外鉴权,不替代 Admin Auth。" />
|
||||
</div>
|
||||
<div class="data-row" id="row-temp-email-receive-mailbox" style="display:none;">
|
||||
<span class="data-label">邮件接收</span>
|
||||
<input type="text" id="input-temp-email-receive-mailbox" class="data-input" placeholder="用于接收转发邮件的邮箱,例如 1@email.example.com" />
|
||||
<input type="text" id="input-temp-email-receive-mailbox" class="data-input"
|
||||
placeholder="用于接收转发邮件的邮箱,例如 1@email.example.com" />
|
||||
</div>
|
||||
<div class="data-row" id="row-temp-email-random-subdomain-toggle" style="display:none;">
|
||||
<span class="data-label">随机子域</span>
|
||||
<div class="data-inline">
|
||||
<label class="toggle-switch" for="input-temp-email-use-random-subdomain" title="依赖后端 RANDOM_SUBDOMAIN_DOMAINS 配置">
|
||||
<label class="toggle-switch" for="input-temp-email-use-random-subdomain"
|
||||
title="依赖后端 RANDOM_SUBDOMAIN_DOMAINS 配置">
|
||||
<input type="checkbox" id="input-temp-email-use-random-subdomain" />
|
||||
<span class="toggle-switch-track" aria-hidden="true">
|
||||
<span class="toggle-switch-thumb"></span>
|
||||
@@ -444,7 +452,8 @@
|
||||
<span class="section-label">Hotmail 账号池</span>
|
||||
</div>
|
||||
<div class="section-mini-actions">
|
||||
<button id="btn-toggle-hotmail-form" class="btn btn-outline btn-xs" type="button" aria-expanded="false">添加账号</button>
|
||||
<button id="btn-toggle-hotmail-form" class="btn btn-outline btn-xs" type="button"
|
||||
aria-expanded="false">添加账号</button>
|
||||
<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>
|
||||
@@ -461,11 +470,13 @@
|
||||
</div>
|
||||
<div class="data-row" id="row-hotmail-remote-base-url">
|
||||
<span class="data-label">API对接</span>
|
||||
<input type="text" id="input-hotmail-remote-base-url" class="data-input mono" placeholder="微软邮箱 API 对接模式无需填写地址" />
|
||||
<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>
|
||||
<input type="text" id="input-hotmail-local-base-url" class="data-input mono" placeholder="http://127.0.0.1:17373" />
|
||||
<input type="text" id="input-hotmail-local-base-url" class="data-input mono"
|
||||
placeholder="http://127.0.0.1:17373" />
|
||||
</div>
|
||||
<div id="hotmail-form-shell" class="account-pool-form-shell" hidden>
|
||||
<div class="data-row">
|
||||
@@ -489,7 +500,8 @@
|
||||
<span class="data-label"></span>
|
||||
<div class="data-inline account-pool-actions-inline">
|
||||
<button id="btn-add-hotmail-account" class="btn btn-primary btn-sm" type="button">添加账号</button>
|
||||
<button id="btn-import-hotmail-accounts" class="btn btn-outline btn-sm account-pool-import-action" type="button">批量导入</button>
|
||||
<button id="btn-import-hotmail-accounts" class="btn btn-outline btn-sm account-pool-import-action"
|
||||
type="button">批量导入</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row hotmail-import-row">
|
||||
@@ -510,9 +522,11 @@
|
||||
<span class="section-label">2925 账号池</span>
|
||||
</div>
|
||||
<div class="section-mini-actions">
|
||||
<button id="btn-toggle-mail2925-form" class="btn btn-outline btn-xs" type="button" aria-expanded="false">添加账号</button>
|
||||
<button id="btn-toggle-mail2925-form" class="btn btn-outline btn-xs" type="button"
|
||||
aria-expanded="false">添加账号</button>
|
||||
<button id="btn-delete-all-mail2925-accounts" class="btn btn-ghost btn-xs" type="button">全部删除</button>
|
||||
<button id="btn-toggle-mail2925-list" class="btn btn-ghost btn-xs" type="button" aria-expanded="false">展开列表</button>
|
||||
<button id="btn-toggle-mail2925-list" class="btn btn-ghost btn-xs" type="button"
|
||||
aria-expanded="false">展开列表</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mail2925-form-shell" class="account-pool-form-shell" hidden>
|
||||
@@ -528,7 +542,8 @@
|
||||
<span class="data-label"></span>
|
||||
<div class="data-inline account-pool-actions-inline">
|
||||
<button id="btn-add-mail2925-account" class="btn btn-primary btn-sm" type="button">添加账号</button>
|
||||
<button id="btn-import-mail2925-accounts" class="btn btn-outline btn-sm account-pool-import-action" type="button">批量导入</button>
|
||||
<button id="btn-import-mail2925-accounts" class="btn btn-outline btn-sm account-pool-import-action"
|
||||
type="button">批量导入</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-row hotmail-import-row">
|
||||
@@ -555,7 +570,8 @@
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">Base URL</span>
|
||||
<input type="text" id="input-luckmail-base-url" class="data-input mono" placeholder="https://mails.luckyous.com" />
|
||||
<input type="text" id="input-luckmail-base-url" class="data-input mono"
|
||||
placeholder="https://mails.luckyous.com" />
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">邮箱类型</span>
|
||||
@@ -587,7 +603,8 @@
|
||||
</div>
|
||||
<div id="luckmail-summary" class="luckmail-summary">加载已购邮箱后可在这里管理 openai 项目的 LuckMail 邮箱。</div>
|
||||
<div class="luckmail-toolbar">
|
||||
<input id="input-luckmail-search" class="data-input luckmail-search" type="text" placeholder="搜索邮箱 / 标签 / 项目" />
|
||||
<input id="input-luckmail-search" class="data-input luckmail-search" type="text"
|
||||
placeholder="搜索邮箱 / 标签 / 项目" />
|
||||
<select id="select-luckmail-filter" class="data-select luckmail-filter">
|
||||
<option value="all">全部</option>
|
||||
<option value="reusable">可复用</option>
|
||||
@@ -632,6 +649,13 @@
|
||||
<option value="icloud.com.cn">iCloud.com.cn</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">获取策略</span>
|
||||
<select id="select-icloud-fetch-mode" class="data-select">
|
||||
<option value="reuse_existing">优先复用已有未用别名</option>
|
||||
<option value="always_new">始终创建新别名</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="data-label">自动删除</span>
|
||||
<label class="option-toggle" for="checkbox-auto-delete-icloud">
|
||||
@@ -644,7 +668,8 @@
|
||||
<div id="icloud-login-help" class="icloud-login-help" style="display:none;">
|
||||
<div class="icloud-login-help-main">
|
||||
<div id="icloud-login-help-title" class="icloud-login-help-title">需要登录 iCloud</div>
|
||||
<div id="icloud-login-help-text" class="icloud-login-help-text">我已经为你打开 iCloud 登录页。请在那个页面完成登录,然后回到这里点击“我已登录”。</div>
|
||||
<div id="icloud-login-help-text" class="icloud-login-help-text">我已经为你打开 iCloud
|
||||
登录页。请在那个页面完成登录,然后回到这里点击“我已登录”。</div>
|
||||
</div>
|
||||
<button id="btn-icloud-login-done" class="btn btn-primary btn-xs" type="button">我已登录</button>
|
||||
</div>
|
||||
@@ -737,7 +762,8 @@
|
||||
<div id="account-records-stats" class="account-records-stats" role="group" aria-label="邮箱记录筛选"></div>
|
||||
<div class="account-records-toolbar-actions">
|
||||
<button id="btn-toggle-account-records-selection" class="btn btn-ghost btn-xs" type="button">多选</button>
|
||||
<button id="btn-delete-selected-account-records" class="btn btn-ghost btn-xs" type="button" hidden disabled>删除选中</button>
|
||||
<button id="btn-delete-selected-account-records" class="btn btn-ghost btn-xs" type="button" hidden
|
||||
disabled>删除选中</button>
|
||||
<button id="btn-clear-account-records" class="btn btn-ghost btn-xs" type="button">清理记录</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+46
-45
@@ -140,6 +140,7 @@ const btnIcloudLoginDone = document.getElementById('btn-icloud-login-done');
|
||||
const btnIcloudRefresh = document.getElementById('btn-icloud-refresh');
|
||||
const btnIcloudDeleteUsed = document.getElementById('btn-icloud-delete-used');
|
||||
const selectIcloudHostPreference = document.getElementById('select-icloud-host-preference');
|
||||
const selectIcloudFetchMode = document.getElementById('select-icloud-fetch-mode');
|
||||
const checkboxAutoDeleteIcloud = document.getElementById('checkbox-auto-delete-icloud');
|
||||
const inputIcloudSearch = document.getElementById('input-icloud-search');
|
||||
const selectIcloudFilter = document.getElementById('select-icloud-filter');
|
||||
@@ -527,6 +528,7 @@ let currentAutoRun = {
|
||||
let settingsDirty = false;
|
||||
let settingsSaveInFlight = false;
|
||||
let settingsAutoSaveTimer = null;
|
||||
let settingsSaveRevision = 0;
|
||||
let cloudflareDomainEditMode = false;
|
||||
let cloudflareTempEmailDomainEditMode = false;
|
||||
let modalChoiceResolver = null;
|
||||
@@ -562,6 +564,10 @@ const normalizeIcloudHost = window.IcloudUtils?.normalizeIcloudHost
|
||||
const normalized = String(value || '').trim().toLowerCase();
|
||||
return normalized === 'icloud.com' || normalized === 'icloud.com.cn' ? normalized : '';
|
||||
});
|
||||
const normalizeIcloudFetchMode = (value) => {
|
||||
const normalized = String(value || '').trim().toLowerCase();
|
||||
return normalized === 'always_new' ? 'always_new' : 'reuse_existing';
|
||||
};
|
||||
const getIcloudLoginUrlForHost = window.IcloudUtils?.getIcloudLoginUrlForHost
|
||||
|| ((host) => host === 'icloud.com.cn' ? 'https://www.icloud.com.cn/' : (host === 'icloud.com' ? 'https://www.icloud.com/' : ''));
|
||||
|
||||
@@ -628,8 +634,6 @@ const LOG_LEVEL_LABELS = {
|
||||
};
|
||||
|
||||
const CLOUDFLARE_TEMP_EMAIL_REPOSITORY_URL = 'https://github.com/dreamhunter2333/cloudflare_temp_email';
|
||||
const CLOUDFLARE_TEMP_EMAIL_BUILD_TUTORIAL_URL = 'https://linux.do/t/topic/316819';
|
||||
const CLOUDFLARE_TEMP_EMAIL_RANDOM_SUBDOMAIN_ISSUE_URL = 'https://github.com/dreamhunter2333/cloudflare_temp_email/issues/942';
|
||||
|
||||
function usesGeneratedAliasMailProvider(
|
||||
provider,
|
||||
@@ -1649,6 +1653,9 @@ function collectSettingsPayload() {
|
||||
!cloudflareTempEmailDomainEditMode ? selectTempEmailDomain.value : tempEmailActiveDomain
|
||||
) || tempEmailActiveDomain;
|
||||
const contributionModeEnabled = Boolean(latestState?.contributionMode);
|
||||
const icloudFetchModeRawValue = typeof selectIcloudFetchMode !== 'undefined'
|
||||
? String(selectIcloudFetchMode?.value || '')
|
||||
: '';
|
||||
const mail2925UseAccountPool = typeof inputMail2925UseAccountPool !== 'undefined'
|
||||
? Boolean(inputMail2925UseAccountPool?.checked)
|
||||
: Boolean(latestState?.mail2925UseAccountPool);
|
||||
@@ -1680,6 +1687,9 @@ function collectSettingsPayload() {
|
||||
: [],
|
||||
autoDeleteUsedIcloudAlias: checkboxAutoDeleteIcloud?.checked,
|
||||
icloudHostPreference: selectIcloudHostPreference?.value || 'auto',
|
||||
icloudFetchMode: (icloudFetchModeRawValue.trim().toLowerCase() === 'always_new'
|
||||
? 'always_new'
|
||||
: 'reuse_existing'),
|
||||
...(contributionModeEnabled ? {} : {
|
||||
accountRunHistoryTextEnabled: Boolean(inputAccountRunHistoryTextEnabled?.checked),
|
||||
accountRunHistoryHelperBaseUrl: normalizeAccountRunHistoryHelperBaseUrlValue(inputAccountRunHistoryHelperBaseUrl?.value),
|
||||
@@ -1858,6 +1868,9 @@ async function clearRegistrationEmail(options = {}) {
|
||||
|
||||
function markSettingsDirty(isDirty = true) {
|
||||
settingsDirty = isDirty;
|
||||
if (isDirty) {
|
||||
settingsSaveRevision += 1;
|
||||
}
|
||||
updateSaveButtonState();
|
||||
}
|
||||
|
||||
@@ -1883,6 +1896,7 @@ async function saveSettings(options = {}) {
|
||||
}
|
||||
|
||||
const payload = collectSettingsPayload();
|
||||
const saveRevision = settingsSaveRevision;
|
||||
settingsSaveInFlight = true;
|
||||
updateSaveButtonState();
|
||||
|
||||
@@ -1897,11 +1911,13 @@ async function saveSettings(options = {}) {
|
||||
throw new Error(response.error);
|
||||
}
|
||||
|
||||
if (response?.state) {
|
||||
if (response?.state && saveRevision === settingsSaveRevision) {
|
||||
applySettingsState(response.state);
|
||||
} else {
|
||||
syncLatestState(payload);
|
||||
markSettingsDirty(false);
|
||||
if (saveRevision === settingsSaveRevision) {
|
||||
markSettingsDirty(false);
|
||||
}
|
||||
updatePanelModeUI();
|
||||
updateMailProviderUI();
|
||||
updateButtonStates();
|
||||
@@ -2086,6 +2102,9 @@ function applySettingsState(state) {
|
||||
? 'icloud.com'
|
||||
: (String(state?.icloudHostPreference || '').trim().toLowerCase() === 'icloud.com.cn' ? 'icloud.com.cn' : 'auto');
|
||||
}
|
||||
if (selectIcloudFetchMode) {
|
||||
selectIcloudFetchMode.value = normalizeIcloudFetchMode(state?.icloudFetchMode);
|
||||
}
|
||||
if (checkboxAutoDeleteIcloud) {
|
||||
checkboxAutoDeleteIcloud.checked = Boolean(state?.autoDeleteUsedIcloudAlias);
|
||||
}
|
||||
@@ -2241,45 +2260,12 @@ function openReleaseListPage() {
|
||||
openExternalUrl(getReleaseListUrl());
|
||||
}
|
||||
|
||||
function buildCloudflareTempEmailUsageGuideModalConfig() {
|
||||
const useCloudflareTempEmailProvider = String(selectMailProvider?.value || '').trim().toLowerCase() === 'cloudflare-temp-email';
|
||||
const useCloudflareTempEmailGenerator = getSelectedEmailGenerator() === 'cloudflare-temp-email';
|
||||
let alertText = '当前还没有把 Cloudflare Temp Email 选为邮箱服务或邮箱生成器。下面说明同时覆盖“生成邮箱”和“接收转发邮件”两种用法。';
|
||||
if (useCloudflareTempEmailProvider && useCloudflareTempEmailGenerator) {
|
||||
alertText = '当前同时把 Cloudflare Temp Email 用作“邮箱服务”和“邮箱生成器”。请同时配置生成邮箱和接收转发两套必填项。';
|
||||
} else if (useCloudflareTempEmailProvider) {
|
||||
alertText = '当前把 Cloudflare Temp Email 用作“邮箱服务”。重点填写 Temp API、Custom Auth 和 邮件接收。';
|
||||
} else if (useCloudflareTempEmailGenerator) {
|
||||
alertText = '当前把 Cloudflare Temp Email 用作“邮箱生成器”。重点填写 Temp API、Admin Auth 和 Temp 域名;随机子域按需开启。';
|
||||
function openCloudflareTempEmailUsageGuidePage() {
|
||||
const targetUrl = getContributionPortalUrl();
|
||||
if (!targetUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
title: 'Cloudflare Temp Email 使用教程',
|
||||
alert: { text: alertText },
|
||||
messageHtml: `Temp API:填写 Cloudflare Temp Email 后端地址。<br><br>
|
||||
Admin Auth:填写后端 admin auth。<br>
|
||||
仅在“邮箱生成 = Cloudflare Temp Email”时必填。<br><br>
|
||||
Custom Auth:仅当站点额外开启访问密码时填写。没有开启就留空。<br><br>
|
||||
Temp 域名:填写允许创建的基础域名。启用随机子域时,这里仍然填写基础域名。<br><br>
|
||||
随机子域:仅在“邮箱生成 = Cloudflare Temp Email”时使用。<br>
|
||||
后端需要已配置 RANDOM_SUBDOMAIN_DOMAINS。<br>
|
||||
CF DNS 需要设置 MX *,参考 <a href="${CLOUDFLARE_TEMP_EMAIL_RANDOM_SUBDOMAIN_ISSUE_URL}" target="_blank" rel="noopener noreferrer">Issue #942</a>。<br><br>
|
||||
邮件接收:仅在“邮箱服务 = Cloudflare Temp Email”时填写。<br>
|
||||
这里填写真正接收转发邮件的目标邮箱。<br><br>
|
||||
搭建教程:<a href="${CLOUDFLARE_TEMP_EMAIL_BUILD_TUTORIAL_URL}" target="_blank" rel="noopener noreferrer">LINUX DO 教程</a>。`,
|
||||
};
|
||||
}
|
||||
|
||||
function showCloudflareTempEmailUsageGuide() {
|
||||
const modalConfig = buildCloudflareTempEmailUsageGuideModalConfig();
|
||||
return openActionModal({
|
||||
title: modalConfig.title,
|
||||
messageHtml: modalConfig.messageHtml,
|
||||
alert: modalConfig.alert,
|
||||
actions: [
|
||||
{ id: 'ok', label: '知道了', variant: 'btn-primary' },
|
||||
],
|
||||
});
|
||||
openExternalUrl(targetUrl);
|
||||
}
|
||||
|
||||
function openCloudflareTempEmailRepositoryPage() {
|
||||
@@ -3401,6 +3387,12 @@ function updateButtonStates() {
|
||||
if (btnIcloudRefresh) btnIcloudRefresh.disabled = disableIcloudControls;
|
||||
if (btnIcloudDeleteUsed) btnIcloudDeleteUsed.disabled = disableIcloudControls || !hasDeletableUsedIcloudAliases();
|
||||
if (selectIcloudHostPreference) selectIcloudHostPreference.disabled = disableIcloudControls;
|
||||
if (selectIcloudFetchMode) {
|
||||
const allowIcloudFetchMode = getSelectedEmailGenerator() === ICLOUD_PROVIDER
|
||||
&& !isCustomMailProvider()
|
||||
&& !isManagedAliasProvider();
|
||||
selectIcloudFetchMode.disabled = disableIcloudControls || !allowIcloudFetchMode;
|
||||
}
|
||||
if (checkboxAutoDeleteIcloud) checkboxAutoDeleteIcloud.disabled = disableIcloudControls;
|
||||
if (btnContributionMode) btnContributionMode.disabled = isContributionButtonLocked();
|
||||
updateStopButtonState(anyRunning || autoScheduled || isAutoRunPausedPhase() || autoLocked);
|
||||
@@ -3893,8 +3885,9 @@ const contributionModeManager = window.SidepanelContributionMode?.createContribu
|
||||
sendMessage: (message) => chrome.runtime.sendMessage(message),
|
||||
},
|
||||
constants: {
|
||||
contributionOauthUrl: `${contributionContentService?.portalUrl || 'https://apikey.qzz.io'}/oauth/`,
|
||||
contributionUploadUrl: contributionContentService?.portalUrl || 'https://apikey.qzz.io',
|
||||
contributionOauthUrl: `${String(contributionContentService?.portalUrl || 'https://apikey.qzz.io').replace(/\/+$/, '')}/oauth/`,
|
||||
contributionPortalUrl: String(contributionContentService?.portalUrl || 'https://apikey.qzz.io').replace(/\/+$/, ''),
|
||||
contributionUploadUrl: `${String(contributionContentService?.portalUrl || 'https://apikey.qzz.io').replace(/\/+$/, '')}/upload`,
|
||||
},
|
||||
});
|
||||
const baseRenderContributionMode = contributionModeManager?.render
|
||||
@@ -4220,7 +4213,7 @@ btnRepoHome?.addEventListener('click', () => {
|
||||
});
|
||||
|
||||
btnCloudflareTempEmailUsageGuide?.addEventListener('click', () => {
|
||||
showCloudflareTempEmailUsageGuide();
|
||||
openCloudflareTempEmailUsageGuidePage();
|
||||
});
|
||||
|
||||
btnCloudflareTempEmailGithub?.addEventListener('click', () => {
|
||||
@@ -4619,6 +4612,11 @@ selectIcloudHostPreference?.addEventListener('change', () => {
|
||||
}
|
||||
});
|
||||
|
||||
selectIcloudFetchMode?.addEventListener('change', () => {
|
||||
markSettingsDirty(true);
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
});
|
||||
|
||||
checkboxAutoDeleteIcloud?.addEventListener('change', () => {
|
||||
markSettingsDirty(true);
|
||||
saveSettings({ silent: true }).catch(() => { });
|
||||
@@ -5188,6 +5186,9 @@ chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
||||
? 'icloud.com'
|
||||
: (hostPreference === 'icloud.com.cn' ? 'icloud.com.cn' : 'auto');
|
||||
}
|
||||
if (message.payload.icloudFetchMode !== undefined && selectIcloudFetchMode) {
|
||||
selectIcloudFetchMode.value = normalizeIcloudFetchMode(message.payload.icloudFetchMode);
|
||||
}
|
||||
if (message.payload.autoRunSkipFailures !== undefined) {
|
||||
inputAutoSkipFailures.checked = Boolean(message.payload.autoRunSkipFailures);
|
||||
updateFallbackThreadIntervalInputState();
|
||||
|
||||
Reference in New Issue
Block a user