feat: support custom email pool in the merged dev registration flow

- 吸收 dev 最新 sidepanel 与收码链路改动,保留 Cloudflare Temp Email 独立设置区、贡献模式自动前提醒和 2925 当前账号恢复接线

- 修复生成邮箱辅助层对运行态参数的判断,避免 Gmail 别名与自定义邮箱池误用旧的已保存状态

- 补充自定义邮箱池相关测试与文档,更新 README、项目结构说明和完整链路说明
This commit is contained in:
QLHazyCoder
2026-04-23 20:40:50 +08:00
51 changed files with 4479 additions and 230 deletions
+21 -5
View File
@@ -148,6 +148,7 @@
const requestedName = String(options.localPart || options.name || '').trim().toLowerCase() || generateCloudflareAliasLocalPart();
const payload = {
enablePrefix: true,
enableRandomSubdomain: Boolean(config.useRandomSubdomain),
name: requestedName,
domain: config.domain,
};
@@ -254,26 +255,41 @@
? options.mail2925Mode
: currentState.mail2925Mode;
const generator = normalizeEmailGenerator(options.generator ?? currentState.emailGenerator);
const mergedState = {
...currentState,
mailProvider: provider || currentState.mailProvider,
mail2925Mode,
emailGenerator: generator,
};
if (options.gmailBaseEmail !== undefined) {
mergedState.gmailBaseEmail = String(options.gmailBaseEmail || '').trim();
}
if (options.mail2925BaseEmail !== undefined) {
mergedState.mail2925BaseEmail = String(options.mail2925BaseEmail || '').trim();
}
if (options.customEmailPool !== undefined) {
mergedState.customEmailPool = options.customEmailPool;
}
if (generator === 'custom') {
throw new Error('当前邮箱生成方式为自定义邮箱,请直接填写注册邮箱。');
}
if (generator === CUSTOM_EMAIL_POOL_GENERATOR) {
return fetchCustomEmailPoolEmail(currentState, options);
return fetchCustomEmailPoolEmail(mergedState, options);
}
const shouldUseManagedAlias = typeof isGeneratedAliasProvider === 'function'
? isGeneratedAliasProvider(currentState, mail2925Mode)
? isGeneratedAliasProvider(mergedState, mail2925Mode)
: false;
if (shouldUseManagedAlias) {
return fetchManagedAliasEmail(currentState, options);
return fetchManagedAliasEmail(mergedState, options);
}
if (generator === 'icloud') {
return fetchIcloudHideMyEmail();
}
if (generator === 'cloudflare') {
return fetchCloudflareEmail(currentState, options);
return fetchCloudflareEmail(mergedState, options);
}
if (generator === CLOUDFLARE_TEMP_EMAIL_GENERATOR) {
return fetchCloudflareTempEmailAddress(currentState, options);
return fetchCloudflareTempEmailAddress(mergedState, options);
}
return fetchDuckEmail(options);
}