From 05a40e0a3bc072fa2c396d34de3761d2d3f413b3 Mon Sep 17 00:00:00 2001 From: rio- Date: Mon, 17 Sep 2018 11:58:52 +0200 Subject: [PATCH 01/11] Add input field for WebSocket path, resolves #1008 --- index.html | 2 ++ js/bufferResume.js | 2 +- js/connection.js | 6 +++--- js/glowingbear.js | 6 ++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 09eaa07..374ef52 100644 --- a/index.html +++ b/index.html @@ -111,6 +111,8 @@ + +
diff --git a/js/bufferResume.js b/js/bufferResume.js index 1af4f4e..536e715 100644 --- a/js/bufferResume.js +++ b/js/bufferResume.js @@ -11,7 +11,7 @@ var bufferResume = angular.module('bufferResume', []); bufferResume.service('bufferResume', ['settings', function(settings) { var resumer = {}; - var key = settings.host + ":" + settings.port; + var key = settings.host + ":" + settings.port + "/" + settings.path; // Hold the status that we were able to find the previously accessed buffer // and reload it. If we cannot, we'll need to know so we can load the default diff --git a/js/connection.js b/js/connection.js index 3f0933d..1347551 100644 --- a/js/connection.js +++ b/js/connection.js @@ -20,15 +20,15 @@ weechat.factory('connection', var locked = false; // Takes care of the connection and websocket hooks - var connect = function (host, port, passwd, ssl, noCompression, successCallback, failCallback) { + var connect = function (host, port, path, passwd, ssl, noCompression, successCallback, failCallback) { $rootScope.passwordError = false; - connectionData = [host, port, passwd, ssl, noCompression]; + connectionData = [host, port, path, passwd, ssl, noCompression]; var proto = ssl ? 'wss' : 'ws'; // If host is an IPv6 literal wrap it in brackets if (host.indexOf(":") !== -1 && host[0] !== "[" && host[host.length-1] !== "]") { host = "[" + host + "]"; } - var url = proto + "://" + host + ":" + port + "/weechat"; + var url = proto + "://" + host + ":" + port + "/" + path; $log.debug('Connecting to URL: ', url); var onopen = function () { diff --git a/js/glowingbear.js b/js/glowingbear.js index 717831f..a0073be 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -43,6 +43,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', 'theme': 'dark', 'host': 'localhost', 'port': 9001, + 'path': 'weechat', 'ssl': (window.location.protocol === "https:"), 'savepassword': false, 'autoconnect': false, @@ -665,7 +666,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, $scope.password, settings.ssl); + connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl); }; $scope.disconnect = function() { $scope.connectbutton = 'Connect'; @@ -933,6 +934,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', var spl = rawStr.split(":"); var host = spl[0]; var port = parseInt(spl[1]); + var path = 'weechat'; var password = spl[2]; var ssl = spl.length > 3; notifications.requestNotificationPermission(); @@ -942,7 +944,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $rootScope.bufferBottom = true; $scope.connectbutton = 'Connecting'; $scope.connectbuttonicon = 'glyphicon-chevron-right'; - connection.connect(host, port, password, ssl); + connection.connect(host, port, path, password, ssl); } }; From 3fe1b0fdfb5510d920fe54fd6bdcd3df05977f0e Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Sun, 15 Dec 2019 02:47:55 +0100 Subject: [PATCH 02/11] Add feature to set port and path in the host field --- css/glowingbear.css | 4 ++++ index.html | 10 ++++++---- js/glowingbear.js | 44 +++++++++++++++++++++++++++++++++++++++----- 3 files changed, 49 insertions(+), 9 deletions(-) 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 @@
- +
- +
- -
@@ -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); } }; 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)
  • +
From 38862453758fceb71da5d2d262d6acd50d12c772 Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Mon, 16 Dec 2019 13:51:53 +0100 Subject: [PATCH 06/11] Add validation for the host field --- css/themes/base16-default.css | 3 +++ css/themes/dark.css | 3 +++ css/themes/light.css | 3 +++ index.html | 4 ++-- js/glowingbear.js | 13 +++++++------ 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/css/themes/base16-default.css b/css/themes/base16-default.css index ec40fcb..dea026f 100644 --- a/css/themes/base16-default.css +++ b/css/themes/base16-default.css @@ -301,6 +301,9 @@ tr.bufferline:hover { input[type=text], input[type=password], #sendMessage, .badge { box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.1), 0px 1px 7px 0px rgba(0, 0, 0, 0.2) inset; } +input[type=text].is-invalid{ + box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.1), 0px 1px 7px 0px rgba(255, 0, 0, 0.6) inset; +} input[type=text], input[type=password], #sendMessage, .btn-send, .btn-send-image, .btn-complete-nick { color: var(--base05); diff --git a/css/themes/dark.css b/css/themes/dark.css index da260c8..7e79db3 100644 --- a/css/themes/dark.css +++ b/css/themes/dark.css @@ -86,6 +86,9 @@ input[type=text], input[type=password], #sendMessage, .badge, .btn-send, .btn-se color: #ccc; background: none repeat scroll 0% 0% rgba(0, 0, 0, 0.3); } +input[type=text].is-invalid{ + box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.1), 0px 1px 7px 0px rgba(255, 0, 0, 0.8) inset; +} .btn-complete-nick:hover, .btn-complete-nick:focus, .btn-send:hover, .btn-send:focus, diff --git a/css/themes/light.css b/css/themes/light.css index be8012e..323e6c8 100644 --- a/css/themes/light.css +++ b/css/themes/light.css @@ -68,6 +68,9 @@ select.form-control, select option, input[type=text], input[type=password], #sen box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1), 0px 1px 7px 0px rgba(255, 255, 255, 0.8) inset; background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.3); } +input[type=text].is-invalid{ + box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1), 0px 1px 7px 0px rgba(255, 0, 0, 0.8) inset; +} #connection-infos { color: #aaa; diff --git a/index.html b/index.html index 3505dc3..8491b70 100644 --- a/index.html +++ b/index.html @@ -104,7 +104,7 @@
- +
@@ -136,7 +136,7 @@
- +
diff --git a/js/glowingbear.js b/js/glowingbear.js index 58f6d14..fe9e075 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -663,31 +663,32 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', //If host is specified here the dedicated port field is disabled var parts; + $rootScope.hostInvalid = false; //host var regexHost = /^([^:\/]*|\[.*\])$/; var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/; var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/; - if((parts = regexHost.exec(settings.host)) !== null) - { + if((parts = regexHost.exec(settings.host)) !== null) { settings.hostOnly = parts[1]; $rootScope.portDisabled = false; } //host:port - else if((parts = regexHostPort.exec(settings.host)) !== null) - { + 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)) !== null) - { + else if((parts = regexHostPortPath.exec(settings.host)) !== null) { settings.hostOnly = parts[1]; settings.port = parts[2]; settings.path = parts[3]; $rootScope.portDisabled = true; } + else { + $rootScope.hostInvalid = true; + } }; From 9dbd55443a97c0dccba079fcba42b2fed977cc95 Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Mon, 16 Dec 2019 14:21:11 +0100 Subject: [PATCH 07/11] Changed hostOnly to host and host to hostField --- index.html | 2 +- js/glowingbear.js | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 8491b70..e30e596 100644 --- a/index.html +++ b/index.html @@ -104,7 +104,7 @@
- +
diff --git a/js/glowingbear.js b/js/glowingbear.js index fe9e075..cd01531 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -41,7 +41,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // or else they won't be saved to the localStorage. settings.setDefaults({ 'theme': 'dark', - 'host': 'localhost', + 'hostField': 'localhost', 'port': 9001, 'path': 'weechat', 'ssl': (window.location.protocol === "https:"), @@ -66,6 +66,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', }); $scope.settings = settings; + //For upgrade reasons because we changed the name of host to hostField + //check if the value might still be in the host key instead of the hostField key + if (!settings.hostFieldv && settings.host) { + settings.hostField = settings.host; + } + $rootScope.countWatchers = function () { $log.debug($rootScope.$$watchersCount); }; @@ -658,30 +664,31 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', }; $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 - var parts; + $rootScope.hostInvalid = false; //host var regexHost = /^([^:\/]*|\[.*\])$/; var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/; var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/; - if((parts = regexHost.exec(settings.host)) !== null) { - settings.hostOnly = parts[1]; + if((parts = regexHost.exec(settings.hostField)) !== null) { + settings.host = parts[1]; $rootScope.portDisabled = false; } //host:port - else if((parts = regexHostPort.exec(settings.host)) !== null) { - settings.hostOnly = parts[1]; + else if((parts = regexHostPort.exec(settings.hostField)) !== null) { + settings.host = parts[1]; settings.port = parts[2]; $rootScope.portDisabled = true; } //host:port/path - else if((parts = regexHostPortPath.exec(settings.host)) !== null) { - settings.hostOnly = parts[1]; + else if((parts = regexHostPortPath.exec(settings.hostField)) !== null) { + settings.host = parts[1]; settings.port = parts[2]; settings.path = parts[3]; $rootScope.portDisabled = true; @@ -700,7 +707,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $rootScope.bufferBottom = true; $scope.connectbutton = 'Connecting'; $scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin'; - connection.connect(settings.hostOnly, settings.port, settings.path, $scope.password, settings.ssl); + connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl); }; $scope.disconnect = function() { $scope.connectbutton = 'Connect'; From 8779e66900880c0c41bc03b4d2e1227d20548e6a Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Mon, 16 Dec 2019 14:39:46 +0100 Subject: [PATCH 08/11] Have different gb colors for disabled inputs --- css/themes/base16-default.css | 4 ++++ css/themes/dark.css | 4 ++++ css/themes/light.css | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/css/themes/base16-default.css b/css/themes/base16-default.css index dea026f..b30a08a 100644 --- a/css/themes/base16-default.css +++ b/css/themes/base16-default.css @@ -65,6 +65,10 @@ a:visited:hover, a:visited:active, a:visited:focus { border: 0px none; } +.form-control[disabled] { + background: var(--base03); +} + .form-control:focus { color: var(--base06); box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.1), 0px 1px 7px 0px rgba(0, 0, 0, 0.2) inset; diff --git a/css/themes/dark.css b/css/themes/dark.css index 7e79db3..b6d1a08 100644 --- a/css/themes/dark.css +++ b/css/themes/dark.css @@ -10,6 +10,10 @@ body { border: 0px none; } +.form-control[disabled] { + background: none repeat scroll 0% 0% rgba(63, 63, 63, 0.3); +} + .form-control option { color: #eee; background: #282828; diff --git a/css/themes/light.css b/css/themes/light.css index 323e6c8..31a2368 100644 --- a/css/themes/light.css +++ b/css/themes/light.css @@ -68,6 +68,11 @@ select.form-control, select option, input[type=text], input[type=password], #sen box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1), 0px 1px 7px 0px rgba(255, 255, 255, 0.8) inset; background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.3); } + +.form-control[disabled] { + background: none repeat scroll 0% 0% rgba(134, 134, 134, 0.3); +} + input[type=text].is-invalid{ box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1), 0px 1px 7px 0px rgba(255, 0, 0, 0.8) inset; } From 5a5927104de634d3d82595d72a294369cd96bbd4 Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Mon, 16 Dec 2019 15:26:17 +0100 Subject: [PATCH 09/11] Code style --- js/glowingbear.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index cd01531..48b9301 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -610,7 +610,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } return connection.fetchMoreLines(numLines); }; - + $scope.infiniteScroll = function() { // Check if we are already fetching if ($rootScope.loadingLines) { @@ -630,6 +630,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } $rootScope.bufferBottom = eob.offsetTop <= bl.scrollTop + bl.clientHeight; }; + $rootScope.scrollWithBuffer = function(scrollToReadmarker, moreLines) { // First, get scrolling status *before* modification // This is required to determine where we were in the buffer pre-change @@ -664,39 +665,31 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', }; $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 - var parts; - $rootScope.hostInvalid = false; - //host + var parts; var regexHost = /^([^:\/]*|\[.*\])$/; var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/; var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/; - if((parts = regexHost.exec(settings.hostField)) !== null) { + + if ((parts = regexHost.exec(settings.hostField)) !== null) { //host only settings.host = parts[1]; $rootScope.portDisabled = false; - } - //host:port - else if((parts = regexHostPort.exec(settings.hostField)) !== null) { + } else if ((parts = regexHostPort.exec(settings.hostField)) !== null) { //host:port settings.host = parts[1]; settings.port = parts[2]; $rootScope.portDisabled = true; - } - //host:port/path - else if((parts = regexHostPortPath.exec(settings.hostField)) !== null) { + } else if ((parts = regexHostPortPath.exec(settings.hostField)) !== null) { //host:port/path settings.host = parts[1]; settings.port = parts[2]; settings.path = parts[3]; $rootScope.portDisabled = true; - } - else { + } else { $rootScope.hostInvalid = true; } - }; $scope.connect = function() { @@ -709,12 +702,14 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin'; connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl); }; + $scope.disconnect = function() { $scope.connectbutton = 'Connect'; $scope.connectbuttonicon = 'glyphicon-chevron-right'; bufferResume.reset(); connection.disconnect(); }; + $scope.reconnect = function() { var bufferId = models.getActiveBuffer().id; connection.attemptReconnect(bufferId, 3000); @@ -723,6 +718,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.showModal = function(elementId) { document.getElementById(elementId).setAttribute('data-state', 'visible'); }; + $scope.closeModal = function($event) { function closest(elem, selector) { var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; From 0823a417f2b26d698c8bea2e4f4260d95cf89e10 Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Mon, 16 Dec 2019 17:22:20 +0100 Subject: [PATCH 10/11] Reset path to weechat if not filled in. --- js/glowingbear.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 48b9301..b216d1b 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -610,7 +610,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } return connection.fetchMoreLines(numLines); }; - + $scope.infiniteScroll = function() { // Check if we are already fetching if ($rootScope.loadingLines) { @@ -677,10 +677,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', if ((parts = regexHost.exec(settings.hostField)) !== null) { //host only settings.host = parts[1]; + settings.path = "weechat"; $rootScope.portDisabled = false; } else if ((parts = regexHostPort.exec(settings.hostField)) !== null) { //host:port settings.host = parts[1]; settings.port = parts[2]; + settings.path = "weechat"; $rootScope.portDisabled = true; } else if ((parts = regexHostPortPath.exec(settings.hostField)) !== null) { //host:port/path settings.host = parts[1]; From 75114a455c5de01c81a7079ae26cf62cb04122c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Tue, 17 Dec 2019 10:52:34 +0100 Subject: [PATCH 11/11] Fix typo --- js/glowingbear.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index b216d1b..e706815 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -68,7 +68,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', //For upgrade reasons because we changed the name of host to hostField //check if the value might still be in the host key instead of the hostField key - if (!settings.hostFieldv && settings.host) { + if (!settings.hostField && settings.host) { settings.hostField = settings.host; }