From a88660493568d6144a551424a8139d6c876635f6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Tue, 6 Dec 2022 09:53:54 +0700 Subject: [PATCH] Fix #605 - Identify Macintosh as Apple device --- src/ua-parser.js | 2 ++ test/device-test.json | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/ua-parser.js b/src/ua-parser.js index e2c326364..b050833e7 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -390,6 +390,8 @@ /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [ + /(macintosh);/i + ], [MODEL, [VENDOR, APPLE]], [ // Huawei /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i diff --git a/test/device-test.json b/test/device-test.json index bad1e50af..33bfd1717 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -754,6 +754,15 @@ "type": "mobile" } }, + { + "desc": "Apple Desktop", + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15", + "expect": { + "vendor": "Apple", + "model": "Macintosh", + "type": "undefined" + } + }, { "desc": "iPad using UCBrowser", "ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3",