feat: 添加2925邮箱模式选择功能
This commit is contained in:
+31
-6
@@ -43,6 +43,9 @@ const AUTO_STEP_DELAY_MIN_ALLOWED_SECONDS = 0;
|
|||||||
const AUTO_STEP_DELAY_MAX_ALLOWED_SECONDS = 600;
|
const AUTO_STEP_DELAY_MAX_ALLOWED_SECONDS = 600;
|
||||||
const LEGACY_AUTO_STEP_DELAY_KEYS = ['autoStepRandomDelayMinSeconds', 'autoStepRandomDelayMaxSeconds'];
|
const LEGACY_AUTO_STEP_DELAY_KEYS = ['autoStepRandomDelayMinSeconds', 'autoStepRandomDelayMaxSeconds'];
|
||||||
const DEFAULT_LOCAL_CPA_STEP9_MODE = 'submit';
|
const DEFAULT_LOCAL_CPA_STEP9_MODE = 'submit';
|
||||||
|
const MAIL_2925_MODE_PROVIDE = 'provide';
|
||||||
|
const MAIL_2925_MODE_RECEIVE = 'receive';
|
||||||
|
const DEFAULT_MAIL_2925_MODE = MAIL_2925_MODE_PROVIDE;
|
||||||
const HOTMAIL_SERVICE_MODE_REMOTE = 'remote';
|
const HOTMAIL_SERVICE_MODE_REMOTE = 'remote';
|
||||||
const HOTMAIL_SERVICE_MODE_LOCAL = 'local';
|
const HOTMAIL_SERVICE_MODE_LOCAL = 'local';
|
||||||
const DEFAULT_HOTMAIL_REMOTE_BASE_URL = '';
|
const DEFAULT_HOTMAIL_REMOTE_BASE_URL = '';
|
||||||
@@ -72,6 +75,7 @@ const PERSISTED_SETTING_DEFAULTS = {
|
|||||||
autoRunDelayMinutes: 30,
|
autoRunDelayMinutes: 30,
|
||||||
autoStepDelaySeconds: null,
|
autoStepDelaySeconds: null,
|
||||||
mailProvider: '163',
|
mailProvider: '163',
|
||||||
|
mail2925Mode: DEFAULT_MAIL_2925_MODE,
|
||||||
emailGenerator: 'duck',
|
emailGenerator: 'duck',
|
||||||
emailPrefix: '',
|
emailPrefix: '',
|
||||||
inbucketHost: '',
|
inbucketHost: '',
|
||||||
@@ -244,6 +248,12 @@ function normalizeMailProvider(value = '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeMail2925Mode(value = '') {
|
||||||
|
return String(value || '').trim().toLowerCase() === MAIL_2925_MODE_RECEIVE
|
||||||
|
? MAIL_2925_MODE_RECEIVE
|
||||||
|
: DEFAULT_MAIL_2925_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeLocalCpaStep9Mode(value = '') {
|
function normalizeLocalCpaStep9Mode(value = '') {
|
||||||
return String(value || '').trim().toLowerCase() === 'bypass'
|
return String(value || '').trim().toLowerCase() === 'bypass'
|
||||||
? 'bypass'
|
? 'bypass'
|
||||||
@@ -361,6 +371,8 @@ function normalizePersistentSettingValue(key, value) {
|
|||||||
return normalizeAutoStepDelaySeconds(value, PERSISTED_SETTING_DEFAULTS.autoStepDelaySeconds);
|
return normalizeAutoStepDelaySeconds(value, PERSISTED_SETTING_DEFAULTS.autoStepDelaySeconds);
|
||||||
case 'mailProvider':
|
case 'mailProvider':
|
||||||
return normalizeMailProvider(value);
|
return normalizeMailProvider(value);
|
||||||
|
case 'mail2925Mode':
|
||||||
|
return normalizeMail2925Mode(value);
|
||||||
case 'emailGenerator':
|
case 'emailGenerator':
|
||||||
return normalizeEmailGenerator(value);
|
return normalizeEmailGenerator(value);
|
||||||
case 'emailPrefix':
|
case 'emailPrefix':
|
||||||
@@ -653,6 +665,13 @@ function isCustomMailProvider(stateOrProvider) {
|
|||||||
return provider === 'custom';
|
return provider === 'custom';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMail2925Mode(stateOrMode) {
|
||||||
|
if (typeof stateOrMode === 'string') {
|
||||||
|
return normalizeMail2925Mode(stateOrMode);
|
||||||
|
}
|
||||||
|
return normalizeMail2925Mode(stateOrMode?.mail2925Mode);
|
||||||
|
}
|
||||||
|
|
||||||
async function syncHotmailAccounts(accounts) {
|
async function syncHotmailAccounts(accounts) {
|
||||||
const normalized = normalizeHotmailAccounts(accounts);
|
const normalized = normalizeHotmailAccounts(accounts);
|
||||||
await setPersistentSettings({ hotmailAccounts: normalized });
|
await setPersistentSettings({ hotmailAccounts: normalized });
|
||||||
@@ -1276,14 +1295,20 @@ function generateRandomSuffix(length = 6) {
|
|||||||
return suffix;
|
return suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isGeneratedAliasProvider(provider) {
|
function isGeneratedAliasProvider(stateOrProvider, mail2925Mode = undefined) {
|
||||||
return provider === '2925';
|
const provider = typeof stateOrProvider === 'string'
|
||||||
|
? stateOrProvider
|
||||||
|
: stateOrProvider?.mailProvider;
|
||||||
|
const resolvedMail2925Mode = mail2925Mode !== undefined
|
||||||
|
? normalizeMail2925Mode(mail2925Mode)
|
||||||
|
: getMail2925Mode(stateOrProvider);
|
||||||
|
return provider === '2925' && resolvedMail2925Mode === MAIL_2925_MODE_PROVIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldUseCustomRegistrationEmail(state = {}) {
|
function shouldUseCustomRegistrationEmail(state = {}) {
|
||||||
return isCustomMailProvider(state)
|
return isCustomMailProvider(state)
|
||||||
|| (!isHotmailProvider(state)
|
|| (!isHotmailProvider(state)
|
||||||
&& !isGeneratedAliasProvider(state.mailProvider)
|
&& !isGeneratedAliasProvider(state)
|
||||||
&& normalizeEmailGenerator(state.emailGenerator) === 'custom');
|
&& normalizeEmailGenerator(state.emailGenerator) === 'custom');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,7 +1320,7 @@ function buildGeneratedAliasEmail(state) {
|
|||||||
throw new Error('2925 邮箱前缀未设置,请先在侧边栏填写。');
|
throw new Error('2925 邮箱前缀未设置,请先在侧边栏填写。');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider === '2925') {
|
if (provider === '2925' && isGeneratedAliasProvider(state)) {
|
||||||
return `${emailPrefix}${generateRandomSuffix(6)}@2925.com`;
|
return `${emailPrefix}${generateRandomSuffix(6)}@2925.com`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3564,7 +3589,7 @@ async function ensureAutoEmailReady(targetRun, totalRuns, attemptRuns) {
|
|||||||
return account.email;
|
return account.email;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGeneratedAliasProvider(currentState.mailProvider)) {
|
if (isGeneratedAliasProvider(currentState)) {
|
||||||
if (!currentState.emailPrefix) {
|
if (!currentState.emailPrefix) {
|
||||||
throw new Error('2925 邮箱前缀未设置,请先在侧边栏填写。');
|
throw new Error('2925 邮箱前缀未设置,请先在侧边栏填写。');
|
||||||
}
|
}
|
||||||
@@ -4690,7 +4715,7 @@ async function executeStep3(state) {
|
|||||||
preferredAccountId: state.currentHotmailAccountId || null,
|
preferredAccountId: state.currentHotmailAccountId || null,
|
||||||
});
|
});
|
||||||
resolvedEmail = account.email;
|
resolvedEmail = account.email;
|
||||||
} else if (isGeneratedAliasProvider(state.mailProvider)) {
|
} else if (isGeneratedAliasProvider(state)) {
|
||||||
resolvedEmail = buildGeneratedAliasEmail(state);
|
resolvedEmail = buildGeneratedAliasEmail(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,13 @@
|
|||||||
<button id="btn-mail-login" class="btn btn-outline btn-sm data-inline-btn" type="button" disabled>登录</button>
|
<button id="btn-mail-login" class="btn btn-outline btn-sm data-inline-btn" type="button" disabled>登录</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="data-row" id="row-mail-2925-mode" style="display:none;">
|
||||||
|
<span class="data-label">2925 模式</span>
|
||||||
|
<div id="mail-2925-mode-group" class="choice-group" role="group" aria-label="2925 邮箱模式">
|
||||||
|
<button type="button" class="choice-btn" data-mail-2925-mode="provide">提供邮箱</button>
|
||||||
|
<button type="button" class="choice-btn" data-mail-2925-mode="receive">接收邮箱</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="data-row" id="row-email-generator">
|
<div class="data-row" id="row-email-generator">
|
||||||
<span class="data-label">邮箱生成</span>
|
<span class="data-label">邮箱生成</span>
|
||||||
<select id="select-email-generator" class="data-select">
|
<select id="select-email-generator" class="data-select">
|
||||||
|
|||||||
+73
-8
@@ -66,6 +66,8 @@ const rowSub2ApiGroup = document.getElementById('row-sub2api-group');
|
|||||||
const inputSub2ApiGroup = document.getElementById('input-sub2api-group');
|
const inputSub2ApiGroup = document.getElementById('input-sub2api-group');
|
||||||
const selectMailProvider = document.getElementById('select-mail-provider');
|
const selectMailProvider = document.getElementById('select-mail-provider');
|
||||||
const btnMailLogin = document.getElementById('btn-mail-login');
|
const btnMailLogin = document.getElementById('btn-mail-login');
|
||||||
|
const rowMail2925Mode = document.getElementById('row-mail-2925-mode');
|
||||||
|
const mail2925ModeButtons = Array.from(document.querySelectorAll('[data-mail-2925-mode]'));
|
||||||
const rowEmailGenerator = document.getElementById('row-email-generator');
|
const rowEmailGenerator = document.getElementById('row-email-generator');
|
||||||
const selectEmailGenerator = document.getElementById('select-email-generator');
|
const selectEmailGenerator = document.getElementById('select-email-generator');
|
||||||
const hotmailSection = document.getElementById('hotmail-section');
|
const hotmailSection = document.getElementById('hotmail-section');
|
||||||
@@ -139,6 +141,9 @@ const AUTO_RUN_MAX_RETRIES_PER_ROUND = 3;
|
|||||||
const AUTO_STEP_DELAY_MIN_SECONDS = 0;
|
const AUTO_STEP_DELAY_MIN_SECONDS = 0;
|
||||||
const AUTO_STEP_DELAY_MAX_SECONDS = 600;
|
const AUTO_STEP_DELAY_MAX_SECONDS = 600;
|
||||||
const DEFAULT_LOCAL_CPA_STEP9_MODE = 'submit';
|
const DEFAULT_LOCAL_CPA_STEP9_MODE = 'submit';
|
||||||
|
const MAIL_2925_MODE_PROVIDE = 'provide';
|
||||||
|
const MAIL_2925_MODE_RECEIVE = 'receive';
|
||||||
|
const DEFAULT_MAIL_2925_MODE = MAIL_2925_MODE_PROVIDE;
|
||||||
const AUTO_SKIP_FAILURES_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-auto-skip-failures-prompt-dismissed';
|
const AUTO_SKIP_FAILURES_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-auto-skip-failures-prompt-dismissed';
|
||||||
const AUTO_RUN_FALLBACK_RISK_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-auto-run-fallback-risk-prompt-dismissed';
|
const AUTO_RUN_FALLBACK_RISK_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-auto-run-fallback-risk-prompt-dismissed';
|
||||||
const AUTO_RUN_FALLBACK_RISK_WARNING_MIN_RUNS = 15;
|
const AUTO_RUN_FALLBACK_RISK_WARNING_MIN_RUNS = 15;
|
||||||
@@ -226,7 +231,8 @@ const LOG_LEVEL_LABELS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function usesGeneratedAliasMailProvider(provider) {
|
function usesGeneratedAliasMailProvider(provider) {
|
||||||
return provider === '2925';
|
return String(provider || '').trim() === '2925'
|
||||||
|
&& getSelectedMail2925Mode() === MAIL_2925_MODE_PROVIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showToast(message, type = 'error', duration = 4000) {
|
function showToast(message, type = 'error', duration = 4000) {
|
||||||
@@ -926,6 +932,7 @@ function collectSettingsPayload() {
|
|||||||
sub2apiGroupName: inputSub2ApiGroup.value.trim(),
|
sub2apiGroupName: inputSub2ApiGroup.value.trim(),
|
||||||
customPassword: inputPassword.value,
|
customPassword: inputPassword.value,
|
||||||
mailProvider: selectMailProvider.value,
|
mailProvider: selectMailProvider.value,
|
||||||
|
mail2925Mode: getSelectedMail2925Mode(),
|
||||||
emailGenerator: selectEmailGenerator.value,
|
emailGenerator: selectEmailGenerator.value,
|
||||||
emailPrefix: inputEmailPrefix.value.trim(),
|
emailPrefix: inputEmailPrefix.value.trim(),
|
||||||
inbucketHost: inputInbucketHost.value.trim(),
|
inbucketHost: inputInbucketHost.value.trim(),
|
||||||
@@ -949,6 +956,12 @@ function normalizeLocalCpaStep9Mode(value = '') {
|
|||||||
: DEFAULT_LOCAL_CPA_STEP9_MODE;
|
: DEFAULT_LOCAL_CPA_STEP9_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeMail2925Mode(value = '') {
|
||||||
|
return String(value || '').trim().toLowerCase() === MAIL_2925_MODE_RECEIVE
|
||||||
|
? MAIL_2925_MODE_RECEIVE
|
||||||
|
: DEFAULT_MAIL_2925_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeHotmailServiceMode(value = '') {
|
function normalizeHotmailServiceMode(value = '') {
|
||||||
return HOTMAIL_SERVICE_MODE_LOCAL;
|
return HOTMAIL_SERVICE_MODE_LOCAL;
|
||||||
}
|
}
|
||||||
@@ -967,6 +980,20 @@ function setLocalCpaStep9Mode(mode) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSelectedMail2925Mode() {
|
||||||
|
const activeButton = mail2925ModeButtons.find((button) => button.classList.contains('is-active'));
|
||||||
|
return normalizeMail2925Mode(activeButton?.dataset.mail2925Mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMail2925Mode(mode) {
|
||||||
|
const resolvedMode = normalizeMail2925Mode(mode);
|
||||||
|
mail2925ModeButtons.forEach((button) => {
|
||||||
|
const active = button.dataset.mail2925Mode === resolvedMode;
|
||||||
|
button.classList.toggle('is-active', active);
|
||||||
|
button.setAttribute('aria-pressed', String(active));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getSelectedHotmailServiceMode() {
|
function getSelectedHotmailServiceMode() {
|
||||||
const activeButton = hotmailServiceModeButtons.find((button) => button.classList.contains('is-active'));
|
const activeButton = hotmailServiceModeButtons.find((button) => button.classList.contains('is-active'));
|
||||||
return normalizeHotmailServiceMode(activeButton?.dataset.hotmailServiceMode);
|
return normalizeHotmailServiceMode(activeButton?.dataset.hotmailServiceMode);
|
||||||
@@ -1213,6 +1240,7 @@ function applySettingsState(state) {
|
|||||||
? 'custom'
|
? 'custom'
|
||||||
: '163');
|
: '163');
|
||||||
selectMailProvider.value = restoredMailProvider;
|
selectMailProvider.value = restoredMailProvider;
|
||||||
|
setMail2925Mode(state?.mail2925Mode);
|
||||||
selectEmailGenerator.value = String(state?.emailGenerator || '').trim().toLowerCase() === 'cloudflare' ? 'cloudflare' : 'duck';
|
selectEmailGenerator.value = String(state?.emailGenerator || '').trim().toLowerCase() === 'cloudflare' ? 'cloudflare' : 'duck';
|
||||||
inputEmailPrefix.value = state?.emailPrefix || '';
|
inputEmailPrefix.value = state?.emailPrefix || '';
|
||||||
inputInbucketHost.value = state?.inbucketHost || '';
|
inputInbucketHost.value = state?.inbucketHost || '';
|
||||||
@@ -1567,9 +1595,13 @@ function isCurrentEmailManagedByHotmail(state = latestState) {
|
|||||||
return inputEmailValue === hotmailEmail || stateEmailValue === hotmailEmail;
|
return inputEmailValue === hotmailEmail || stateEmailValue === hotmailEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCurrentEmailManagedByGeneratedAlias(provider = latestState?.mailProvider, state = latestState) {
|
function isCurrentEmailManagedByGeneratedAlias(
|
||||||
|
provider = latestState?.mailProvider,
|
||||||
|
state = latestState,
|
||||||
|
mail2925Mode = latestState?.mail2925Mode
|
||||||
|
) {
|
||||||
const normalizedProvider = String(provider || '').trim();
|
const normalizedProvider = String(provider || '').trim();
|
||||||
if (!usesGeneratedAliasMailProvider(normalizedProvider)) {
|
if (!(normalizedProvider === '2925' && normalizeMail2925Mode(mail2925Mode) === MAIL_2925_MODE_PROVIDE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1803,12 +1835,16 @@ function renderHotmailAccounts() {
|
|||||||
|
|
||||||
function updateMailProviderUI() {
|
function updateMailProviderUI() {
|
||||||
const use2925 = selectMailProvider.value === '2925';
|
const use2925 = selectMailProvider.value === '2925';
|
||||||
const useGeneratedAlias = usesGeneratedAliasMailProvider(selectMailProvider.value);
|
const mail2925Mode = getSelectedMail2925Mode();
|
||||||
|
const useGeneratedAlias = use2925 && mail2925Mode === MAIL_2925_MODE_PROVIDE;
|
||||||
const useInbucket = selectMailProvider.value === 'inbucket';
|
const useInbucket = selectMailProvider.value === 'inbucket';
|
||||||
const useHotmail = selectMailProvider.value === 'hotmail-api';
|
const useHotmail = selectMailProvider.value === 'hotmail-api';
|
||||||
const useCustomEmail = isCustomMailProvider();
|
const useCustomEmail = isCustomMailProvider();
|
||||||
const useEmailGenerator = !useHotmail && !useGeneratedAlias && !useCustomEmail;
|
const useEmailGenerator = !useHotmail && !useGeneratedAlias && !useCustomEmail;
|
||||||
updateMailLoginButtonState();
|
updateMailLoginButtonState();
|
||||||
|
if (rowMail2925Mode) {
|
||||||
|
rowMail2925Mode.style.display = use2925 ? '' : 'none';
|
||||||
|
}
|
||||||
rowEmailPrefix.style.display = useGeneratedAlias ? '' : 'none';
|
rowEmailPrefix.style.display = useGeneratedAlias ? '' : 'none';
|
||||||
const hotmailServiceMode = getSelectedHotmailServiceMode();
|
const hotmailServiceMode = getSelectedHotmailServiceMode();
|
||||||
rowInbucketHost.style.display = useInbucket ? '' : 'none';
|
rowInbucketHost.style.display = useInbucket ? '' : 'none';
|
||||||
@@ -1846,7 +1882,7 @@ function updateMailProviderUI() {
|
|||||||
const uiCopy = useCustomEmail ? getCustomMailProviderUiCopy() : getEmailGeneratorUiCopy();
|
const uiCopy = useCustomEmail ? getCustomMailProviderUiCopy() : getEmailGeneratorUiCopy();
|
||||||
inputEmail.placeholder = useHotmail
|
inputEmail.placeholder = useHotmail
|
||||||
? '由 Hotmail 账号池自动分配'
|
? '由 Hotmail 账号池自动分配'
|
||||||
: (use2925 ? '步骤 3 自动生成 2925 邮箱并回填' : uiCopy.placeholder);
|
: (useGeneratedAlias ? '步骤 3 自动生成 2925 邮箱并回填' : uiCopy.placeholder);
|
||||||
btnFetchEmail.disabled = useGeneratedAlias || useCustomEmail || isAutoRunLockedPhase();
|
btnFetchEmail.disabled = useGeneratedAlias || useCustomEmail || isAutoRunLockedPhase();
|
||||||
if (!btnFetchEmail.disabled) {
|
if (!btnFetchEmail.disabled) {
|
||||||
btnFetchEmail.textContent = uiCopy.buttonLabel;
|
btnFetchEmail.textContent = uiCopy.buttonLabel;
|
||||||
@@ -3002,14 +3038,18 @@ inputPassword.addEventListener('blur', () => {
|
|||||||
|
|
||||||
selectMailProvider.addEventListener('change', async () => {
|
selectMailProvider.addEventListener('change', async () => {
|
||||||
const previousProvider = latestState?.mailProvider || '';
|
const previousProvider = latestState?.mailProvider || '';
|
||||||
|
const previousMail2925Mode = latestState?.mail2925Mode;
|
||||||
const nextProvider = selectMailProvider.value;
|
const nextProvider = selectMailProvider.value;
|
||||||
updateMailProviderUI();
|
updateMailProviderUI();
|
||||||
const leavingHotmail = previousProvider === 'hotmail-api'
|
const leavingHotmail = previousProvider === 'hotmail-api'
|
||||||
&& nextProvider !== 'hotmail-api'
|
&& nextProvider !== 'hotmail-api'
|
||||||
&& isCurrentEmailManagedByHotmail();
|
&& isCurrentEmailManagedByHotmail();
|
||||||
const leavingGeneratedAlias = previousProvider !== nextProvider
|
const leavingGeneratedAlias = (
|
||||||
&& usesGeneratedAliasMailProvider(previousProvider)
|
previousProvider !== nextProvider
|
||||||
&& isCurrentEmailManagedByGeneratedAlias(previousProvider);
|
|| (previousProvider === '2925' && normalizeMail2925Mode(previousMail2925Mode) !== getSelectedMail2925Mode())
|
||||||
|
) && previousProvider === '2925'
|
||||||
|
&& normalizeMail2925Mode(previousMail2925Mode) === MAIL_2925_MODE_PROVIDE
|
||||||
|
&& isCurrentEmailManagedByGeneratedAlias(previousProvider, latestState, previousMail2925Mode);
|
||||||
if (leavingHotmail || leavingGeneratedAlias) {
|
if (leavingHotmail || leavingGeneratedAlias) {
|
||||||
await clearRegistrationEmail({ silent: true }).catch(() => { });
|
await clearRegistrationEmail({ silent: true }).catch(() => { });
|
||||||
}
|
}
|
||||||
@@ -3017,6 +3057,30 @@ selectMailProvider.addEventListener('change', async () => {
|
|||||||
saveSettings({ silent: true }).catch(() => { });
|
saveSettings({ silent: true }).catch(() => { });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mail2925ModeButtons.forEach((button) => {
|
||||||
|
button.addEventListener('click', async () => {
|
||||||
|
const nextMode = normalizeMail2925Mode(button.dataset.mail2925Mode);
|
||||||
|
const previousMode = normalizeMail2925Mode(latestState?.mail2925Mode);
|
||||||
|
if (nextMode === getSelectedMail2925Mode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMail2925Mode(nextMode);
|
||||||
|
updateMailProviderUI();
|
||||||
|
|
||||||
|
const leavingGeneratedAlias = selectMailProvider.value === '2925'
|
||||||
|
&& previousMode === MAIL_2925_MODE_PROVIDE
|
||||||
|
&& nextMode !== MAIL_2925_MODE_PROVIDE
|
||||||
|
&& isCurrentEmailManagedByGeneratedAlias('2925', latestState, previousMode);
|
||||||
|
if (leavingGeneratedAlias) {
|
||||||
|
await clearRegistrationEmail({ silent: true }).catch(() => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
markSettingsDirty(true);
|
||||||
|
saveSettings({ silent: true }).catch(() => { });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
selectEmailGenerator.addEventListener('change', () => {
|
selectEmailGenerator.addEventListener('change', () => {
|
||||||
updateMailProviderUI();
|
updateMailProviderUI();
|
||||||
clearRegistrationEmail({ silent: true }).catch(() => { });
|
clearRegistrationEmail({ silent: true }).catch(() => { });
|
||||||
@@ -3402,6 +3466,7 @@ initHotmailListExpandedState();
|
|||||||
updateSaveButtonState();
|
updateSaveButtonState();
|
||||||
updateConfigMenuControls();
|
updateConfigMenuControls();
|
||||||
setLocalCpaStep9Mode(DEFAULT_LOCAL_CPA_STEP9_MODE);
|
setLocalCpaStep9Mode(DEFAULT_LOCAL_CPA_STEP9_MODE);
|
||||||
|
setMail2925Mode(DEFAULT_MAIL_2925_MODE);
|
||||||
initializeReleaseInfo().catch((err) => {
|
initializeReleaseInfo().catch((err) => {
|
||||||
console.error('Failed to initialize release info:', err);
|
console.error('Failed to initialize release info:', err);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user