diff --git a/.gitignore b/.gitignore index 1ca9571..1ae40a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ npm-debug.log +.idea diff --git a/src/ua-parser.js b/src/ua-parser.js index 6ae21aa..65061d5 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -202,6 +202,9 @@ browser : [[ + /APP-([\w\s-\d]+)\/((\d+)?[\w\.]+)/i // KTA App + ], [NAME, VERSION, MAJOR], [ + // Presto based /(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet @@ -385,6 +388,8 @@ ], engine : [[ + /APP-([\w\s-\d]+)\/((\d+)?[\w\.]+)/i // KTA App + ], [[NAME, 'Mobile-App'], VERSION], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m diff --git a/test/browser-test.json b/test/browser-test.json index 2e1e84b..adf520d 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -648,4 +648,15 @@ "version" : "1.0.1084.5402", "major" : "1" } - }] + }, + { + "desc" : "BE-Test", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "BE Test", + "version" : "1.0", + "major" : "1" + } + } +] diff --git a/test/cpu-test.json b/test/cpu-test.json index 3592c2f..da6fe6f 100644 --- a/test/cpu-test.json +++ b/test/cpu-test.json @@ -86,4 +86,22 @@ { "architecture" : "sparc" } -}] + }, + { + "desc" : "KTB iPad", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "architecture" : "undefined" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "architecture" : "undefined" + } + } + +] diff --git a/test/device-test.json b/test/device-test.json index 8b091d0..0390c66 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -58,5 +58,45 @@ "model" : "iPod touch", "type" : "mobile" } + }, + { + "desc" : "KTB-iPhone", + "ua" : "APP-BE/1.0 (iPhone; Apple; CPU iPhone OS 7_0 like Mac OS X)", + "expect" : + { + "vendor" : "Apple", + "model" : "iPhone", + "type" : "mobile" + } + }, + { + "desc" : "KTB-iPod Touch", + "ua" : "APP-BE/1.0 (iPod touch; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "vendor" : "Apple", + "model" : "iPod touch", + "type" : "mobile" + } + }, + { + "desc" : "KTB-iPad", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "vendor" : "Apple", + "model" : "iPad", + "type" : "tablet" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "vendor" : "LG", + "model" : "Nexus 5", + "type" : "mobile" + } } ] diff --git a/test/engine-test.json b/test/engine-test.json index 9f6944c..23987eb 100644 --- a/test/engine-test.json +++ b/test/engine-test.json @@ -61,4 +61,24 @@ "name" : "WebKit", "version" : "533.19.4" } -}] + }, + { + "desc" : "KTA Mobile App", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "Mobile-App", + "version" : "1.0" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "name" : "Mobile-App", + "version" : "1.0" + } + } + +] diff --git a/test/os-test.json b/test/os-test.json index bd9769d..8ded685 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -565,4 +565,24 @@ "name" : "", "version" : "" } -}] + }, + { + "desc" : "iOS BE App", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "iOS", + "version" : "7.0.2" + } + } + , + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "name" : "Android", + "version" : "4.2.1" + } + } +]