express-useragent
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "express-useragent", | ||
"description": "Fast User-Agent exposing", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/biggora/express-useragent/", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -31,3 +31,3 @@ /*! | ||
var UserAgent = function () { | ||
this.version = '0.2.4'; | ||
this.version = '1.0.2'; | ||
this._Versions = { | ||
@@ -49,2 +49,3 @@ Edge: /Edge\/([\d\w\.\-]+)/i, | ||
WinJs: /msapphost\/([\d\w\.\-]+)/i, | ||
PhantomJS: /phantomjs\/([\d\w\.\-]+)/i, | ||
UC: /UCBrowser\/([\d\w\.]+)/i | ||
@@ -69,2 +70,3 @@ }; | ||
WinJs: /msapphost/i, | ||
PhantomJS: /phantomjs/i, | ||
UC: /UCBrowser/i | ||
@@ -146,2 +148,3 @@ }; | ||
isAmaya: false, | ||
isPhantomJS: false, | ||
isEpiphany: false, | ||
@@ -182,2 +185,5 @@ isDesktop: false, | ||
return 'Edge'; | ||
case this._Browsers.PhantomJS.test(string): | ||
this.Agent.isPhantomJS = true; | ||
return 'PhantomJS'; | ||
case this._Browsers.Konqueror.test(string): | ||
@@ -247,2 +253,7 @@ this.Agent.isKonqueror = true; | ||
break; | ||
case 'PhantomJS': | ||
if (this._Versions.PhantomJS.test(string)) { | ||
return RegExp.$1; | ||
} | ||
break; | ||
case 'Chrome': | ||
@@ -249,0 +260,0 @@ if (this._Versions.Chrome.test(string)) { |
/*! | ||
* express-useragent.js v1.0.0 (https://github.com/biggora/express-useragent/) | ||
* express-useragent.js v1.0.2 (https://github.com/biggora/express-useragent/) | ||
* Copyright 2011-2016 Alexey Gordeyev | ||
* Licensed under MIT (https://github.com/biggora/express-useragent/blob/master/LICENSE) | ||
*/ | ||
!function(a){"use strict";var b=["\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/","googlebot","baiduspider","gurujibot","yandexbot","slurp","msnbot","bingbot","facebookexternalhit","linkedinbot","twitterbot","slackbot","telegrambot","applebot","pingdom","tumblr ","Embedly"],c=new RegExp("^.*("+b.join("|")+").*$"),d=function(){return this.version="0.2.4",this._Versions={Edge:/Edge\/([\d\w\.\-]+)/i,Firefox:/firefox\/([\d\w\.\-]+)/i,IE:/msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i,Chrome:/chrome\/([\d\w\.\-]+)/i,Chromium:/(?:chromium|crios)\/([\d\w\.\-]+)/i,Safari:/version\/([\d\w\.\-]+)/i,Opera:/version\/([\d\w\.\-]+)|OPR\/([\d\w\.\-]+)/i,Ps3:/([\d\w\.\-]+)\)\s*$/i,Psp:/([\d\w\.\-]+)\)?\s*$/i,Amaya:/amaya\/([\d\w\.\-]+)/i,SeaMonkey:/seamonkey\/([\d\w\.\-]+)/i,OmniWeb:/omniweb\/v([\d\w\.\-]+)/i,Flock:/flock\/([\d\w\.\-]+)/i,Epiphany:/epiphany\/([\d\w\.\-]+)/i,WinJs:/msapphost\/([\d\w\.\-]+)/i,UC:/UCBrowser\/([\d\w\.]+)/i},this._Browsers={Edge:/edge/i,Amaya:/amaya/i,Konqueror:/konqueror/i,Epiphany:/epiphany/i,SeaMonkey:/seamonkey/i,Flock:/flock/i,OmniWeb:/omniweb/i,Chromium:/chromium|crios/i,Chrome:/chrome/i,Safari:/safari/i,IE:/msie|trident/i,Opera:/opera|OPR/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Firefox:/firefox/i,WinJs:/msapphost/i,UC:/UCBrowser/i},this._OS={Windows10:/windows nt 10\.0/i,Windows81:/windows nt 6\.3/i,Windows8:/windows nt 6\.2/i,Windows7:/windows nt 6\.1/i,UnknownWindows:/windows nt 6\.\d+/i,WindowsVista:/windows nt 6\.0/i,Windows2003:/windows nt 5\.2/i,WindowsXP:/windows nt 5\.1/i,Windows2000:/windows nt 5\.0/i,WindowsPhone8:/windows phone 8\./,OSXCheetah:/os x 10[._]0/i,OSXPuma:/os x 10[._]1(\D|$)/i,OSXJaguar:/os x 10[._]2/i,OSXPanther:/os x 10[._]3/i,OSXTiger:/os x 10[._]4/i,OSXLeopard:/os x 10[._]5/i,OSXSnowLeopard:/os x 10[._]6/i,OSXLion:/os x 10[._]7/i,OSXMountainLion:/os x 10[._]8/i,OSXMavericks:/os x 10[._]9/i,OSXYosemite:/os x 10[._]10/i,OSXElCapitan:/os x 10[._]11/i,OSXSierra:/os x 10[._]12/i,Mac:/os x/i,Linux:/linux/i,Linux64:/linux x86\_64/i,ChromeOS:/cros/i,Wii:/wii/i,PS3:/playstation 3/i,PSP:/playstation portable/i,iPad:/\(iPad.*os (\d+)[._](\d+)/i,iPhone:/\(iPhone.*os (\d+)[._](\d+)/i,Bada:/Bada\/(\d+)\.(\d+)/i,Curl:/curl\/(\d+)\.(\d+)\.(\d+)/i},this._Platform={Windows:/windows nt/i,WindowsPhone:/windows phone/i,Mac:/macintosh/i,Linux:/linux/i,Wii:/wii/i,Playstation:/playstation/i,iPad:/ipad/i,iPod:/ipod/i,iPhone:/iphone/i,Android:/android/i,Blackberry:/blackberry/i,Samsung:/samsung/i,Curl:/curl/i},this.DefaultAgent={isAuthoritative:!0,isMobile:!1,isTablet:!1,isiPad:!1,isiPod:!1,isiPhone:!1,isAndroid:!1,isBlackberry:!1,isOpera:!1,isIE:!1,isEdge:!1,isIECompatibilityMode:!1,isSafari:!1,isFirefox:!1,isWebkit:!1,isChrome:!1,isKonqueror:!1,isOmniWeb:!1,isSeaMonkey:!1,isFlock:!1,isAmaya:!1,isEpiphany:!1,isDesktop:!1,isWindows:!1,isLinux:!1,isLinux64:!1,isMac:!1,isChromeOS:!1,isBada:!1,isSamsung:!1,isRaspberry:!1,isBot:!1,isCurl:!1,isAndroidTablet:!1,isWinJs:!1,isKindleFire:!1,isSilk:!1,isCaptive:!1,isSmartTV:!1,isUC:!1,silkAccelerated:!1,browser:"unknown",version:"unknown",os:"unknown",platform:"unknown",geoIp:{},source:""},this.Agent={},this.getBrowser=function(a){switch(!0){case this._Browsers.Edge.test(a):return this.Agent.isEdge=!0,"Edge";case this._Browsers.Konqueror.test(a):return this.Agent.isKonqueror=!0,"Konqueror";case this._Browsers.Amaya.test(a):return this.Agent.isAmaya=!0,"Amaya";case this._Browsers.Epiphany.test(a):return this.Agent.isEpiphany=!0,"Epiphany";case this._Browsers.SeaMonkey.test(a):return this.Agent.isSeaMonkey=!0,"SeaMonkey";case this._Browsers.Flock.test(a):return this.Agent.isFlock=!0,"Flock";case this._Browsers.OmniWeb.test(a):return this.Agent.isOmniWeb=!0,"OmniWeb";case this._Browsers.Opera.test(a):return this.Agent.isOpera=!0,"Opera";case this._Browsers.Chromium.test(a):return this.Agent.isChrome=!0,"Chromium";case this._Browsers.Chrome.test(a):return this.Agent.isChrome=!0,"Chrome";case this._Browsers.Safari.test(a):return this.Agent.isSafari=!0,"Safari";case this._Browsers.WinJs.test(a):return this.Agent.isWinJs=!0,"WinJs";case this._Browsers.IE.test(a):return this.Agent.isIE=!0,"IE";case this._Browsers.PS3.test(a):return"ps3";case this._Browsers.PSP.test(a):return"psp";case this._Browsers.Firefox.test(a):return this.Agent.isFirefox=!0,"Firefox";case this._Browsers.UC.test(a):return this.Agent.isUC=!0,"UCBrowser";default:return 0!==a.indexOf("Mozilla")&&/^([\d\w\-\.]+)\/[\d\w\.\-]+/i.test(a)?(this.Agent.isAuthoritative=!1,RegExp.$1):"unknown"}},this.getBrowserVersion=function(a){var b;switch(this.Agent.browser){case"Edge":if(this._Versions.Edge.test(a))return RegExp.$1;break;case"Chrome":if(this._Versions.Chrome.test(a))return RegExp.$1;break;case"Chromium":if(this._Versions.Chromium.test(a))return RegExp.$1;break;case"Safari":if(this._Versions.Safari.test(a))return RegExp.$1;break;case"Opera":if(this._Versions.Opera.test(a))return RegExp.$1?RegExp.$1:RegExp.$2;break;case"Firefox":if(this._Versions.Firefox.test(a))return RegExp.$1;break;case"WinJs":if(this._Versions.WinJs.test(a))return RegExp.$1;break;case"IE":if(this._Versions.IE.test(a))return RegExp.$2?RegExp.$2:RegExp.$1;break;case"ps3":if(this._Versions.Ps3.test(a))return RegExp.$1;break;case"psp":if(this._Versions.Psp.test(a))return RegExp.$1;break;case"Amaya":if(this._Versions.Amaya.test(a))return RegExp.$1;break;case"Epiphany":if(this._Versions.Epiphany.test(a))return RegExp.$1;break;case"SeaMonkey":if(this._Versions.SeaMonkey.test(a))return RegExp.$1;break;case"Flock":if(this._Versions.Flock.test(a))return RegExp.$1;break;case"OmniWeb":if(this._Versions.OmniWeb.test(a))return RegExp.$1;break;case"UCBrowser":if(this._Versions.UC.test(a))return RegExp.$1;break;default:if("unknown"!==this.Agent.browser&&(b=new RegExp(this.Agent.browser+"[\\/ ]([\\d\\w\\.\\-]+)","i"),b.test(a)))return RegExp.$1}},this.getOS=function(a){switch(!0){case this._OS.WindowsVista.test(a):return this.Agent.isWindows=!0,"Windows Vista";case this._OS.Windows7.test(a):return this.Agent.isWindows=!0,"Windows 7";case this._OS.Windows8.test(a):return this.Agent.isWindows=!0,"Windows 8";case this._OS.Windows81.test(a):return this.Agent.isWindows=!0,"Windows 8.1";case this._OS.Windows10.test(a):return this.Agent.isWindows=!0,"Windows 10.0";case this._OS.Windows2003.test(a):return this.Agent.isWindows=!0,"Windows 2003";case this._OS.WindowsXP.test(a):return this.Agent.isWindows=!0,"Windows XP";case this._OS.Windows2000.test(a):return this.Agent.isWindows=!0,"Windows 2000";case this._OS.WindowsPhone8.test(a):return"Windows Phone 8";case this._OS.Linux64.test(a):return this.Agent.isLinux=!0,this.Agent.isLinux64=!0,"Linux 64";case this._OS.Linux.test(a):return this.Agent.isLinux=!0,"Linux";case this._OS.ChromeOS.test(a):return this.Agent.isChromeOS=!0,"Chrome OS";case this._OS.Wii.test(a):return"Wii";case this._OS.PS3.test(a):return"Playstation";case this._OS.PSP.test(a):return"Playstation";case this._OS.OSXCheetah.test(a):return this.Agent.isMac=!0,"OS X Cheetah";case this._OS.OSXPuma.test(a):return this.Agent.isMac=!0,"OS X Puma";case this._OS.OSXJaguar.test(a):return this.Agent.isMac=!0,"OS X Jaguar";case this._OS.OSXPanther.test(a):return this.Agent.isMac=!0,"OS X Panther";case this._OS.OSXTiger.test(a):return this.Agent.isMac=!0,"OS X Tiger";case this._OS.OSXLeopard.test(a):return this.Agent.isMac=!0,"OS X Leopard";case this._OS.OSXSnowLeopard.test(a):return this.Agent.isMac=!0,"OS X Snow Leopard";case this._OS.OSXLion.test(a):return this.Agent.isMac=!0,"OS X Lion";case this._OS.OSXMountainLion.test(a):return this.Agent.isMac=!0,"OS X Mountain Lion";case this._OS.OSXMavericks.test(a):return this.Agent.isMac=!0,"OS X Mavericks";case this._OS.OSXYosemite.test(a):return this.Agent.isMac=!0,"OS X Yosemite";case this._OS.OSXElCapitan.test(a):return this.Agent.isMac=!0,"OS X El Capitan";case this._OS.OSXSierra.test(a):return this.Agent.isMac=!0,"macOS Sierra";case this._OS.Mac.test(a):return this.Agent.isMac=!0,"OS X";case this._OS.iPad.test(a):return this.Agent.isiPad=!0,a.match(this._OS.iPad)[0].replace("_",".");case this._OS.iPhone.test(a):return this.Agent.isiPhone=!0,a.match(this._OS.iPhone)[0].replace("_",".");case this._OS.Bada.test(a):return this.Agent.isBada=!0,"Bada";case this._OS.Curl.test(a):return this.Agent.isCurl=!0,"Curl";default:return"unknown"}},this.getPlatform=function(a){switch(!0){case this._Platform.Windows.test(a):return"Microsoft Windows";case this._Platform.WindowsPhone.test(a):return this.Agent.isWindowsPhone=!0,"Microsoft Windows Phone";case this._Platform.Mac.test(a):return"Apple Mac";case this._Platform.Curl.test(a):return"Curl";case this._Platform.Android.test(a):return this.Agent.isAndroid=!0,"Android";case this._Platform.Blackberry.test(a):return this.Agent.isBlackberry=!0,"Blackberry";case this._Platform.Linux.test(a):return"Linux";case this._Platform.Wii.test(a):return"Wii";case this._Platform.Playstation.test(a):return"Playstation";case this._Platform.iPad.test(a):return this.Agent.isiPad=!0,"iPad";case this._Platform.iPod.test(a):return this.Agent.isiPod=!0,"iPod";case this._Platform.iPhone.test(a):return this.Agent.isiPhone=!0,"iPhone";case this._Platform.Samsung.test(a):return this.Agent.isiSamsung=!0,"Samsung";default:return"unknown"}},this.testCompatibilityMode=function(){var a=this;if(this.Agent.isIE&&/Trident\/(\d)\.0/i.test(a.Agent.source)){var b=parseInt(RegExp.$1,10),c=parseInt(a.Agent.version,10);7===c&&6===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=10),7===c&&5===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=9),7===c&&4===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=8)}},this.testSilk=function(){var a=this;switch(!0){case new RegExp("silk","gi").test(a.Agent.source):this.Agent.isSilk=!0}return/Silk-Accelerated=true/gi.test(a.Agent.source)&&(this.Agent.SilkAccelerated=!0),this.Agent.isSilk?"Silk":!1},this.testKindleFire=function(){var a=this;switch(!0){case/KFOT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire";case/KFTT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD";case/KFJWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9";case/KFJWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9 4G";case/KFSOWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 7";case/KFTHWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7";case/KFTHWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7 4G";case/KFAPWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9";case/KFAPWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9 4G";default:return!1}},this.testCaptiveNetwork=function(){var a=this;switch(!0){case/CaptiveNetwork/gi.test(a.Agent.source):return a.Agent.isCaptive=!0,a.Agent.isMac=!0,a.Agent.platform="Apple Mac","CaptiveNetwork";default:return!1}},this.reset=function(){var a=this;for(var b in a.DefaultAgent)a.Agent[b]=a.DefaultAgent[b];return a},this.testMobile=function(){var a=this;switch(!0){case a.Agent.isWindows:case a.Agent.isLinux:case a.Agent.isMac:case a.Agent.isChromeOS:a.Agent.isDesktop=!0;break;case a.Agent.isAndroid:case a.Agent.isSamsung:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}switch(!0){case a.Agent.isiPad:case a.Agent.isiPod:case a.Agent.isiPhone:case a.Agent.isBada:case a.Agent.isBlackberry:case a.Agent.isAndroid:case a.Agent.isWindowsPhone:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}/mobile/i.test(a.Agent.source)&&(a.Agent.isMobile=!0,a.Agent.isDesktop=!1)},this.testTablet=function(){var a=this;switch(!0){case a.Agent.isiPad:case a.Agent.isAndroidTablet:case a.Agent.isKindleFire:a.Agent.isTablet=!0}/tablet/i.test(a.Agent.source)&&(a.Agent.isTablet=!0)},this.testNginxGeoIP=function(a){var b=this;Object.keys(a).forEach(function(c){/^GEOIP/i.test(c)&&(b.Agent.geoIp[c]=a[c])})},this.testBot=function(){var a=this,b=c.exec(a.Agent.source.toLowerCase());b?a.Agent.isBot=b[1]:a.Agent.isAuthoritative||(a.Agent.isBot=/bot/i.test(a.Agent.source))},this.testSmartTV=function(){var a=this,b=new RegExp("smart-tv|smarttv|googletv|appletv|hbbtv|pov_tv|netcast.tv","gi").exec(a.Agent.source.toLowerCase());b&&(a.Agent.isSmartTV=b[1])},this.testAndroidTablet=function(){var a=this;a.Agent.isAndroid&&!/mobile/i.test(a.Agent.source)&&(a.Agent.isAndroidTablet=!0)},this.parse=function(a){var b=new d;return b.Agent.source=a.replace(/^\s*/,"").replace(/\s*$/,""),b.Agent.os=b.getOS(b.Agent.source),b.Agent.platform=b.getPlatform(b.Agent.source),b.Agent.browser=b.getBrowser(b.Agent.source),b.Agent.version=b.getBrowserVersion(b.Agent.source),b.testBot(),b.testSmartTV(),b.testMobile(),b.testAndroidTablet(),b.testTablet(),b.testCompatibilityMode(),b.testSilk(),b.testKindleFire(),b.testCaptiveNetwork(),b.Agent},this.Agent=this.DefaultAgent,this};return a.UserAgent=d,new d}(this); | ||
!function(a){"use strict";var b=["\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/","googlebot","baiduspider","gurujibot","yandexbot","slurp","msnbot","bingbot","facebookexternalhit","linkedinbot","twitterbot","slackbot","telegrambot","applebot","pingdom","tumblr ","Embedly"],c=new RegExp("^.*("+b.join("|")+").*$"),d=function(){return this.version="1.0.2",this._Versions={Edge:/Edge\/([\d\w\.\-]+)/i,Firefox:/firefox\/([\d\w\.\-]+)/i,IE:/msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i,Chrome:/chrome\/([\d\w\.\-]+)/i,Chromium:/(?:chromium|crios)\/([\d\w\.\-]+)/i,Safari:/version\/([\d\w\.\-]+)/i,Opera:/version\/([\d\w\.\-]+)|OPR\/([\d\w\.\-]+)/i,Ps3:/([\d\w\.\-]+)\)\s*$/i,Psp:/([\d\w\.\-]+)\)?\s*$/i,Amaya:/amaya\/([\d\w\.\-]+)/i,SeaMonkey:/seamonkey\/([\d\w\.\-]+)/i,OmniWeb:/omniweb\/v([\d\w\.\-]+)/i,Flock:/flock\/([\d\w\.\-]+)/i,Epiphany:/epiphany\/([\d\w\.\-]+)/i,WinJs:/msapphost\/([\d\w\.\-]+)/i,PhantomJS:/phantomjs\/([\d\w\.\-]+)/i,UC:/UCBrowser\/([\d\w\.]+)/i},this._Browsers={Edge:/edge/i,Amaya:/amaya/i,Konqueror:/konqueror/i,Epiphany:/epiphany/i,SeaMonkey:/seamonkey/i,Flock:/flock/i,OmniWeb:/omniweb/i,Chromium:/chromium|crios/i,Chrome:/chrome/i,Safari:/safari/i,IE:/msie|trident/i,Opera:/opera|OPR/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Firefox:/firefox/i,WinJs:/msapphost/i,PhantomJS:/phantomjs/i,UC:/UCBrowser/i},this._OS={Windows10:/windows nt 10\.0/i,Windows81:/windows nt 6\.3/i,Windows8:/windows nt 6\.2/i,Windows7:/windows nt 6\.1/i,UnknownWindows:/windows nt 6\.\d+/i,WindowsVista:/windows nt 6\.0/i,Windows2003:/windows nt 5\.2/i,WindowsXP:/windows nt 5\.1/i,Windows2000:/windows nt 5\.0/i,WindowsPhone8:/windows phone 8\./,OSXCheetah:/os x 10[._]0/i,OSXPuma:/os x 10[._]1(\D|$)/i,OSXJaguar:/os x 10[._]2/i,OSXPanther:/os x 10[._]3/i,OSXTiger:/os x 10[._]4/i,OSXLeopard:/os x 10[._]5/i,OSXSnowLeopard:/os x 10[._]6/i,OSXLion:/os x 10[._]7/i,OSXMountainLion:/os x 10[._]8/i,OSXMavericks:/os x 10[._]9/i,OSXYosemite:/os x 10[._]10/i,OSXElCapitan:/os x 10[._]11/i,OSXSierra:/os x 10[._]12/i,Mac:/os x/i,Linux:/linux/i,Linux64:/linux x86\_64/i,ChromeOS:/cros/i,Wii:/wii/i,PS3:/playstation 3/i,PSP:/playstation portable/i,iPad:/\(iPad.*os (\d+)[._](\d+)/i,iPhone:/\(iPhone.*os (\d+)[._](\d+)/i,Bada:/Bada\/(\d+)\.(\d+)/i,Curl:/curl\/(\d+)\.(\d+)\.(\d+)/i},this._Platform={Windows:/windows nt/i,WindowsPhone:/windows phone/i,Mac:/macintosh/i,Linux:/linux/i,Wii:/wii/i,Playstation:/playstation/i,iPad:/ipad/i,iPod:/ipod/i,iPhone:/iphone/i,Android:/android/i,Blackberry:/blackberry/i,Samsung:/samsung/i,Curl:/curl/i},this.DefaultAgent={isAuthoritative:!0,isMobile:!1,isTablet:!1,isiPad:!1,isiPod:!1,isiPhone:!1,isAndroid:!1,isBlackberry:!1,isOpera:!1,isIE:!1,isEdge:!1,isIECompatibilityMode:!1,isSafari:!1,isFirefox:!1,isWebkit:!1,isChrome:!1,isKonqueror:!1,isOmniWeb:!1,isSeaMonkey:!1,isFlock:!1,isAmaya:!1,isPhantomJS:!1,isEpiphany:!1,isDesktop:!1,isWindows:!1,isLinux:!1,isLinux64:!1,isMac:!1,isChromeOS:!1,isBada:!1,isSamsung:!1,isRaspberry:!1,isBot:!1,isCurl:!1,isAndroidTablet:!1,isWinJs:!1,isKindleFire:!1,isSilk:!1,isCaptive:!1,isSmartTV:!1,isUC:!1,silkAccelerated:!1,browser:"unknown",version:"unknown",os:"unknown",platform:"unknown",geoIp:{},source:""},this.Agent={},this.getBrowser=function(a){switch(!0){case this._Browsers.Edge.test(a):return this.Agent.isEdge=!0,"Edge";case this._Browsers.PhantomJS.test(a):return this.Agent.isPhantomJS=!0,"PhantomJS";case this._Browsers.Konqueror.test(a):return this.Agent.isKonqueror=!0,"Konqueror";case this._Browsers.Amaya.test(a):return this.Agent.isAmaya=!0,"Amaya";case this._Browsers.Epiphany.test(a):return this.Agent.isEpiphany=!0,"Epiphany";case this._Browsers.SeaMonkey.test(a):return this.Agent.isSeaMonkey=!0,"SeaMonkey";case this._Browsers.Flock.test(a):return this.Agent.isFlock=!0,"Flock";case this._Browsers.OmniWeb.test(a):return this.Agent.isOmniWeb=!0,"OmniWeb";case this._Browsers.Opera.test(a):return this.Agent.isOpera=!0,"Opera";case this._Browsers.Chromium.test(a):return this.Agent.isChrome=!0,"Chromium";case this._Browsers.Chrome.test(a):return this.Agent.isChrome=!0,"Chrome";case this._Browsers.Safari.test(a):return this.Agent.isSafari=!0,"Safari";case this._Browsers.WinJs.test(a):return this.Agent.isWinJs=!0,"WinJs";case this._Browsers.IE.test(a):return this.Agent.isIE=!0,"IE";case this._Browsers.PS3.test(a):return"ps3";case this._Browsers.PSP.test(a):return"psp";case this._Browsers.Firefox.test(a):return this.Agent.isFirefox=!0,"Firefox";case this._Browsers.UC.test(a):return this.Agent.isUC=!0,"UCBrowser";default:return 0!==a.indexOf("Mozilla")&&/^([\d\w\-\.]+)\/[\d\w\.\-]+/i.test(a)?(this.Agent.isAuthoritative=!1,RegExp.$1):"unknown"}},this.getBrowserVersion=function(a){var b;switch(this.Agent.browser){case"Edge":if(this._Versions.Edge.test(a))return RegExp.$1;break;case"PhantomJS":if(this._Versions.PhantomJS.test(a))return RegExp.$1;break;case"Chrome":if(this._Versions.Chrome.test(a))return RegExp.$1;break;case"Chromium":if(this._Versions.Chromium.test(a))return RegExp.$1;break;case"Safari":if(this._Versions.Safari.test(a))return RegExp.$1;break;case"Opera":if(this._Versions.Opera.test(a))return RegExp.$1?RegExp.$1:RegExp.$2;break;case"Firefox":if(this._Versions.Firefox.test(a))return RegExp.$1;break;case"WinJs":if(this._Versions.WinJs.test(a))return RegExp.$1;break;case"IE":if(this._Versions.IE.test(a))return RegExp.$2?RegExp.$2:RegExp.$1;break;case"ps3":if(this._Versions.Ps3.test(a))return RegExp.$1;break;case"psp":if(this._Versions.Psp.test(a))return RegExp.$1;break;case"Amaya":if(this._Versions.Amaya.test(a))return RegExp.$1;break;case"Epiphany":if(this._Versions.Epiphany.test(a))return RegExp.$1;break;case"SeaMonkey":if(this._Versions.SeaMonkey.test(a))return RegExp.$1;break;case"Flock":if(this._Versions.Flock.test(a))return RegExp.$1;break;case"OmniWeb":if(this._Versions.OmniWeb.test(a))return RegExp.$1;break;case"UCBrowser":if(this._Versions.UC.test(a))return RegExp.$1;break;default:if("unknown"!==this.Agent.browser&&(b=new RegExp(this.Agent.browser+"[\\/ ]([\\d\\w\\.\\-]+)","i"),b.test(a)))return RegExp.$1}},this.getOS=function(a){switch(!0){case this._OS.WindowsVista.test(a):return this.Agent.isWindows=!0,"Windows Vista";case this._OS.Windows7.test(a):return this.Agent.isWindows=!0,"Windows 7";case this._OS.Windows8.test(a):return this.Agent.isWindows=!0,"Windows 8";case this._OS.Windows81.test(a):return this.Agent.isWindows=!0,"Windows 8.1";case this._OS.Windows10.test(a):return this.Agent.isWindows=!0,"Windows 10.0";case this._OS.Windows2003.test(a):return this.Agent.isWindows=!0,"Windows 2003";case this._OS.WindowsXP.test(a):return this.Agent.isWindows=!0,"Windows XP";case this._OS.Windows2000.test(a):return this.Agent.isWindows=!0,"Windows 2000";case this._OS.WindowsPhone8.test(a):return"Windows Phone 8";case this._OS.Linux64.test(a):return this.Agent.isLinux=!0,this.Agent.isLinux64=!0,"Linux 64";case this._OS.Linux.test(a):return this.Agent.isLinux=!0,"Linux";case this._OS.ChromeOS.test(a):return this.Agent.isChromeOS=!0,"Chrome OS";case this._OS.Wii.test(a):return"Wii";case this._OS.PS3.test(a):return"Playstation";case this._OS.PSP.test(a):return"Playstation";case this._OS.OSXCheetah.test(a):return this.Agent.isMac=!0,"OS X Cheetah";case this._OS.OSXPuma.test(a):return this.Agent.isMac=!0,"OS X Puma";case this._OS.OSXJaguar.test(a):return this.Agent.isMac=!0,"OS X Jaguar";case this._OS.OSXPanther.test(a):return this.Agent.isMac=!0,"OS X Panther";case this._OS.OSXTiger.test(a):return this.Agent.isMac=!0,"OS X Tiger";case this._OS.OSXLeopard.test(a):return this.Agent.isMac=!0,"OS X Leopard";case this._OS.OSXSnowLeopard.test(a):return this.Agent.isMac=!0,"OS X Snow Leopard";case this._OS.OSXLion.test(a):return this.Agent.isMac=!0,"OS X Lion";case this._OS.OSXMountainLion.test(a):return this.Agent.isMac=!0,"OS X Mountain Lion";case this._OS.OSXMavericks.test(a):return this.Agent.isMac=!0,"OS X Mavericks";case this._OS.OSXYosemite.test(a):return this.Agent.isMac=!0,"OS X Yosemite";case this._OS.OSXElCapitan.test(a):return this.Agent.isMac=!0,"OS X El Capitan";case this._OS.OSXSierra.test(a):return this.Agent.isMac=!0,"macOS Sierra";case this._OS.Mac.test(a):return this.Agent.isMac=!0,"OS X";case this._OS.iPad.test(a):return this.Agent.isiPad=!0,a.match(this._OS.iPad)[0].replace("_",".");case this._OS.iPhone.test(a):return this.Agent.isiPhone=!0,a.match(this._OS.iPhone)[0].replace("_",".");case this._OS.Bada.test(a):return this.Agent.isBada=!0,"Bada";case this._OS.Curl.test(a):return this.Agent.isCurl=!0,"Curl";default:return"unknown"}},this.getPlatform=function(a){switch(!0){case this._Platform.Windows.test(a):return"Microsoft Windows";case this._Platform.WindowsPhone.test(a):return this.Agent.isWindowsPhone=!0,"Microsoft Windows Phone";case this._Platform.Mac.test(a):return"Apple Mac";case this._Platform.Curl.test(a):return"Curl";case this._Platform.Android.test(a):return this.Agent.isAndroid=!0,"Android";case this._Platform.Blackberry.test(a):return this.Agent.isBlackberry=!0,"Blackberry";case this._Platform.Linux.test(a):return"Linux";case this._Platform.Wii.test(a):return"Wii";case this._Platform.Playstation.test(a):return"Playstation";case this._Platform.iPad.test(a):return this.Agent.isiPad=!0,"iPad";case this._Platform.iPod.test(a):return this.Agent.isiPod=!0,"iPod";case this._Platform.iPhone.test(a):return this.Agent.isiPhone=!0,"iPhone";case this._Platform.Samsung.test(a):return this.Agent.isiSamsung=!0,"Samsung";default:return"unknown"}},this.testCompatibilityMode=function(){var a=this;if(this.Agent.isIE&&/Trident\/(\d)\.0/i.test(a.Agent.source)){var b=parseInt(RegExp.$1,10),c=parseInt(a.Agent.version,10);7===c&&6===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=10),7===c&&5===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=9),7===c&&4===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=8)}},this.testSilk=function(){var a=this;switch(!0){case new RegExp("silk","gi").test(a.Agent.source):this.Agent.isSilk=!0}return/Silk-Accelerated=true/gi.test(a.Agent.source)&&(this.Agent.SilkAccelerated=!0),this.Agent.isSilk?"Silk":!1},this.testKindleFire=function(){var a=this;switch(!0){case/KFOT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire";case/KFTT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD";case/KFJWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9";case/KFJWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9 4G";case/KFSOWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 7";case/KFTHWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7";case/KFTHWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7 4G";case/KFAPWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9";case/KFAPWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9 4G";default:return!1}},this.testCaptiveNetwork=function(){var a=this;switch(!0){case/CaptiveNetwork/gi.test(a.Agent.source):return a.Agent.isCaptive=!0,a.Agent.isMac=!0,a.Agent.platform="Apple Mac","CaptiveNetwork";default:return!1}},this.reset=function(){var a=this;for(var b in a.DefaultAgent)a.Agent[b]=a.DefaultAgent[b];return a},this.testMobile=function(){var a=this;switch(!0){case a.Agent.isWindows:case a.Agent.isLinux:case a.Agent.isMac:case a.Agent.isChromeOS:a.Agent.isDesktop=!0;break;case a.Agent.isAndroid:case a.Agent.isSamsung:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}switch(!0){case a.Agent.isiPad:case a.Agent.isiPod:case a.Agent.isiPhone:case a.Agent.isBada:case a.Agent.isBlackberry:case a.Agent.isAndroid:case a.Agent.isWindowsPhone:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}/mobile/i.test(a.Agent.source)&&(a.Agent.isMobile=!0,a.Agent.isDesktop=!1)},this.testTablet=function(){var a=this;switch(!0){case a.Agent.isiPad:case a.Agent.isAndroidTablet:case a.Agent.isKindleFire:a.Agent.isTablet=!0}/tablet/i.test(a.Agent.source)&&(a.Agent.isTablet=!0)},this.testNginxGeoIP=function(a){var b=this;Object.keys(a).forEach(function(c){/^GEOIP/i.test(c)&&(b.Agent.geoIp[c]=a[c])})},this.testBot=function(){var a=this,b=c.exec(a.Agent.source.toLowerCase());b?a.Agent.isBot=b[1]:a.Agent.isAuthoritative||(a.Agent.isBot=/bot/i.test(a.Agent.source))},this.testSmartTV=function(){var a=this,b=new RegExp("smart-tv|smarttv|googletv|appletv|hbbtv|pov_tv|netcast.tv","gi").exec(a.Agent.source.toLowerCase());b&&(a.Agent.isSmartTV=b[1])},this.testAndroidTablet=function(){var a=this;a.Agent.isAndroid&&!/mobile/i.test(a.Agent.source)&&(a.Agent.isAndroidTablet=!0)},this.parse=function(a){var b=new d;return b.Agent.source=a.replace(/^\s*/,"").replace(/\s*$/,""),b.Agent.os=b.getOS(b.Agent.source),b.Agent.platform=b.getPlatform(b.Agent.source),b.Agent.browser=b.getBrowser(b.Agent.source),b.Agent.version=b.getBrowserVersion(b.Agent.source),b.testBot(),b.testSmartTV(),b.testMobile(),b.testAndroidTablet(),b.testTablet(),b.testCompatibilityMode(),b.testSilk(),b.testKindleFire(),b.testCaptiveNetwork(),b.Agent},this.Agent=this.DefaultAgent,this};return a.UserAgent=d,new d}(this); |
{ | ||
"name": "express-useragent", | ||
"description": "ExpressJS/Connect/TrinteJS user-agent middleware exposing", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/biggora/express-useragent/", | ||
@@ -75,3 +75,5 @@ "repository": { | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"nodeunit": "0.10.2" | ||
}, | ||
"devDependencies": { | ||
@@ -78,0 +80,0 @@ "nodeunit": "*", |
@@ -1165,1 +1165,34 @@ /** | ||
}; | ||
exports['PhantomJS'] = function (test) { | ||
var s = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34'; | ||
var a = ua.parse(s); | ||
test.ok(a.isAuthoritative, 'Authoritative'); | ||
test.ok(!a.isMobile, 'Mobile'); | ||
test.ok(!a.isiPad, 'iPad'); | ||
test.ok(!a.isiPod, 'iPod'); | ||
test.ok(!a.isiPhone, 'iPhone'); | ||
test.ok(!a.isAndroid, 'Android'); | ||
test.ok(!a.isBlackberry, 'Blackberry'); | ||
test.ok(!a.isOpera, 'Opera'); | ||
test.ok(!a.isIE, 'IE'); | ||
test.ok(!a.isEdge, 'Edge'); | ||
test.ok(!a.isSafari, 'Safari'); | ||
test.ok(!a.isFirefox, 'Firefox'); | ||
test.ok(!a.isWebkit, 'Webkit'); | ||
test.ok(!a.isChrome, 'Chrome'); | ||
test.ok(!a.isKonqueror, 'Konqueror'); | ||
test.ok(a.isDesktop, 'Desktop'); | ||
test.ok(a.isWindows, 'Windows'); | ||
test.ok(!a.isLinux, 'Linux'); | ||
test.ok(!a.isMac, 'Mac'); | ||
test.ok(!a.isWindowsPhone, 'Windows Phone'); | ||
test.ok(a.isPhantomJS, 'PhantomJS'); | ||
test.equal(a.version, '1.9.8'); | ||
test.ok(!a.isIECompatibilityMode); | ||
test.done(); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110509
2241
1
+ Addednodeunit@0.10.2
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@0.2.01.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedclean-yaml-object@0.1.0(transitive)
+ Addedcolor-support@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcore-util-is@1.0.21.0.3(transitive)
+ Addedcoveralls@2.13.3(transitive)
+ Addedcross-spawn@4.0.2(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddeeper@2.1.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddiff@1.4.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesprima@2.7.34.0.1(transitive)
+ Addedevents-to-array@1.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedforeground-child@1.5.6(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.1.4(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhar-validator@2.0.6(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisexe@1.1.22.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjs-yaml@3.14.13.6.1(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlcov-parse@0.0.10(transitive)
+ Addedlog-driver@1.2.5(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addednodeunit@0.10.2(transitive)
+ Addednyc@7.1.0(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonly-shallow@1.2.0(transitive)
+ Addedopener@1.5.2(transitive)
+ Addedos-homedir@1.0.1(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedqs@6.3.3(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedrequest@2.79.0(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstack-utils@0.4.0(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtap@7.1.2(transitive)
+ Addedtap-mocha-reporter@2.0.1(transitive)
+ Addedtap-parser@2.2.3(transitive)
+ Addedtmatch@2.0.1(transitive)
+ Addedtough-cookie@2.3.4(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedunicode-length@1.0.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedyallist@2.1.2(transitive)