Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Playstation 5 Support for OS and Device #430

Closed
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
<!doctype html>
<html>
<head>
<script type="text/javascript" src="ua-parser.min.js"></script>
<script type="text/javascript">
<script src="ua-parser.min.js"></script>
<script>

var parser = new UAParser();
var parser = new UAParser();

// by default it takes ua string from current browser's window.navigator.userAgent
console.log(parser.getResult());
Expand Down
4 changes: 2 additions & 2 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
/android.+;\s(shield)\sbuild/i // Nvidia
], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [

/(playstation\s[34portablevi]+)/i // Playstation
/(playstation\s[345portablevi]+)/i // Playstation
], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [

/(sprint\s(\w+))/i // Sprint Phones
Expand Down Expand Up @@ -732,7 +732,7 @@
], [[NAME, 'Firefox OS'], VERSION], [

// Console
/(nintendo|playstation)\s([wids34portablevu]+)/i, // Nintendo/Playstation
/(nintendo|playstation)\s([wids345portablevu]+)/i, // Nintendo/Playstation

// GNU/Linux based
/(mint)[\/\s\(]?(\w*)/i, // Mint
Expand Down
9 changes: 9 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,15 @@
"type": "console"
}
},
{
"desc": "PlayStation 5",
"ua": "Mozilla/5.0 (Playstation; Playstation 5/1.05) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15",
"expect": {
"vendor": "Sony",
"model": "Playstation 5",
"type": "console"
}
},
{
"desc": "Galaxy Nexus",
"ua": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
Expand Down
9 changes: 9 additions & 0 deletions test/os-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@
"version" : "4"
}
},
{
"desc" : "PlayStation 5",
"ua" : "Mozilla/5.0 (Playstation; Playstation 5/1.05) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15",
"expect" :
{
"name" : "Playstation",
"version" : "5"
}
},
{
"desc" : "Mint",
"ua" : "",
Expand Down