From 594806072930fa88966e02640f81b775fe57e71d Mon Sep 17 00:00:00 2001 From: Andreas Kogler Date: Sun, 20 Aug 2023 09:25:56 +0200 Subject: [PATCH] Implement PlayStation app `WebMAF` detection (#649) * Add support for `WebMAF` detection on Playstation * Extend `WebMAF` support for PlayStation 5 * Update changelog --- changelog.md | 1 + src/main/ua-parser.js | 1 + test/specs/browser-all.json | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/changelog.md b/changelog.md index ac8e493..3baed6c 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ - What's breaking: - Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"` - OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"` + - Apps on PlayStation 4/5 now report `WebMAF` instead of `WebKit` for `browser.name` and the `WebMAF`-version in `browser.version` - What's new: - Add some new methods in result object: - Add support for client hints: `withClientHints()` diff --git a/src/main/ua-parser.js b/src/main/ua-parser.js index a8ed359..c2b736d 100755 --- a/src/main/ua-parser.js +++ b/src/main/ua-parser.js @@ -285,6 +285,7 @@ // Mixed /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer + /(webmaf)\/([a-z0-9\.-]+)/i, // Sony/Playstation WebMAF // Trident based /(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser /(ba?idubrowser)[\/ ]?([\w\.]+)/i, // Baidu Browser diff --git a/test/specs/browser-all.json b/test/specs/browser-all.json index 9ca190c..d876d55 100644 --- a/test/specs/browser-all.json +++ b/test/specs/browser-all.json @@ -1148,6 +1148,26 @@ "major" : "undefined" } }, + { + "desc" : "Sony WebMAF SDK (Playstation)", + "ua" : "Mozilla/5.0 (PlayStation 4 WebMAF) AppleWebKit/601.2 (KHTML, like Gecko) WebMAF/v3.1.0-0-ge5873ba4 SDK: (0x09508001u), Built: Nov 1 2022 14:36:14", + "expect" : + { + "name" : "WebMAF", + "version" : "v3.1.0-0-ge5873ba4", + "major" : "3" + } + }, + { + "desc" : "Sony WebMAF SDK (Playstation)", + "ua" : "Mozilla/5.0 (PlayStation 5; WebMAF/1.0.0) AppleWebKit/537.73 (KHTML, like Gecko)", + "expect" : + { + "name" : "WebMAF", + "version" : "1.0.0", + "major" : "1" + } + }, { "desc" : "Swiftfox", "ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0 (Swiftfox)",