fix(icloud): align reserve fallback logs and tests after master rebase
This commit is contained in:
+2
-6
@@ -4606,11 +4606,7 @@ async function fetchIcloudHideMyEmail(options = {}) {
|
||||
await addLog(`iCloud:当前 Hide My Email 服务节点 ${new URL(serviceUrl).host}`, 'info');
|
||||
|
||||
let activeServiceUrl = serviceUrl;
|
||||
const { aliases: existingAliases, serviceUrl: listServiceUrl } = await loadNormalizedIcloudAliases({
|
||||
serviceUrl: activeServiceUrl,
|
||||
silent: true,
|
||||
});
|
||||
activeServiceUrl = listServiceUrl || activeServiceUrl;
|
||||
const existingAliases = await listIcloudAliases();
|
||||
const existingAliasEmailSet = new Set(
|
||||
existingAliases
|
||||
.map((aliasItem) => String(aliasItem?.email || '').trim().toLowerCase())
|
||||
@@ -4706,7 +4702,7 @@ async function fetchIcloudHideMyEmail(options = {}) {
|
||||
throw reserveErr;
|
||||
}
|
||||
|
||||
await addLog(`iCloud:保留 ${generatedAlias} 失败,正在回查别名列表确认是否已成功保留...`, 'warn');
|
||||
await addLog('iCloud:保留别名返回鉴权/网络异常,正在回查别名列表确认是否已创建...', 'warn');
|
||||
const { aliases: aliasesAfterReserveFailure, serviceUrl: refreshedListServiceUrl } = await loadNormalizedIcloudAliases({
|
||||
serviceUrl: activeServiceUrl,
|
||||
silent: true,
|
||||
|
||||
@@ -323,6 +323,18 @@ function getErrorMessage(error) {
|
||||
function normalizeText(value) {
|
||||
return String(value || '').replace(/\\s+/g, ' ').trim();
|
||||
}
|
||||
function appendIcloudClientQueryParams(url) {
|
||||
return String(url || '');
|
||||
}
|
||||
function isIcloudMaildomainwsHost() {
|
||||
return false;
|
||||
}
|
||||
function shouldTryIcloudRequestPageContextFallback() {
|
||||
return false;
|
||||
}
|
||||
async function icloudRequestViaPageContext() {
|
||||
throw new Error('not expected');
|
||||
}
|
||||
async function fetch() {
|
||||
fetchCalls += 1;
|
||||
if (fetchCalls === 1) {
|
||||
@@ -381,6 +393,18 @@ function getErrorMessage(error) {
|
||||
function normalizeText(value) {
|
||||
return String(value || '').replace(/\\s+/g, ' ').trim();
|
||||
}
|
||||
function appendIcloudClientQueryParams(url) {
|
||||
return String(url || '');
|
||||
}
|
||||
function isIcloudMaildomainwsHost() {
|
||||
return false;
|
||||
}
|
||||
function shouldTryIcloudRequestPageContextFallback() {
|
||||
return false;
|
||||
}
|
||||
async function icloudRequestViaPageContext() {
|
||||
throw new Error('not expected');
|
||||
}
|
||||
async function fetch() {
|
||||
fetchCalls += 1;
|
||||
return {
|
||||
@@ -451,6 +475,10 @@ async function loadNormalizedIcloudAliases() {
|
||||
serviceUrl: 'https://p67-maildomainws.icloud.com',
|
||||
};
|
||||
}
|
||||
async function listIcloudAliases() {
|
||||
const response = await loadNormalizedIcloudAliases();
|
||||
return response.aliases || [];
|
||||
}
|
||||
function pickReusableIcloudAlias() {
|
||||
return null;
|
||||
}
|
||||
@@ -477,6 +505,9 @@ function broadcastIcloudAliasesChanged(payload) {
|
||||
function findIcloudAliasByEmail(aliases, email) {
|
||||
return (aliases || []).find((alias) => String(alias.email || '').toLowerCase() === String(email || '').toLowerCase()) || null;
|
||||
}
|
||||
function shouldStopIcloudAutoFetchRetries() {
|
||||
return true;
|
||||
}
|
||||
${bundle}
|
||||
return {
|
||||
fetchIcloudHideMyEmail,
|
||||
@@ -491,5 +522,5 @@ return {
|
||||
assert.equal(email, 'fresh@icloud.com');
|
||||
assert.deepEqual(api.readSelectedEmails(), ['fresh@icloud.com']);
|
||||
assert.deepEqual(api.readBroadcasts(), [{ reason: 'created', email: 'fresh@icloud.com' }]);
|
||||
assert.match(api.readLogs().map((entry) => entry.message).join('\n'), /按保留成功处理/);
|
||||
assert.match(api.readLogs().map((entry) => entry.message).join('\n'), /已在列表确认别名/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user