New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

detector

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detector - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

10

detector.js

@@ -34,4 +34,2 @@

return /\bnokia ([0-9]+)?/;
}else if(ua.indexOf("noain") !== -1){
return /\bnoain ([a-z0-9]+)/;
}else{

@@ -61,3 +59,6 @@ return /\bnokia([a-z0-9]+)?/;

["mac", "macintosh"],
// 小米
["mi", /\bmi[ \-]?([a-z0-9 ]+(?= build|\)))/],
// 红米
['hongmi', /\bhm[ \-]?([a-z0-9]+)/],
["aliyun", /\baliyunos\b(?:[\-](\d+))?/],

@@ -230,3 +231,5 @@ ["meizu", /\b(?:meizu\/|m)([0-9]+)\b/],

["trident", re_msie],
//["blink", /blink\/([0-9.+]+)/],
["blink", function(ua){
return "chrome" in win && "CSS" in win && /\bapplewebkit[\/]?([0-9.+]+)/;
}],
["webkit", /\bapplewebkit[\/]?([0-9.+]+)/],

@@ -520,3 +523,2 @@ ["gecko", function(ua){

detector = parse(userAgent + " " + appVersion + " " + vendor);
win.detector = detector;

@@ -523,0 +525,0 @@ }

@@ -6,2 +6,30 @@

## 2.2.0 (2014-12-18)
* #15, Add `Blink` engine.
* #64, Add 增加了大量的杂牌手机设备 (Node)
* Fixed nokia rule.
* #37, #43, Delete `window.detector` global variable.
## 2.1.2 (2014-12-04)
* Fixed BlackBerry device, os, and browser rule.
* Fixed Gecko render engine version number.
## 2.1.1 (2014-09-22)
* Update `var window` to `var win` for jscoverage.
* Fixed BaiduHD browser rule.
## 2.1.0 (2014-09-17)
* 由于 2.0.2 版修改了部分浏览器名称,可能会有不兼容影响,因此升级次版本号。
## 2.0.2 (2014-09-17)
* Add #59 欧朋浏览器(oupeng)
* Fixed #56 sogou, liebao, maxthon, baidu 浏览器规则
* Fixed #60 UC 浏览器规则,支持 UC 桌面版。
* Update #58 修改 sg, mx, fs, sy 浏览器名称。
## 2.0.1 (2014-05-13)

@@ -8,0 +36,0 @@

216

morerule.js
module.exports = {
DEVICES: [],
DEVICES: [
// [诺亚信](http://www.noain.com.cn/)
["noain", /\bnoain ([a-z0-9]+)/],
// TODO: [华为荣耀](http://www.honor.cn/)
["huawei-honor", function(ua){
if (/\bhonor/.test(ua)) {
return /\b(honor)[ ]([a-z0-9]+)-([a-z0-9]+)\b/;
} else if (/\bh\d+-l\d+/.test(ua)) {
return /\b(h\d+-l\d+)/;
}
}],
// [乐Phone](http://www.lephonemall.com/)
["lephone", /\blephone[_\- ]+([a-z0-9]+)/],
// [华硕](https://www.asus.com.cn/Phones/)
['asus', /\basus_([a-z0-9]+)\b/],
['alcatel', /\balcatel\b/],
['一加', /\ba0001 build/],
['蓝米', /\blanmi[_\-]([a-z0-9]+)\b/],
['E派', /\bebest[_\- ]([a-z0-9]+)\b/],
// HIKe
['hike', /\bhike[_\- ]([a-z0-9]+)\b/],
['qmi', /\bqmi build/],
['优米', /\bumi[\-]?([a-z0-9]+)/],
['嘉源', /\bcayon ([a-z0-9]+)/],
['intki', /\bintki[_\- ]([a-z0-9]+)/],
['星语', /\bxy[- ]([a-z0-9]+)/],
['欧奇', /\boku([a-z0-9]+)/],
['海派', /\bhaipai ([a-z0-9 ]+) build/],
['广信',
function(ua) {
if (/\bef98 build/.test(ua)) {
return /\bef98 build/;
}
return /\bkingsun[_\- ]([a-z0-9]+)\b/;
}
],
['神州', /\bhasee ([a-z0-9 ]+) build\b/],
['青橙', /\bgo ([a-z0-9\-]+) build\b/],
['海信',
function(ua) {
if (/\bhs[ \-]+([a-z0-9]+)/.test(ua)) {
return /\bhs[ \-]+([a-z0-9]+)/;
} else if (/ (e601m|t980) build/) {
return / (e601m|t980) build/;
}
}],
["金立",
function(ua) {
if (/\b(?:gn|gionee)[ \-_]?([a-z0-9]+)[ \/]+/.test(ua)) {
return /\b(?:gn|gionee)[ \-_]?([a-z0-9]+)[ \/]+/;
} else if (/; a5 build/.test(ua)) {
return /; (a5) build/;
} else if (/; e6 build/.test(ua)) {
return /; (e6) build/;
}
}
],
["eton", /\beton ([a-z0-9]+)/],
["bohp", /\bbohp[_\- ]([a-z0-9]+)/],
['小杨树', /; (mm110\d) build/],
['语信',
function(ua) {
if (/\byusun ([a-z0-9]+)/.test(ua)) {
return /\byusun ([a-z0-9]+)/;
} else if (/\bla\d-([a-z0-9]+) build/.test(ua)) {
return /\b(la\d-([a-z0-9]+)) build/;
} else if (/\bt21 build/.test(ua)) {
return /\b(t21) build/;
}
}
],
['nubia', /\b(z7|nx\d{3}[a|j]) build/],
['爱讯达', /\bik build/],
['寰宇通', /\bxy\-a3/],
['mofut', /\bmofut ([a-z0-9]+) build/],
// InFocus
['infocus', /\binfocus ([a-z0-9]+) build/],
['大唐',
function(ua) {
if (/\b(i318)_t3 build/.test(ua)) {
return /\b(i318)_t3 build/;
} else if (/\bdatang ([a-z0-9]+)/.test(ua)) {
return /\bdatang ([a-z0-9]+)/;
}
}
],
['邦华', /\bboway ([a-z0-9]+)/],
['天迈', /\bt\-smart ([a-z0-9]+)/],
['大显', /\bht7100/],
['博瑞', /\bbror ([a-z0-9]+)/],
['lingwin',
function(ua) {
if (/\blingwin ([a-z0-9]+)/.test(ua)) {
return /\blingwin ([a-z0-9]+)/;
}
return /lingwin /;
}
],
['iusai', /\biusai ([a-z0-9]+)/],
['波导',
function(ua) {
if (/\bbird ([a-z0-9]+)/.test(ua)) {
return /\bbird ([a-z0-9]+)/;
} else if (/\bdoeasy ([a-z0-9]+) build/.test(ua)) {
return /\bdoeasy ([a-z0-9]+) build/;
}
}
],
['德赛', /\bdesay ([a-z0-9]+)/],
['蓝魔', /\bramos([a-z0-9]+)/],
['美图', /\bmeitu(\d+) build/],
['opsson', /\bopsson ([a-z0-9]+)/],
['benwee', /\bbenwee ([a-z0-9]+)/],
['hosin', /\bhosin ([a-z0-9]+)/],
['锤子', /; (sm701) build/],
['ephone', /ephone ([a-z0-9]+)/],
['佰事讯', /\b(wx9) build/],
['newman', /; newman ([a-z0-9]+) build/],
// 康佳
['konka',
function(ua) {
if (/ (l823) build/.test(ua)) {
return / (l823) build/;
} else if (/\bkonka[_\-]([a-z0-9]+)/.test(ua)) {
return /\bkonka[_\-]([a-z0-9]+)/;
}
}
],
['haier',
function(ua) {
if (/\b(?:haier|ht)[_-]([a-z0-9\-]+)\b/.test(ua)) {
return /\b(?:haier|ht)[_-]([a-z0-9\-]+)\b/;
}
}
],
['moto',
function(ua) {
if (/\bmot[\-]([a-z0-9]+)/.test(ua)) {
return /\bmot[\-]([a-z0-9]+)/;
} else if (/ (xt\d{3}) build/.test(ua)) {
return / (xt\d{3}) build/;
}
}
],
// TCL
['tcl',
function(ua) {
if (/\btcl[ \-]([a-z0-9]+)/.test(ua)) {
return /\btcl[ \-]([a-z0-9]+)/;
} else if (/\btcl([a-z0-9]+)/.test(ua)) {
return /\btcl([a-z0-9]+)/;
}
}
],
['天语',
function(ua) {
if (ua.indexOf('k-touch ') !== -1) {
return /\bk\-touch ([a-z0-9 +]+)(?:build|\))/
} else if (ua.indexOf('k-touch_') !== -1) {
return /\bk-touch_(a-z0-9)+/;
} else if (/k[ \-]touch/.test(ua)) {
return /k[ \-]touch ([a-z0-9]+)\b/;
}
}
],
// sony.
["sonyericsson",
function(ua) {
if (/\b([l|s]t\d{2}[i]{1,2}|[s|l]\d{2}h|m\d{2}c) build/.test(ua)) {
return /\b([l|s]t\d{2}[i]{1,2}|[s|l]\d{2}h|m\d{2}c)/;
} else if (/\bmt([a-z0-9]+)/.test(ua)) {
return /\bmt([a-z0-9]+)/;
} else if (/ l\d{2}t build/.test(ua)) {
return / (l\d{2}t) build/;
} else if (/ c6\d{3} /.test(ua)) {
return / (c6\d{3}) /;
} else if (/\bx10([a-z0-9]+) build/.test(ua)) {
return /\b(x10([a-z0-9]+)) build/;
}
return /\bxm\d{2}t/;
}
],
['doov', /\bdoov[ _]([a-z0-9]+)/],
['天时达',
function(ua) {
if (/\bts(\d+)/.test(ua)) {
return /\bts(\d+)/;
} else if (/\b(t5688) /.test(ua)) {
return /\b(t5688) /;
}
}
]
],
OS: [

@@ -7,2 +201,22 @@ ["meego", /\bmeego\b/]

BROWSER: [
['micromessenger', /\bmicromessenger\/([\d.]+)/],
['baiduboxapp',
function(ua) {
var back = 0;
var a;
if (/ baiduboxapp\//i.test(ua)) {
if (a = /([\d+.]+)_(?:diordna|enohpi)_/.exec(ua)) {
a = a[1].split('.');
back = a.reverse().join('.');
} else if (a = /baiduboxapp\/([\d+.]+)/.exec(ua)) {
back = a[1];
}
return {
version: back
};
}
return false;
}
],
["googlebot", /\bgooglebot\/([0-9.]+)/],

@@ -9,0 +223,0 @@ // 百度搜索引擎爬虫:无线、网页搜索

{
"name": "detector",
"version": "2.1.2",
"version": "2.2.0",
"description": "客户端信息识别模块",

@@ -5,0 +5,0 @@ "homepage": "http://spmjs.io/docs/detector/",

@@ -155,3 +155,63 @@ # detector

##### NODE ONLY
* `noain`: [诺亚信](http://www.noain.com.cn/)
* `huawei-honor`: [华为荣耀](http://www.honor.cn/)
* `lephone`: [乐Phone](http://www.lephonemall.com/)
* `asus`: [华硕](https://www.asus.com.cn/Phones/)
* `alcatel`
* `一加`
* `蓝米`
* `E派`
* `hike`
* `qmi`
* ~~`友信达`: [友信达](http://www.iunistar.com/)~~
* `优米`
* `嘉源`
* `intki`
* `星语`
* `欧奇`
* `海派`
* `广信`: [广信](http://www.szkingsun.com/)
* ~~`nibiru`: [nibiru](http://www.nbru.cn/)~~
* `神州`
* `青橙`
* `海信`
* `金立`
* `eton`
* `bohp`
* `小杨树`
* `语信`
* `nubia`
* `爱讯达`
* `寰宇通`
* `mofut`
* `infocus`
* `大唐`
* `邦华`
* `天迈`
* `大显`
* `博瑞`
* `lingwin`
* `iusai`
* `波导`
* `德赛`
* `蓝魔`
* `美图`
* `opsson`
* `benwee`
* `hosin`
* `锤子`
* `ephone`
* `佰事讯`
* `newman`
* `konka`
* `haier`
* `moto`
* `tcl`
* `天语`
* `doov`
* `天时达`
----

@@ -188,5 +248,8 @@

* `yunos`: 阿里云系统。
* `meego`: Meego. `NODE ONLY`
##### NODE ONLY
* `meego`: Meego.
----

@@ -257,12 +320,23 @@

* `ali-tm-pd`: 天猫平板客户端。
* `googlebot`: [Googlebot](wiki/googlebot.md) 网络爬虫。`NODE ONLY`
* `baiduspider`: [Baiduspider](wiki/baiduspider.md). `NODE ONLY`
* `bingbot`: [Bingbot](wiki/bingbot.md) 网络爬虫。`NODE ONLY`
* `msnbot`: [MSNBot](wiki/msnbot.md), `NODE ONLY`
* `nuhkbot`: [Nuhkbot](wiki/nuhkbot.md), `NODE ONLY`
* ~~`slurpbot`: Yahoo! [Slurp](wiki/slurpbot.md). `NODE ONLY`~~
* `alexabot`: [Alexabot](wiki/alexabot.md). `NODE ONLY`
* `curl`: curl. `NODE ONLY`
##### NODE ONLY
* `googlebot`: [Googlebot](wiki/googlebot.md) 网络爬虫。
* `baiduspider`: [Baiduspider](wiki/baiduspider.md) ,百度无线、网页搜索
* `baiduspider-image`: 百度图片搜索
* `baiduspider-video`: 百度视频搜索
* `baiduspider-news`: 百度新闻搜索
* `baiduspider-favo`: 百度收藏搜索
* `baiduspider-cpro`: 百度联盟
* `baiduspider-ads`: 百度商务搜索
* `baiduboxapp`: 百度手机搜索客户端
* `bingbot`: [Bingbot](wiki/bingbot.md) 网络爬虫。
* `msnbot`: [MSNBot](wiki/msnbot.md)
* `nuhkbot`: [Nuhkbot](wiki/nuhkbot.md)
* `alexabot`: [Alexabot](wiki/alexabot.md).
* `curl`: curl.
* `micromessenger` 微信
* ~~`slurpbot`: Yahoo! [Slurp](wiki/slurpbot.md)~~
### {Boolean} detector.browser.compatible

@@ -302,6 +376,7 @@

* `trident`: Trident.
* `webkit`: Webkit.
* `gecko`: Gecko.
* `presto`: Presto.
* `trident`: Microsoft Trident.
* `blink`: Google Blink.
* `webkit`: Apple Webkit.
* `gecko`: Mozilla Gecko.
* `presto`: Opera Presto.
* `androidwebkit`: Android Webkit.

@@ -308,0 +383,0 @@ * `coolpadwebkit`: Coolpad Webkit.

@@ -585,9 +585,2 @@

}],
// iPhone 5, 微信。
["Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.40 (KHTML, like Gecko) Mobile/11A4372q MicroMessenger/4.5", {
device: "iphone/-1",
os: "ios/7.0",
browser: "webview/-1;-1;o",
engine: "webkit/537.40;537.40;o"
}],
// Windows Phone, IE9

@@ -648,9 +641,2 @@ ["Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Nokia 620)", {

}],
// 魅族
["Mozilla/5.0 (Linux; U; Android 4.0.3; zh-cn; M030 Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 MicroMessenger/4.2.191", {
device: "meizu/030",
os: "android/4.0.3",
browser: "android/4.0;4.0;o",
engine: "webkit/534.30;534.30;o"
}],
["Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; M040 Build/JRO03H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", {

@@ -698,8 +684,2 @@ device: "meizu/040",

}],
["KONKA_V926_TD/1.0 Android/2.3.5 MocorDroid/SpreadTrum Release/3.22.2012 Browser/AppleWebKit5333.1 baiduboxapp/4.3 (Baidu; P1 2.3.5)", {
device: "konka/v926",
os: "android/2.3.5",
browser: "na/-1;-1;o",
engine: "webkit/5333.1;5333.1;o"
}],
["KONKA-V926/1.0 Linux/2.6.35.7 Android/2.3.5 Release/07.30.2012 Browser/AppleWebKit533.1 (KHTML%2C like Gecko) Mozilla/5.0 Mobile", {

@@ -719,8 +699,2 @@ device: "konka/v926",

}],
["UCWEB/2.0 (Linux; U; Adr unknown; zh-CN; NOAIN A900) U2/1.0.0 UCBrowser/8.8.3.278 U2/1.0.0 Mobile", {
device: "nokia/a900",
os: "android/-1",
browser: "uc/8.8.3.278;8.8.3.278;o",
engine: "u2/1.0.0;1.0.0;o"
}],
["UCWEB/2.0 (Linux; U; Adr 2.3.5; zh-CN; F-03D) U2/1.0.0 UCBrowser/8.8.3.278 U2/1.0.0 Mobile", {

@@ -727,0 +701,0 @@ device: "android/-1",

@@ -14,2 +14,38 @@ // more rule test.

// iPhone 5, 微信。
["Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.40 (KHTML, like Gecko) Mobile/11A4372q MicroMessenger/4.5", {
device: "iphone/-1",
os: "ios/7.0",
browser: "micromessenger/4.5;4.5;o",
engine: "webkit/537.40;537.40;o"
}],
// 魅族
["Mozilla/5.0 (Linux; U; Android 4.0.3; zh-cn; M030 Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 MicroMessenger/4.2.191", {
device: "meizu/030",
os: "android/4.0.3",
browser: "micromessenger/4.2.191;4.2.191;o",
engine: "webkit/534.30;534.30;o"
}],
["Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B435 MicroMessenger/6.0.1 NetType/WIFI", {
device: "iphone/-1",
os: "ios/8.1.1",
browser: "micromessenger/6.0.1;6.0.1;o",
engine: "webkit/600.1.4;600.1.4;o"
}],
["KONKA_V926_TD/1.0 Android/2.3.5 MocorDroid/SpreadTrum Release/3.22.2012 Browser/AppleWebKit5333.1 baiduboxapp/4.3 (Baidu; P1 2.3.5)", {
device: "konka/v926",
os: "android/2.3.5",
browser: "baiduboxapp/4.3;4.3;o",
engine: "webkit/5333.1;5333.1;o"
}],
// [诺亚信](http://www.noain.com.cn/)
["UCWEB/2.0 (Linux; U; Adr unknown; zh-CN; NOAIN A900) U2/1.0.0 UCBrowser/8.8.3.278 U2/1.0.0 Mobile", {
device: "noain/a900",
os: "android/-1",
browser: "uc/8.8.3.278;8.8.3.278;o",
engine: "u2/1.0.0;1.0.0;o"
}],
// Search Engine Bots.

@@ -16,0 +52,0 @@ ["Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)", {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc