fix: 补齐 126 邮箱 host 家族识别
This commit is contained in:
@@ -3542,6 +3542,8 @@ function is163MailHost(hostname = '') {
|
|||||||
}
|
}
|
||||||
return hostname === 'mail.163.com'
|
return hostname === 'mail.163.com'
|
||||||
|| hostname.endsWith('.mail.163.com')
|
|| hostname.endsWith('.mail.163.com')
|
||||||
|
|| hostname === 'mail.126.com'
|
||||||
|
|| hostname.endsWith('.mail.126.com')
|
||||||
|| hostname === 'webmail.vip.163.com';
|
|| hostname === 'webmail.vip.163.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
function is163MailHost(hostname = '') {
|
function is163MailHost(hostname = '') {
|
||||||
return hostname === 'mail.163.com'
|
return hostname === 'mail.163.com'
|
||||||
|| hostname.endsWith('.mail.163.com')
|
|| hostname.endsWith('.mail.163.com')
|
||||||
|
|| hostname === 'mail.126.com'
|
||||||
|
|| hostname.endsWith('.mail.126.com')
|
||||||
|| hostname === 'webmail.vip.163.com';
|
|| hostname === 'webmail.vip.163.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,3 +15,23 @@ test('navigation utils module exposes a factory', () => {
|
|||||||
|
|
||||||
assert.equal(typeof api?.createNavigationUtils, 'function');
|
assert.equal(typeof api?.createNavigationUtils, 'function');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('navigation utils treat 126 mail hosts as part of the shared NetEase mail family', () => {
|
||||||
|
const source = fs.readFileSync('background/navigation-utils.js', 'utf8');
|
||||||
|
const globalScope = {};
|
||||||
|
const moduleApi = new Function('self', `${source}; return self.MultiPageBackgroundNavigationUtils;`)(globalScope);
|
||||||
|
const navigationUtils = moduleApi.createNavigationUtils({
|
||||||
|
DEFAULT_SUB2API_URL: 'https://example.com/admin/accounts',
|
||||||
|
normalizeLocalCpaStep9Mode: value => value,
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.equal(navigationUtils.is163MailHost('mail.126.com'), true);
|
||||||
|
assert.equal(
|
||||||
|
navigationUtils.matchesSourceUrlFamily(
|
||||||
|
'mail-163',
|
||||||
|
'https://mail.126.com/js6/main.jsp',
|
||||||
|
'https://mail.163.com/js6/main.jsp'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ const helperBundle = [
|
|||||||
extractFunction(helperSource, 'parseUrlSafely'),
|
extractFunction(helperSource, 'parseUrlSafely'),
|
||||||
extractFunction(helperSource, 'isSignupPageHost'),
|
extractFunction(helperSource, 'isSignupPageHost'),
|
||||||
extractFunction(helperSource, 'isSignupEntryHost'),
|
extractFunction(helperSource, 'isSignupEntryHost'),
|
||||||
|
extractFunction(helperSource, 'is163MailHost'),
|
||||||
extractFunction(helperSource, 'matchesSourceUrlFamily'),
|
extractFunction(helperSource, 'matchesSourceUrlFamily'),
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
@@ -153,6 +154,11 @@ return {
|
|||||||
true,
|
true,
|
||||||
'signup-page family should include legacy chat.openai.com'
|
'signup-page family should include legacy chat.openai.com'
|
||||||
);
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
api.matchesSourceUrlFamily('mail-163', 'https://mail.126.com/js6/main.jsp', 'https://mail.163.com/js6/main.jsp'),
|
||||||
|
true,
|
||||||
|
'mail-163 family should include mail.126.com'
|
||||||
|
);
|
||||||
|
|
||||||
api.reset({
|
api.reset({
|
||||||
tabs: [
|
tabs: [
|
||||||
|
|||||||
Reference in New Issue
Block a user