WebApp - Rocket.Chat Plugin
-
@fbartels
Thank you -
Your plugin ist not working for me. When i click on the RocketChat link i get an error 400: Rocket.Chat - Serverside Error
Received non-JSON response from https://rocketchat.xxx.local/api/v1/loginWith curl on the same machine API Login works and returns a valid JSON.
On the rocketchat server i just see the fowllowing in the nging log:
[23/Jun/2020:10:00:56 +0000] "POST /api/v1/login HTTP/1.0" 400 182 "-" "-" [23/Jun/2020:10:01:26 +0000] "POST /api/v1/login HTTP/1.0" 400 182 "-" "-" [23/Jun/2020:10:01:33 +0000] "POST /api/v1/login HTTP/1.0" 400 182 "-" "-"
Any ideas? Rocketchat is running with NGINX reverse proxy.
-
I think i found the error. I always set PLUGIN_RCHAT_HOST to https://my.chat.server instead of my.chat.server. But in module.rchat.php i found this line:
$res = $this->sendPost('https://' . PLUGIN_RCHAT_HOST . '/' . (defined('PLUGIN_RCHAT_PATH') ? PLUGIN_RCHAT_PATH : '') . 'api/v1/login', array('user' => $this->username, 'password' => $this->password));
So i removed https:// in my plugin config. Still not working. So i checked plugin.rchat.php and there https:// was missing.
function injectPluginSettings(&$data) { $defaultIcon = PATH_PLUGIN_DIR . '/rchat/resources/icons/icon_default.png'; $pluginData = array( 'enable' => PLUGIN_RCHAT_USER_DEFAULT_ENABLE, 'button-title' => PLUGIN_RCHAT_BUTTON_TITLE, - 'url' => 'PLUGIN_RCHAT_HOST . '/' . (defined('PLUGIN_RCHAT_PATH') ? PLUGIN_RCHAT_PATH : ''), + 'url' => 'https://'.PLUGIN_RCHAT_HOST . '/' . (defined('PLUGIN_RCHAT_PATH') ? PLUGIN_RCHAT_PATH : ''), 'autostart' => defined('PLUGIN_RCHAT_AUTOSTART') ? !!PLUGIN_RCHAT_AUTOSTART : false, 'icon' => defined('PLUGIN_RCHAT_ICON') ? PATH_PLUGIN_DIR. '/rchat/' . PLUGIN_RCHAT_ICON : $defaultIcon );
Maybe PLUGIN_RCHAT_HOST should contain the whole url with http(s)://
-
Also working when you set PLUGIN_RCHAT_HOST to https://my.chat.server and change
$res = $this->sendPost('https://' . PLUGIN_RCHAT_HOST . '/' . (defined('PLUGIN_RCHAT_PATH') ? PLUGIN_RCHAT_PATH : '') . 'api/v1/login', array('user' => $this->username, 'password' => $this->password));
to
$res = $this->sendPost(PLUGIN_RCHAT_HOST . '/' . (defined('PLUGIN_RCHAT_PATH') ? PLUGIN_RCHAT_PATH : '') . 'api/v1/login', array('user' => $this->username, 'password' => $this->password));
and comment out
# 'header' => 'Host: ' . PLUGIN_RCHAT_HOST,
Also working for me.
-
Hi @TheChief79 ,
Thanks for your detailed analysis of the problem you encountered.
The reasons why the https:// is hardcoded, were the following:- If your rocket.chat installation is not reachable via https, but your WebApp is, you will not be able the open the tab anyhow, since modern browsers security policy do not permit opening insecure pages in iframes inside of secure pages.
In DeskApp it will still work though, since its not iframes used there, but i’d still recommend SSL encryption.
(And if WebApp is not SSL encrypted, there’s definitely something wrong tbh) - To make it easier on myself to add the proper host-header, which apparently is not required since it works for you even without it behind a proxy, i guess php already adds it itself.
Also about the missing https:// in plugin.rchat.php:
I rechecked my source, and all the .deb files available for download and nowhere is the https is missing.
Could you maybe have removed it earlier in you debugging process and forgot?I’ll add the option for the chatserver hostname to work with added http(s):// protocol, and if it is not set add it.
I’ll do some tests about the host-header beforehand though (and remove it if its really not required), and hopefully be able to implement the following planned features:- Cache the rocket.chat session in the WebApp settings, and reuse it if its still valid, so you don’t get a new session everytime (This apparently invalidates other sessions (in your browser for example) if they were not active in some time)
- Make the desktop notifications when clicked automatically focus the chat-tab (and eventually even the right channel, if possible) in WebApp, instead of only the browser/DeskApp.
Kind regards, geri
- If your rocket.chat installation is not reachable via https, but your WebApp is, you will not be able the open the tab anyhow, since modern browsers security policy do not permit opening insecure pages in iframes inside of secure pages.
-
Thank you for your answer.
It could be that i removed https:// by myself while debugging my problem and i understand your explanation. I re-checked your lates .deb and there in both files the “https://” is present. So it seems to be ok. I will re-test with your debs and a clean install of your plugin.
Thanks for your help.
-
After installing this PlugIn, the Threema PlugIn didn’t work anymore :(
-
@onex-de said in WebApp - Rocket.Chat Plugin:
Threema
Would you like to use Threema in addition to Rocket.Chat?
-
Hi @robsie,
the plugin worked great for me/us until a few weeks ago. Then in Rocket.Chat the channellist on the left side is empty (see picture).
Any ideas on how to fix this?- Kopano 8.7.25, Webapp 5.3 runnig on Univention 4.4
- RC 4.8.1 Enterprise Snap
Any help is kindly appreciated :)
Kind regards,
Marco
-
Hi @mhope ,
this seems to be an issue with recent versions of rocket.chat when viewed in outdated browsers.
I had this happen to me too, when trying to open it in an ancient version of opera, even without the kopano plugin (looked exactly like your screenshot).
You could still open channels using the search, but the list was broken.Kind regards,
Geri