diff --git a/index.html b/index.html index 1ff63a9..a728587 100644 --- a/index.html +++ b/index.html @@ -45,6 +45,9 @@
Secure connection error A secure connection with the WeeChat relay could not be initiated. This is most likely because your browser does not trust your relay's certificate. Please read the encryption instructions below!
+
+ Secure connection error Unable to connect to unencrypted relay when your are connecting to Glowing Bear over HTTPS. Please use an encrypted relay or load the page without using HTTPS. +
diff --git a/js/glowingbear.js b/js/glowingbear.js index 5594461..e62109a 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -242,6 +242,7 @@ function($rootScope, var connect = function (host, port, passwd, ssl, noCompression) { var proto = ssl ? 'wss' : 'ws'; var url = proto + "://" + host + ":" + port + "/weechat"; + $log.debug('Connecting to URL: ', url); var onopen = function () { @@ -375,7 +376,8 @@ function($rootScope, }; - ngWebsockets.connect(url, + try { + ngWebsockets.connect(url, protocol, { 'binaryType': "arraybuffer", @@ -384,6 +386,12 @@ function($rootScope, 'onmessage': onmessage, 'onerror': onerror }); + }catch(e) { + $log.debug("Websocket caught DOMException:", e); + $rootScope.lastError = Date.now(); + $rootScope.errorMessage = true; + $rootScope.securityError = true; + } }; @@ -959,6 +967,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.connect = function() { $scope.requestNotificationPermission(); $rootScope.sslError = false; + $rootScope.securityError = false; $rootScope.errorMessage = false; connection.connect($scope.host, $scope.port, $scope.password, $scope.ssl); };