From b89d5389eef3429bd5c2113724d1fe355084752a Mon Sep 17 00:00:00 2001 From: Ryan Liu Date: Thu, 23 Apr 2026 09:57:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E9=BD=90=20126=20=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=20host=20=E5=AE=B6=E6=97=8F=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- background.js | 2 ++ background/navigation-utils.js | 2 ++ ...background-navigation-utils-module.test.js | 20 +++++++++++++++++++ tests/signup-page-tab-cleanup.test.js | 6 ++++++ 4 files changed, 30 insertions(+) diff --git a/background.js b/background.js index fb7d1cb..1e94b12 100644 --- a/background.js +++ b/background.js @@ -3542,6 +3542,8 @@ function is163MailHost(hostname = '') { } return hostname === 'mail.163.com' || hostname.endsWith('.mail.163.com') + || hostname === 'mail.126.com' + || hostname.endsWith('.mail.126.com') || hostname === 'webmail.vip.163.com'; } diff --git a/background/navigation-utils.js b/background/navigation-utils.js index 2c7b793..7773db1 100644 --- a/background/navigation-utils.js +++ b/background/navigation-utils.js @@ -61,6 +61,8 @@ function is163MailHost(hostname = '') { return hostname === 'mail.163.com' || hostname.endsWith('.mail.163.com') + || hostname === 'mail.126.com' + || hostname.endsWith('.mail.126.com') || hostname === 'webmail.vip.163.com'; } diff --git a/tests/background-navigation-utils-module.test.js b/tests/background-navigation-utils-module.test.js index cf03bf0..e8afd71 100644 --- a/tests/background-navigation-utils-module.test.js +++ b/tests/background-navigation-utils-module.test.js @@ -15,3 +15,23 @@ test('navigation utils module exposes a factory', () => { 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 + ); +}); diff --git a/tests/signup-page-tab-cleanup.test.js b/tests/signup-page-tab-cleanup.test.js index a00ce11..c6e76bc 100644 --- a/tests/signup-page-tab-cleanup.test.js +++ b/tests/signup-page-tab-cleanup.test.js @@ -48,6 +48,7 @@ const helperBundle = [ extractFunction(helperSource, 'parseUrlSafely'), extractFunction(helperSource, 'isSignupPageHost'), extractFunction(helperSource, 'isSignupEntryHost'), + extractFunction(helperSource, 'is163MailHost'), extractFunction(helperSource, 'matchesSourceUrlFamily'), ].join('\n'); @@ -153,6 +154,11 @@ return { true, '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({ tabs: [