diff --git a/src/img/browser/brave.png b/src/img/browser/brave.png new file mode 100755 index 000000000..50039e7eb Binary files /dev/null and b/src/img/browser/brave.png differ diff --git a/src/img/browser/tor.png b/src/img/browser/tor.png old mode 100644 new mode 100755 index 07be37a35..b2e9e6fa7 Binary files a/src/img/browser/tor.png and b/src/img/browser/tor.png differ diff --git a/src/js/Helper/compatibility.js b/src/js/Helper/compatibility.js index 6549f2123..540affda3 100644 --- a/src/js/Helper/compatibility.js +++ b/src/js/Helper/compatibility.js @@ -1,48 +1,65 @@ -function isCompatibleBrowser() { +function checkBrowserSupport() { try { if(!window.hasOwnProperty('crypto') || typeof window.crypto.subtle !== "object") { - console.error('Web Crypto API not supported'); - return false; + return 'crypto'; } if(!window.hasOwnProperty('TextEncoder')) { - console.error('TextEncoder not supported'); - return false; + return 'TextEncoder'; } if(!window.hasOwnProperty('WebAssembly') || typeof window.WebAssembly.instantiate !== "function") { - console.error('WebAssembly not supported'); - return false; + return 'WebAssembly'; } } catch(e) { console.error(e); - return false; + return 'ECMAScript 2017 / ES2017'; } return true; } -function showBrowserCompatibilityWarning() { +function showBrowserCompatibilityWarning(reason) { var imgpath = OC.filePath('passwords', 'img', 'browser/'), - container = document.getElementById('main'); + container = document.getElementById('main'), + title = 'Your browser is outdated', + message = 'Your browser is outdated and does not have the necessary functionality to run this app.' + + '
Please check if an update is available for your browser or choose a modern and compatible browser from the list below.'; + + if(reason === 'WebAssembly') { + var handbookLink = null, + settings = OCP.InitialState.loadState('passwords', 'settings'); + + if(settings && settings['server.handbook.url']) { + handbookLink = settings['server.handbook.url.web'] + 'Enable-WebAssembly'; + } + + title = 'Your browser does not support WebAssembly'; + message = 'Your browser does not support WebAssembly (WASM), which is required to run this app. ' + + '
In some browsers, WebAssembly must be enabled in the browser configuration.
' + + (handbookLink ? '':'') + + 'A guide to enable WebAssembly can be found in the Passwords App handbook.' + + (handbookLink ? '':'') + + '

If your browser does not have WebAssembly support, check if an update is available for your browser or choose a modern and compatible browser from the list below.'; + } + container.innerHTML = - '
' + - '

Your Browser is outdated

' + - '
Your browser is outdated and does not provide the necessary functionality to display this page.' + - '
Please check if an update is available for your browser or choose a modern and compatible browser from the list below.' + - '
' + + '

' + title + '

' + message + '
' + 'Firefox' + 'Vivaldi' + + 'Brave' + 'Tor Browser' + '
'; container.setAttribute('class', ''); - throw new Error('Browser does not suport ECMAScript 2017 / ES2017'); + console.error('Browser does not support ' + reason); + throw new Error('Browser does not support ' + reason); } function checkSystem() { - if(!isCompatibleBrowser()) showBrowserCompatibilityWarning(); + var reason = checkBrowserSupport(); + if(reason !== true) showBrowserCompatibilityWarning(reason); } window.addEventListener('DOMContentLoaded', checkSystem, false); \ No newline at end of file diff --git a/src/js/app.js b/src/js/app.js index 8a49894eb..3647b3f5d 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -11,7 +11,7 @@ __webpack_public_path__ = `${OC.appswebroots.passwords}/`; (function() { if(location.protocol !== 'https:') { location.href = `${location.origin}${location.pathname}?https=false`; - } else if(isCompatibleBrowser()) { + } else if(checkBrowserSupport() === true) { Application.init(); } }()); \ No newline at end of file diff --git a/src/lib/Helper/Settings/ServerSettingsHelper.php b/src/lib/Helper/Settings/ServerSettingsHelper.php index 1a3963a35..054622bf7 100644 --- a/src/lib/Helper/Settings/ServerSettingsHelper.php +++ b/src/lib/Helper/Settings/ServerSettingsHelper.php @@ -20,6 +20,8 @@ class ServerSettingsHelper { const SERVER_MANUAL_URL = 'https://raw.githubusercontent.com/wiki/marius-wieschollek/passwords/Users/'; + const SERVER_MANUAL_URL_WEB = 'https://git.mdns.eu/nextcloud/passwords/-/wikis/Users/'; + /** * @var ConfigurationService */ @@ -49,10 +51,10 @@ class ServerSettingsHelper { * @param ThemeSettingsHelper $themeSettings */ public function __construct( - IURLGenerator $urlGenerator, + IURLGenerator $urlGenerator, ConfigurationService $config, - ShareSettingsHelper $shareSettings, - ThemeSettingsHelper $themeSettings + ShareSettingsHelper $shareSettings, + ThemeSettingsHelper $themeSettings ) { $this->urlGenerator = $urlGenerator; $this->shareSettings = $shareSettings; @@ -91,8 +93,13 @@ public function get(string $key) { case 'sharing': return $this->shareSettings->get($subKey); case 'handbook': - if($subKey !== 'url') return null; - $handbookUrl = $this->config->getAppValue('handbook/url', self::SERVER_MANUAL_URL); + if($subKey === 'url') { + $handbookUrl = $this->config->getAppValue('handbook/url', self::SERVER_MANUAL_URL); + } else if($subKey === 'url.web') { + $handbookUrl = $this->config->getAppValue('handbook/url/web', self::SERVER_MANUAL_URL_WEB); + } else { + return null; + } return empty($handbookUrl) ? self::SERVER_MANUAL_URL:$handbookUrl; } @@ -106,12 +113,13 @@ public function get(string $key) { public function list(): array { return array_merge( [ - 'server.baseUrl' => $this->get('baseUrl'), - 'server.baseUrl.webdav' => $this->get('baseUrl.webdav'), - 'server.version' => $this->get('version'), - 'server.app.version' => $this->get('app.version'), - 'server.handbook.url' => $this->get('handbook.url'), - 'server.performance' => $this->get('performance') + 'server.baseUrl' => $this->get('baseUrl'), + 'server.baseUrl.webdav' => $this->get('baseUrl.webdav'), + 'server.version' => $this->get('version'), + 'server.app.version' => $this->get('app.version'), + 'server.handbook.url' => $this->get('handbook.url'), + 'server.handbook.url.web' => $this->get('handbook.url.web'), + 'server.performance' => $this->get('performance') ], $this->themeSettings->list(), $this->shareSettings->list() diff --git a/src/scss/Partials/_compatibility.scss b/src/scss/Partials/_compatibility.scss index 47da92626..1212144d4 100644 --- a/src/scss/Partials/_compatibility.scss +++ b/src/scss/Partials/_compatibility.scss @@ -76,7 +76,7 @@ margin : 0 auto; padding : 25px 0; font-size : 1.25rem; - width : 600px; + width : 800px; a { display : block;