From 2181559b01617cbca67f991f8bfb6b983415da4f Mon Sep 17 00:00:00 2001
From: Faisal Salman <f@faisalman.com>
Date: Sat, 16 Nov 2024 15:28:35 +0700
Subject: [PATCH] [submodule:extensions] Add new email: Airmail, BlueMail,
 eMClient, NaverMailApp, Sparrow, Yahoo

---
 src/extensions/ua-parser-extensions.js | 10 ++-
 test/specs/browser-emails.json         | 90 ++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 3 deletions(-)

diff --git a/src/extensions/ua-parser-extensions.js b/src/extensions/ua-parser-extensions.js
index 628313cae..5e836bbfa 100644
--- a/src/extensions/ua-parser-extensions.js
+++ b/src/extensions/ua-parser-extensions.js
@@ -42,7 +42,6 @@ const Crawlers = Object.freeze({
         [
             // AhrefsBot - https://ahrefs.com/robot
             // Amazonbot - https://developer.amazon.com/amazonbot
-            // Applebot - http://apple.com/go/applebot
             // Bingbot - http://www.bing.com/bingbot.htm
             // CCBot - https://commoncrawl.org/faq
             // Dotbot - https://moz.com/help/moz-procedures/crawlers/dotbot
@@ -54,7 +53,10 @@ const Crawlers = Object.freeze({
             // OpenAI's SearchGPT - https://platform.openai.com/docs/bots
             // PerplexityBot - https://perplexity.ai/perplexitybot
             // SemrushBot - http://www.semrush.com/bot.html
-            /((?:ahrefs|amazon|apple|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush)bot)\/([\w\.]+)/i,
+            /((?:ahrefs|amazon|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush)bot)\/([\w\.]+)/i,
+
+            // Applebot - http://apple.com/go/applebot
+            /(applebot(?:-extended)?)\/([\w\.]+)/i,
 
             // Baiduspider https://help.baidu.com/question?prod_id=99&class=0&id=3001
             /(baiduspider)[-imagevdonsfcpr]{0,6}\/([\w\.]+)/i,
@@ -195,8 +197,10 @@ const ExtraDevices = Object.freeze({
 
 const Emails = Object.freeze({
     browser : [
+        [
         // Evolution / Kontact/KMail / [Microsoft/Mac] Outlook / Thunderbird
-        [/(evolution|kmail2?|kontact|(?:microsoft |mac)outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, EMAIL]]
+        /(airmail|bluemail|emclient|evolution|foxmail|kmail2?|kontact|(?:microsoft |mac)?outlook(?:-express)?|navermailapp|(?!chrom.+)sparrow|thunderbird|yahoo)(?:m.+ail; |[\/ ])([\w\.]+)/i
+        ], [NAME, VERSION, [TYPE, EMAIL]]
     ]
 });
 
diff --git a/test/specs/browser-emails.json b/test/specs/browser-emails.json
index 883f32be6..27fbce58f 100644
--- a/test/specs/browser-emails.json
+++ b/test/specs/browser-emails.json
@@ -1,4 +1,34 @@
 [
+    {
+        "desc"    : "Airmail",
+        "ua"      : "Airmail 1.0 rv:148 (Macintosh; Mac OS X 10.8.3; en_BE)",
+        "expect"  :
+        {
+            "name"    : "Airmail",
+            "version" : "1.0",
+            "type"    : "email"
+        }
+    },
+    {
+        "desc"    : "BlueMail",
+        "ua"      : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) BlueMail/0.10.31 Chrome/61.0.3163.100 Electron/2.0.18 Safari/537.36",
+        "expect"  :
+        {
+            "name"    : "BlueMail",
+            "version" : "0.10.31",
+            "type"    : "email"
+        }
+    },
+    {
+        "desc"    : "BlueMail",
+        "ua"      : "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16A405 BlueMail iOS",
+        "expect"  :
+        {
+            "name"    : "BlueMail",
+            "version" : "iOS",
+            "type"    : "email"
+        }
+    },
     {
         "desc"    : "Evolution",
         "ua"      : "Evolution/3.52.3",
@@ -9,6 +39,26 @@
             "type"    : "email"
         }
     },
+    {
+        "desc"    : "eM Client",
+        "ua"      : "eMClient/9.2.2157.0",
+        "expect"  :
+        {
+            "name"    : "eMClient",
+            "version" : "9.2.2157.0",
+            "type"    : "email"
+        }
+    },
+    {
+        "desc"    : "Foxmail",
+        "ua"      : "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 foxmail/7.2.15.80",
+        "expect"  :
+        {
+            "name"    : "foxmail",
+            "version" : "7.2.15.80",
+            "type"    : "email"
+        }
+    },
     {
         "desc"    : "KMail",
         "ua"      : "KMail/4.14.10 (FreeBSD/12.0-CURRENT; KDE/4.14.10; amd64; ; )",
@@ -59,6 +109,26 @@
             "type"    : "email"
         }
     },
+    {
+        "desc"    : "NaverMailApp",
+        "ua"      : "NaverMailApp/2.1.23 (Android 10; SM-N960N)",
+        "expect"  :
+        {
+            "name"    : "NaverMailApp",
+            "version" : "2.1.23",
+            "type"    : "email"
+        }
+    },
+    {
+        "desc"    : "Sparrow",
+        "ua"      : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Sparrow/1043.1",
+        "expect"  :
+        {
+            "name"    : "Sparrow",
+            "version" : "1043.1",
+            "type"    : "email"
+        }
+    },
     {
         "desc"    : "Thunderbird",
         "ua"      : "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0",
@@ -68,5 +138,25 @@
             "version" : "78.13.0",
             "type"    : "email"
         }
+    },
+    {
+        "desc"    : "Yahoo! Mail",
+        "ua"      : "YahooMobile/1.0 (mail; 3.0.5.1311380); (Linux; U; Android 4.0.3; htc_runnymede Build/ICE_CREAM_SANDWICH_MR1);",
+        "expect"  :
+        {
+            "name"    : "Yahoo",
+            "version" : "3.0.5.1311380",
+            "type"    : "email"
+        }
+    },
+    {
+        "desc"    : "Yahoo! Mail",
+        "ua"      : "YahooMobileMail/1.0 (Android Mail; 1.3.10) (supersonic;HTC;PC36100;2.3.5/GRJ90) ",
+        "expect"  :
+        {
+            "name"    : "Yahoo",
+            "version" : "1.3.10",
+            "type"    : "email"
+        }
     }
 ]