diff --git a/css/glowingbear.css b/css/glowingbear.css
index 6dc1524..7b1651d 100644
--- a/css/glowingbear.css
+++ b/css/glowingbear.css
@@ -931,4 +931,8 @@ code {
padding: 0px 2px;
color: #444;
border: 1pt solid #444;
+}
+
+.form-control[disabled] {
+ background-color: #555;
}
\ No newline at end of file
diff --git a/index.html b/index.html
index 374ef52..df97f76 100644
--- a/index.html
+++ b/index.html
@@ -104,15 +104,13 @@
- WebSocket path
-
WeeChat relay password
@@ -209,6 +207,10 @@ chown -R
username :
username ~
username
Helpful trigger to automatically repin a buffer (in this instance, irc.freenode.#weechat ):
/trigger add autopin signal "buffer_opened" "${buffer[${tg_signal_data}].full_name} =~ irc.freenode.#weechat " "" "/command -buffer ${buffer[${tg_signal_data}].full_name} * /buffer set localvar_set_pinned true"
+ Setting path
+
+ The path is by default 'weechat'. In case a proxy is used the path can be changed by entering it in the host field. For example your.domain.com:8000/otherpath
.
+
diff --git a/js/glowingbear.js b/js/glowingbear.js
index a0073be..eb80eb5 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -657,6 +657,39 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
window.requestAnimationFrame(scroll);
};
+ $scope.parseHost = function() {
+ //The host field is multi purpose for advanced users
+ //There can be a combination of host, port and path
+ //If host is specified here the dedicated port field is disabled
+
+ let parts;
+
+ //host
+ const regexHost = /^([^:\/]*|\[.*\])$/;
+ const regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
+ const regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/;
+ if(parts = regexHost.exec(settings.host))
+ {
+ settings.hostOnly = parts[1];
+ $rootScope.portDisabled = false;
+ }
+ //host:port
+ else if(parts = regexHostPort.exec(settings.host))
+ {
+ settings.hostOnly = parts[1];
+ settings.port = parts[2];
+ $rootScope.portDisabled = true;
+ }
+ //host:port/path
+ else if(parts = regexHostPortPath.exec(settings.host))
+ {
+ settings.hostOnly = parts[1];
+ settings.port = parts[2];
+ settings.path = parts[3];
+ $rootScope.portDisabled = true;
+ }
+
+ };
$scope.connect = function() {
notifications.requestNotificationPermission();
@@ -666,7 +699,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.bufferBottom = true;
$scope.connectbutton = 'Connecting';
$scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin';
- connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl);
+ connection.connect(settings.hostOnly, settings.port, settings.path, $scope.password, settings.ssl);
};
$scope.disconnect = function() {
$scope.connectbutton = 'Connect';
@@ -928,13 +961,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
};
$scope.init = function() {
+ $scope.parseHost();
if (window.location.hash) {
var rawStr = atob(window.location.hash.substring(1));
window.location.hash = "";
var spl = rawStr.split(":");
- var host = spl[0];
- var port = parseInt(spl[1]);
- var path = 'weechat';
+ settings.host = spl[0];
+ settings.port = parseInt(spl[1]);
var password = spl[2];
var ssl = spl.length > 3;
notifications.requestNotificationPermission();
@@ -944,7 +977,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.bufferBottom = true;
$scope.connectbutton = 'Connecting';
$scope.connectbuttonicon = 'glyphicon-chevron-right';
- connection.connect(host, port, path, password, ssl);
+ $scope.parseHost();
+ connection.connect(settings.host, settings.port, settings.path, password, ssl);
}
};