mirror of https://github.com/keeweb/keeweb.git
refactor selfhosted app detection
This commit is contained in:
parent
928be7b8e4
commit
a39b4e63a1
|
@ -1,6 +1,6 @@
|
|||
const StorageBase = require('./storage-base');
|
||||
const UrlUtil = require('../util/url-util');
|
||||
const Launcher = require('../comp/launcher');
|
||||
const FeatureDetector = require('../util/feature-detector');
|
||||
|
||||
const DropboxKeys = {
|
||||
AppFolder: 'qp7ctun6qt5n9d6',
|
||||
|
@ -59,9 +59,7 @@ const StorageDropbox = StorageBase.extend({
|
|||
},
|
||||
|
||||
_canUseBuiltInKeys: function() {
|
||||
const isSelfHosted = !/^http(s?):\/\/localhost:8085/.test(location.href) &&
|
||||
!/http(s?):\/\/(app|beta)\.keeweb\.info/.test(location.href);
|
||||
return !!Launcher || !isSelfHosted;
|
||||
return !FeatureDetector.isSelfHosted;
|
||||
},
|
||||
|
||||
_getOAuthConfig: function() {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
const MobileRegex = /iPhone|iPad|iPod|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop|Windows Phone|webOS/i;
|
||||
const MinDesktopScreenWidth = 800;
|
||||
|
||||
const isDesktop = !!(window.process && window.process.versions && window.process.versions.electron);
|
||||
|
||||
const FeatureDetector = {
|
||||
isDesktop: isDesktop,
|
||||
isMac: navigator.platform.indexOf('Mac') >= 0,
|
||||
isWindows: navigator.platform.indexOf('Win') >= 0,
|
||||
isiOS: /iPad|iPhone|iPod/i.test(navigator.userAgent),
|
||||
|
@ -9,6 +12,7 @@ const FeatureDetector = {
|
|||
isPopup: !!((window.parent !== window.top) || window.opener),
|
||||
isStandalone: !!navigator.standalone,
|
||||
isBeta: window.location.href.toLowerCase().indexOf('beta.') > 0,
|
||||
isSelfHosted: !isDesktop && !/^http(s?):\/\/((localhost:8085)|((app|beta)\.keeweb\.info))/.test(location.href),
|
||||
needFixClicks: /Edge\/14/.test(navigator.appVersion),
|
||||
|
||||
actionShortcutSymbol: function(formatting) {
|
||||
|
@ -40,7 +44,7 @@ const FeatureDetector = {
|
|||
if (!window.crypto) {
|
||||
throw 'WebCrypto not available';
|
||||
}
|
||||
if (!localStorage.length && (!window.process || !window.process.versions || !window.process.versions.electron)) {
|
||||
if (!localStorage.length && !isDesktop) {
|
||||
try {
|
||||
localStorage.appSettings = '';
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue