Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { detect } = require("detect-browser");
const browser = detect();
// Precision on device detection is fuzzy -- we can sometimes know if a device is definitely
// available, or definitely *not* available, and assume it may be available otherwise.
export const VR_DEVICE_AVAILABILITY = {
yes: "yes", // Implies VR can be launched into on this device immediately, in this browser
no: "no", // Implies this VR device is definitely not supported regardless of browser
maybe: "maybe" // Implies this device may support this VR platform, but may not be installed or in a compatible browser
};
function isMaybeGearVRCompatibleDevice(ua) {
return /\WAndroid\W/.test(ua);
}
function isMaybeDaydreamCompatibleDevice(ua) {
return /\WAndroid\W/.test(ua);
}
constructor(url = '', config = {}) {
super();
this._browser = detect();
// replace the object
if (typeof url === 'object') {
config = url;
} else if (typeof url === 'string') {
this._url = url;
}
switch (this._browser && this._browser.name) {
case 'chrome':
case "safari":
this._xhr = new FetchChunked(config);
break;
case 'firefox':
import { detect } from 'detect-browser';
const browser = detect();
if (browser) {
const name: string = browser.name;
const version: string = browser.version;
}
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import { detect } from 'detect-browser';
import LoginForm from '../components/app/LoginForm';
const BROWSER = detect();
class Login extends Component {
constructor(props) {
super(props);
}
UNSAFE_componentWillMount() {
const { logged, dispatch } = this.props;
if (logged) {
dispatch(push('/'));
}
}
browserSupport = (...supportedBrowsers) => {
const userBrowser = BROWSER.name;
let isSupported = false;
export function login(username: string, password: string) {
const browser = detect();
const name = (browser && browser.name + ' ' + browser.version) || 'unknown browser';
authenticating();
axios
.create()
.request({
url: config.get('url') + 'client',
method: 'POST',
data: {name},
auth: {username, password},
})
.then((resp) => {
GlobalAction.snack(`A client named '${name}' was created for your session.`);
setAuthorizationToken(resp.data.token);
tryAuthenticate()
.then(GlobalAction.initialLoad)
.catch(() =>
[
{
browsers: {
chrome: 'https://chrome.google.com/webstore/detail/polkadot%7Bjs%7D-extension/mopnmbcafieddcagagdcbnhejhlodfdd',
firefox: 'https://addons.mozilla.org/en-US/firefox/addon/polkadot-js-extension/'
},
desc: 'Basic account injection and signer',
name: 'polkadot-js extension'
}
].forEach(({ browsers, desc, name }): void => {
Object.entries(browsers).forEach(([browser, link]): void => {
available[browser as Browser].push({ link, desc, name });
});
});
const browserInfo = detect();
const browserName: Browser | null = (browserInfo && (browserInfo.name as Browser)) || null;
const isSupported = browserName && Object.keys(available).includes(browserName);
function Banner ({ className, t }: Props): React.ReactElement | null {
if (isWeb3Injected || !isSupported || !browserName) {
return null;
}
return (
<div>
<div>
<div>
<p>{t('It is recommended that you create/store your accounts securely and externally from the app. On {{yourBrowser}} the following browser extensions are available for use -', {
replace: {
yourBrowser: stringUpperFirst(browserName)
}</p></div></div></div>
import { detect } from 'detect-browser'
const browser = detect()
export function combineClass(from, ...classes: string[]) {
const combined = {
...from,
class: [from.className || from.class, ...classes].filter(k => k).join(' '),
}
delete combined.className
return combined
}
export function isChrome() {
return browser && browser.name === 'chrome'
}
static identify () {
if (identifier === null) {
const browser = detect()
identifier = browser
? `${browser.name}-${browser.version.replace(/\./g, '-')}`
: false
}
return identifier
}
const { EventTarget, defineEventAttribute } = require('event-target-shim');
const { detect } = require('detect-browser');
const browser = detect();
const AudioContext = global.AudioContext || global.webkitAudioContext;
const BUFFER_SIZE = 4096;
/**
* Reference: https://w3c.github.io/mediacapture-record/#mediarecorder-api
* @extends EventTarget
*/
class OpusMediaRecorder extends EventTarget {
/**
* A function that returns the encoder web worker
* @name workerFactory
* @function
* @returns {worker} An instance of ./encoderWorker.js web worker.
*/