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/css/themes/base16-default.css b/css/themes/base16-default.css index ec40fcb..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; @@ -301,6 +305,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..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; @@ -86,6 +90,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..31a2368 100644 --- a/css/themes/light.css +++ b/css/themes/light.css @@ -69,6 +69,14 @@ select.form-control, select option, input[type=text], input[type=password], #sen 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; +} + #connection-infos { color: #aaa; } diff --git a/index.html b/index.html index 09eaa07..e30e596 100644 --- a/index.html +++ b/index.html @@ -104,10 +104,10 @@
- +
- +
@@ -136,7 +136,7 @@ - + @@ -207,6 +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 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). +

+ +

+ Examples of correct input for the host field are: +

+ +

+ Incorrect input for the host field: +

+ 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..e706815 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -41,8 +41,9 @@ 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:"), 'savepassword': false, 'autoconnect': false, @@ -65,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.hostField && settings.host) { + settings.hostField = settings.host; + } + $rootScope.countWatchers = function () { $log.debug($rootScope.$$watchersCount); }; @@ -623,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 @@ -656,6 +664,35 @@ 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 + $rootScope.hostInvalid = false; + + var parts; + var regexHost = /^([^:\/]*|\[.*\])$/; + var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/; + var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/; + + 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]; + settings.port = parts[2]; + settings.path = parts[3]; + $rootScope.portDisabled = true; + } else { + $rootScope.hostInvalid = true; + } + }; $scope.connect = function() { notifications.requestNotificationPermission(); @@ -665,14 +702,16 @@ 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'; $scope.connectbuttonicon = 'glyphicon-chevron-right'; bufferResume.reset(); connection.disconnect(); }; + $scope.reconnect = function() { var bufferId = models.getActiveBuffer().id; connection.attemptReconnect(bufferId, 3000); @@ -681,6 +720,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; @@ -927,12 +967,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]); + settings.host = spl[0]; + settings.port = parseInt(spl[1]); var password = spl[2]; var ssl = spl.length > 3; notifications.requestNotificationPermission(); @@ -942,7 +983,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $rootScope.bufferBottom = true; $scope.connectbutton = 'Connecting'; $scope.connectbuttonicon = 'glyphicon-chevron-right'; - connection.connect(host, port, password, ssl); + $scope.parseHost(); + connection.connect(settings.host, settings.port, settings.path, password, ssl); } };