From 910329c2e72b69485adb8639b2dd5bafe1d2777e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 19 Oct 2020 10:30:08 +0200 Subject: [PATCH] * Rocket.Chat: fix not working login with newer desktop clients there were two problems: 1. Whatever URL you specify, the client removes the path and queries just /, our index.php now detects Rocket.Chat User-Agent header and redirects to /rocketchat/ in that case 2. our manifest.json an webworker registration was not using the individual webserver-URL but as static path --- api/js/login.js | 2 +- index.php | 8 ++++++++ manifest.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/api/js/login.js b/api/js/login.js index eeb0ca12f3..14410dd2cc 100644 --- a/api/js/login.js +++ b/api/js/login.js @@ -77,7 +77,7 @@ egw_LAB.wait(function() // register service worker if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('./service-worker.js', {scope:"/egroupware/"}) + navigator.serviceWorker.register('./service-worker.js', {scope:egw_webserverUrl}) .then(function(registration) { console.log('Registration successful, scope is:', registration.scope); }) diff --git a/index.php b/index.php index 149895255e..2e7f26a04f 100755 --- a/index.php +++ b/index.php @@ -14,6 +14,14 @@ use EGroupware\Api; use EGroupware\Api\Framework; use EGroupware\Api\Egw; +// Rocket.Chat desktop clients ignore /rocketchat/ path in URL and use just / +// --> redirect them back to /rocketchat/ +if (strpos($_SERVER['HTTP_USER_AGENT'], 'Rocket.Chat') !== false) +{ + header('Location: /rocketchat/'); + exit; +} + // support of Mac or iPhone trying to autodetect CalDAV or CardDAV support // if EGroupware is not installed in the docroot, you need either this code in the index.php there, // or an uncoditional redirect to this file or copy groupdav.htaccess to your docroot as .htaccess diff --git a/manifest.json b/manifest.json index ef76a86da5..c67bc5c482 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "start_url": "index.php", "background_color": "#fafafa", "display": "standalone", - "scope": "/egroupware", + "scope": "/", "theme_color": "#0073ae", "serviceworker": { "src": "/service-worker.js"