Add input field for WebSocket path, resolves #1008
This commit is contained in:
parent
81ef304ad7
commit
05a40e0a3b
@ -111,6 +111,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="control-label" for="path">WebSocket path</label>
|
||||
<input type="text" class="form-control favorite-font" id="path" ng-model="settings.path" placeholder="WebSocket path">
|
||||
<label class="control-label" for="password">WeeChat relay password</label>
|
||||
<input type="password" class="form-control favorite-font" id="password" ng-model="password" placeholder="Password">
|
||||
<div class="alert alert-danger" ng-show="passwordError" ng-cloak>
|
||||
|
@ -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
|
||||
|
@ -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 () {
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user