From 9c3de546c030ac2d7d31aa9aa0997001e7493ca8 Mon Sep 17 00:00:00 2001 From: Ryan Liu Date: Sat, 25 Apr 2026 11:30:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E9=BD=90126=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E5=AD=90=E5=9F=9F=E5=90=8D=E6=9D=A5=E6=BA=90=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/utils.js | 1 + tests/content-utils.test.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/content/utils.js b/content/utils.js index 3b8f0f5..7eab2e4 100644 --- a/content/utils.js +++ b/content/utils.js @@ -15,6 +15,7 @@ function detectScriptSource({ || hostname.endsWith('.mail.163.com') || hostname === 'webmail.vip.163.com' || hostname === 'mail.126.com' + || hostname.endsWith('.mail.126.com') ) return 'mail-163'; if (hostname === 'mail.google.com') return 'gmail-mail'; if (hostname === 'www.icloud.com' || hostname === 'www.icloud.com.cn') return 'icloud-mail'; diff --git a/tests/content-utils.test.js b/tests/content-utils.test.js index 0ea69ca..e3a11d0 100644 --- a/tests/content-utils.test.js +++ b/tests/content-utils.test.js @@ -64,3 +64,19 @@ return { detectScriptSource }; 'mail-163' ); }); + +test('detectScriptSource maps 126 mail subdomains to the shared 163 mail source', () => { + const bundle = [extractFunction('detectScriptSource')].join('\n'); + const api = new Function(` +${bundle} +return { detectScriptSource }; +`)(); + + assert.equal( + api.detectScriptSource({ + url: 'https://app.mail.126.com/js6/main.jsp', + hostname: 'app.mail.126.com', + }), + 'mail-163' + ); +});