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

@realeyes/environment-detector

Package Overview
Dependencies
Maintainers
3
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@realeyes/environment-detector - npm Package Compare versions

Comparing version 1.8.6 to 2.0.0

.jshintrc

2

.eslintrc.js
module.exports = {
"parser": "babel-eslint",
"root": true,

@@ -6,3 +7,2 @@ "env": {

},
"extends": "airbnb-base",
"rules": {

@@ -9,0 +9,0 @@ "indent": ["error", 4],

@@ -35,2 +35,3 @@ /**

SEAMONKEY: 'SeaMonkey',
IOS_WEBVIEW: 'iOS WebView',
UNKNOWN: 'Unknown',

@@ -131,3 +132,8 @@ };

browserName: names.SAFARI,
testRegex: /safari|applewebkit/i,
testRegex: /safari/i,
versionRegex: /version\/(\d+(\.\d+)?)/i,
},
{
browserName: names.IOS_WEBVIEW,
testRegex: /(iPhone|iPad).*AppleWebKit(?!.*Safari)/i,
versionRegex: null,

@@ -134,0 +140,0 @@ },

@@ -8,6 +8,2 @@ /**

import swfobject from 'swfobject';
import inArray from './utils/inArray';
/**

@@ -19,3 +15,2 @@ * Enum for capabilities that we can detect.

const names = {
FLASH: 'flash',
GET_USER_MEDIA: 'navigator.getUserMedia',

@@ -37,12 +32,2 @@ MEDIA_RECORDER: 'MediaRecorder',

{
capabilityName: names.FLASH,
test() {
const s = swfobject();
const version = s.getFlashPlayerVersion();
return !(version.major === 0 && version.minor === 0 && version.release === 0);
},
},
{
capabilityName: names.GET_USER_MEDIA,

@@ -109,10 +94,9 @@

*
* @param {Array.<string>} skip Array of checks to skip
* @return {Array.<string>}
*/
detect(skip = []) {
detect() {
const results = [];
for (let i = 0; i < tests.length; i++) {
if (!inArray(skip, tests[i].capabilityName) && tests[i].test()) {
if (tests[i].test()) {
results.push(tests[i].capabilityName);

@@ -119,0 +103,0 @@ }

@@ -12,6 +12,4 @@ /**

import capabilities from './capabilities';
import flash from './flash';
import webcams from './webcam';
import Logger from './utils/Logger';
import inArray from './utils/inArray';

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

* },
* flash: ?{
* version: string,
* webcams: Array.<string>,
* },
* webcams: Array.<string>,

@@ -45,9 +39,2 @@ * capabilities: Array.<string>,

* @typedef {{
* flash: ?{
* path: ?string,
* testTimeout: ?number,
* containerId: ?string,
* minFlashVersion: ?string,
* },
* skip: Array.<string>,
* logger: ?{

@@ -68,22 +55,19 @@ * path: ?string,

const logger = new Logger(options.logger);
const skipFlash = options.skip && inArray(options.skip, 'flash');
logger.log('environment-detector started', options);
return flash.detect(options.flash, skipFlash, logger)
.then(flashResult => webcams.detect(flashResult)
.then(webcamsResult => {
const result = {
browser: browsers.detect(ua),
platform: platform.detect(ua),
os: os.detect(ua),
flash: flashResult,
webcams: webcamsResult,
capabilities: capabilities.detect(options.skip),
};
return webcams.detect()
.then(webcamsResult => {
const result = {
browser: browsers.detect(ua),
platform: platform.detect(ua),
os: os.detect(ua),
webcams: webcamsResult,
capabilities: capabilities.detect(),
};
logger.log('environment-detector result', result);
logger.log('environment-detector result', result);
return result;
}))
return result;
})
.catch((e) => {

@@ -90,0 +74,0 @@ logger.log('environment-detector failed', e);

@@ -8,2 +8,3 @@ /**

import Promise from 'native-promise-only';
import JSON from 'json3';

@@ -10,0 +11,0 @@ import uuidV4 from 'uuid/v4';

@@ -11,6 +11,5 @@ /**

*
* @param {FlashResult} flashResult Flash result object
* @return {Promise.<Array.<string>>}
*/
detect(flashResult) {
detect() {
if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {

@@ -30,4 +29,2 @@ return navigator.mediaDevices.enumerateDevices()

});
} else if (flashResult !== null) {
return Promise.resolve(flashResult.webcams);
}

@@ -34,0 +31,0 @@

{
"name": "@realeyes/environment-detector",
"version": "1.8.6",
"version": "2.0.0",
"scripts": {
"test": "babel-node tests/index.js",
"lint": "eslint .",
"build:flash": "mxmlc -static-link-runtime-shared-libraries=true -output dist/environment-detector.swf flash/EnvironmentDetector.as",
"build:js": "ejs-cli -O package.json index.js | browserify - -d -t [ babelify ] | exorcist ./dist/environment-detector.js.map > ./dist/environment-detector.js",
"build": "npm run build:flash && npm run build:js",
"minify": "uglifyjs --support-ie8 --comments /^!/ dist/environment-detector.js --source-map dist/environment-detector.min.js.map --in-source-map dist/environment-detector.js.map --source-map-url environment-detector.min.js.map > dist/environment-detector.min.js",
"build": "ejs-cli -O package.json index.js | browserify - -d -t [ babelify ] | exorcist ./dist/environment-detector.js.map > ./dist/environment-detector.js",
"minify": "uglifyjs --comments /^!/ dist/environment-detector.js --source-map dist/environment-detector.min.js.map --in-source-map dist/environment-detector.js.map --source-map-url environment-detector.min.js.map > dist/environment-detector.min.js",
"compress": "gzipme -O dist/environment-detector.min.js.gz -c best dist/environment-detector.min.js",

@@ -25,22 +23,21 @@ "copy": "copyfiles -f ./log.gif dist",

"devDependencies": {
"babel-cli": "^6.18.0",
"babel-plugin-transform-es2015-classes": "^6.14.0",
"babel-plugin-transform-es2015-destructuring": "^6.9.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.14.0",
"babel-plugin-transform-es2015-spread": "^6.8.0",
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
"babel-plugin-transform-es3-property-literals": "^6.8.0",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-preset-es2015": "^6.13.2",
"babelify": "^7.3.0",
"browserify": "^13.1.0",
"copyfiles": "^1.0.0",
"ejs-cli": "^2.0.0",
"eslint": "^3.3.1",
"eslint-config-airbnb-base": "^5.0.3",
"eslint-plugin-import": "^1.14.0",
"exorcist": "^0.4.0",
"flex-sdk": "^4.6.0-0",
"gzipme": "0.0.9",
"rimraf": "^2.5.4",
"babel-cli": "^6.26.0",
"babel-eslint": "8.2.2",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
"babel-plugin-transform-es3-property-literals": "^6.22.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babelify": "^8.0.0",
"browserify": "^16.1.1",
"copyfiles": "^2.0.0",
"ejs-cli": "^2.0.1",
"eslint": "^4.18.2",
"eslint-plugin-import": "^2.9.0",
"exorcist": "^1.0.1",
"gzipme": "0.1.1",
"rimraf": "^2.6.2",
"uglify-js": "^2.7.3"

@@ -50,8 +47,7 @@ },

"base-64": "^0.1.0",
"es6-error": "^4.0.1",
"es6-error": "^4.1.1",
"json3": "^3.3.2",
"native-promise-only": "^0.8.1",
"swfobject": "github:realeyes/swfobject#e057ecd34207ad7e2180d83f4a7e75aebac0e42e",
"uuid": "^3.0.1",
"visibilityjs": "^1.2.4"
"uuid": "^3.2.1",
"visibilityjs": "^1.2.7"
},

@@ -69,3 +65,2 @@ "description": "Environment Detector",

"environment",
"flash",
"detector"

@@ -72,0 +67,0 @@ ],

@@ -7,4 +7,10 @@ # Environment Detector

**Highlight:** flash detection removed from version 2.0
$ npm i --save @realeyes/environment-detector
If you need to detect flash then you should use previous 1.x versions of Environment Detector for example install the latest 1.x
$ npm i --save @realeyes/environment-detector@1.8.6
### CDN version

@@ -15,6 +21,6 @@

- `x.y` to receive patch updates: `https://codesdwncdn.realeyesit.com/environment-detector/release/1.7/environment-detector.js`
- `x` to receive minor updates: `https://codesdwncdn.realeyesit.com/environment-detector/release/1/environment-detector.js`
- `x` to receive minor updates: `https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.js`
```html
<script src="https://codesdwncdn.realeyesit.com/environment-detector/release/1/environment-detector.js"></script>
<script src="https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.js"></script>
```

@@ -24,10 +30,9 @@

To create a self-hosted solution you will need to download the library archive [https://codesdwncdn.realeyesit.com/environment-detector/release/1/environment-detector.zip](https://codesdwncdn.realeyesit.com/environment-detector/release/1/environment-detector.zip). The archive contains the following files:
To create a self-hosted solution you will need to download the library archive [https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.zip](https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.zip). The archive contains the following files:
- environment-detector.js - Detector library
- environment-detector.min.js - Minified version
- environment-detector.swf - Flash detector
- index.html - Example page
- log.gif - Tracking pixel
To use to detector you will need at least two files: environment-detector.js and environment-detector.swf. In this case you will need to provide an swf path when calling the `detect()` method.
To use to detector you will need environment-detector.js.

@@ -37,3 +42,3 @@ ```html

<script>
Realeyesit.EnvironmentDetector.detect({ flash: { path: 'https://example.com/environment-detector.swf' } })
Realeyesit.EnvironmentDetector.detect()
.then(function (result) {

@@ -62,5 +67,2 @@ // result will be an EnvironmentDetectionResult object

},
flash: ({
version: string,
}|null),
webcams: Array.<string>,

@@ -75,3 +77,2 @@ capabilities: Array.<string>

* **os.version** is a version string like "10.11"
* **flash.version** is a version string "\<major\>.\<minor\>.\<patch\>.\<build\>" format
* **webcams** is an array of strings, for example \["USB Camera", "iSight"\]

@@ -83,3 +84,2 @@ * **capabilities** is an array of strings

{
FLASH: 'flash',
GET_USER_MEDIA: 'navigator.getUserMedia',

@@ -97,9 +97,2 @@ MEDIA_RECORDER: 'MediaRecorder',

{
flash: {
path: string,
testTimeout: number,
containerId: string,
minFlashVersion: string,
}, // flash detection settings
skip: Array.<string>, // you can pass an array of capabilities you don't want to check, for example ["flash"].
logger: {

@@ -123,3 +116,3 @@ path: string, // url of the tracking pixel

Copyright 2016 Realeyes OU.
Copyright 2018 Realeyes OU.

@@ -126,0 +119,0 @@ Licensed under the Apache License, Version 2.0 (the "License");

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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