diff --git a/.gitignore b/.gitignore index b0beb32..d95be18 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ npm-debug.log .idea es yarn-error.log +package-lock.json diff --git a/src/index.ts b/src/index.ts index 09ef47e..81f3080 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,6 +83,8 @@ export type Browser = | 'fxios' | 'opera-mini' | 'opera' + | 'pie' + | 'netfront' | 'ie' | 'bb10' | 'android' @@ -111,6 +113,7 @@ export type OperatingSystem = | 'Windows 8.1' | 'Windows 10' | 'Windows ME' + | 'Windows CE' | 'Open BSD' | 'Sun OS' | 'Linux' @@ -151,6 +154,9 @@ const userAgentRules: UserAgentRule[] = [ ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/], ['opera', /Opera\/([0-9\.]+)(?:\s|$)/], ['opera', /OPR\/([0-9\.]+)(:?\s|$)/], + ['pie',/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/], + ['pie',/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/], + ['netfront',/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/], ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], ['ie', /MSIE\s(7\.0)/], @@ -183,6 +189,7 @@ const operatingSystemRules: OperatingSystemRule[] = [ ['Windows 8.1', /(Windows NT 6.3)/], ['Windows 10', /(Windows NT 10.0)/], ['Windows ME', /Windows ME/], + ['Windows CE', /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], ['Open BSD', /OpenBSD/], ['Sun OS', /SunOS/], ['Chrome OS', /CrOS/], diff --git a/test/logic.js b/test/logic.js index 8a0ac32..ebd944a 100644 --- a/test/logic.js +++ b/test/logic.js @@ -486,6 +486,54 @@ test('detects extended bot info', function(t) { t.end(); }); +/** Windows CE Ozone (CE 4.2 P/PC 2003) */ +test('detects PocketPC2003', function(t) { + assertAgentString( + t, + 'Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)', + { + type: 'browser', + name: 'pie', + version: '4.01.0', + os: 'Windows CE', + }, + ); + + t.end(); +}); + +/** Windows CE Pegasus (CE 1.0x) PIE 1.1 */ +test('detects PIE 1.1', function(t) { + assertAgentString( + t, + 'Mozilla/1.1 (compatible; MSPIE 1.1; Windows CE)', + { + type: 'browser', + name: 'pie', + version: '1.1.0', + os: 'Windows CE', + }, + ); + + t.end(); +}); + + +/** Windows CE Stinger SmartPhone 2003 */ +test('detects NetFront', function(t) { + assertAgentString( + t, + 'Mozilla/4.0 (PDA; Windows CE;1.0.0) NetFront/3.0', + { + type: 'browser', + name: 'netfront', + version: '3.0.0', + os: 'Windows CE', + }, + ); + + t.end(); +}); test('detects extended bot info', function(t) { assertAgentString(