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);
}
};
From f20f442b43c66fc88145fdf176acb5756f950b24 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Sun, 15 Dec 2019 03:31:46 +0100
Subject: [PATCH 03/11] Make js ES5 compliant so it would pass tests
---
js/glowingbear.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index eb80eb5..58f6d14 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -662,26 +662,26 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
//There can be a combination of host, port and path
//If host is specified here the dedicated port field is disabled
- let parts;
+ var parts;
//host
- const regexHost = /^([^:\/]*|\[.*\])$/;
- const regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
- const regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/;
- if(parts = regexHost.exec(settings.host))
+ var regexHost = /^([^:\/]*|\[.*\])$/;
+ var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
+ var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/;
+ if((parts = regexHost.exec(settings.host)) !== null)
{
settings.hostOnly = parts[1];
$rootScope.portDisabled = false;
}
//host:port
- else if(parts = regexHostPort.exec(settings.host))
+ else if((parts = regexHostPort.exec(settings.host)) !== null)
{
settings.hostOnly = parts[1];
settings.port = parts[2];
$rootScope.portDisabled = true;
}
//host:port/path
- else if(parts = regexHostPortPath.exec(settings.host))
+ else if((parts = regexHostPortPath.exec(settings.host)) !== null)
{
settings.hostOnly = parts[1];
settings.port = parts[2];
From 279b3870c6ac7ca78314a90ccbe4e054f05313a3 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Sun, 15 Dec 2019 03:41:53 +0100
Subject: [PATCH 04/11] Revert CSS change for disabled fields
---
css/glowingbear.css | 4 ----
1 file changed, 4 deletions(-)
diff --git a/css/glowingbear.css b/css/glowingbear.css
index 7b1651d..6dc1524 100644
--- a/css/glowingbear.css
+++ b/css/glowingbear.css
@@ -931,8 +931,4 @@ code {
padding: 0px 2px;
color: #444;
border: 1pt solid #444;
-}
-
-.form-control[disabled] {
- background-color: #555;
}
\ No newline at end of file
From 81148545e0de334f1d5115e59ac5df37a46377c0 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Mon, 16 Dec 2019 12:32:34 +0100
Subject: [PATCH 05/11] Fleshed out the instructions for setting a custom path
---
css/glowingbear.css | 1 -
index.html | 37 ++++++++++++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/css/glowingbear.css b/css/glowingbear.css
index 6dc1524..ca71b9f 100644
--- a/css/glowingbear.css
+++ b/css/glowingbear.css
@@ -610,7 +610,6 @@ h2 span, h2 small {
.panel[data-state=active] .panel-collapse {
transition: max-height 0.5s;
- max-height: 60em;
height: auto;
display: block;
}
diff --git a/index.html b/index.html
index df97f76..3505dc3 100644
--- a/index.html
+++ b/index.html
@@ -207,10 +207,41 @@ 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.
+
Setting a custom path
+
+ To connect to the weechat relay service we connect using a URL. A typical URL consists of 4 parts. {scheme}://{host}:{port}/{path}. The path can be changed by enterying the relay's full URL (except the scheme).
+
+
+
scheme: The scheme must never be input. The scheme is "ws" if TLS isn't used and it is "wss" if TLS is used.
+
host: Can be an IPv4, IPv6 or a FQDN. IPv6 addresses must be wrapped in square brackets.
+
port: can be specified in the host field or the seperate port field. However if the path is specified in the host field the port must also be specified.
+
path: by defautl this is "weechat". In case a proxy is used the path can be changed by entering it in the host field.
+
+
+ Examples of correct input for the host field are:
+
+
192.168.0.1
+
192.168.0.1:8000
+
192.168.0.1:8000/weechat2
+
[2001:db8:85a3::8a2e:370:7334]
+
[2001:db8:85a3::8a2e:370:7334]:8000
+
[2001:db8:85a3::8a2e:370:7334]:8000/weechat2
+
yourhost.yourdomain.com
+
yourhost.yourdomain.com:8000
+
yourhost.yourdomain.com:8000/weechat2
+
+
+ Incorrect input for the host field:
+
+
+
ws://192.168.0.1 (do not specify the scheme)
+
192.168.0.1/weechat2 (must specify port when specifying path)
+
[2001:db8:85a3::8a2e:370:7334]/weechat2 (must specify port when specifying path)
+
yourhost.yourdomain.com/weechat2 (must specify port when specifying path)
+
2001:db8:85a3::8a2e:370:7334 (must wrap IPv6 address in square brackets)
+
2001:db8:85a3::8a2e:370:7334:8000 (must wrap IPv6 address in square brackets)