Changed hostOnly to host and host to hostField
This commit is contained in:
parent
3886245375
commit
9dbd55443a
@ -104,7 +104,7 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="row no-gutter">
|
<div class="row no-gutter">
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input type="text" class="form-control favorite-font" id="host" ng-model="settings.host" ng-change="parseHost()" ng-class="{'is-invalid': hostInvalid}" placeholder="Address" autocapitalize="off">
|
<input type="text" class="form-control favorite-font" id="host" ng-model="settings.hostField" ng-change="parseHost()" ng-class="{'is-invalid': hostInvalid}" placeholder="Address" autocapitalize="off">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<input type="text" class="form-control favorite-font" id="port" ng-model="settings.port" ng-disabled="portDisabled" placeholder="Port">
|
<input type="text" class="form-control favorite-font" id="port" ng-model="settings.port" ng-disabled="portDisabled" placeholder="Port">
|
||||||
|
@ -41,7 +41,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
// or else they won't be saved to the localStorage.
|
// or else they won't be saved to the localStorage.
|
||||||
settings.setDefaults({
|
settings.setDefaults({
|
||||||
'theme': 'dark',
|
'theme': 'dark',
|
||||||
'host': 'localhost',
|
'hostField': 'localhost',
|
||||||
'port': 9001,
|
'port': 9001,
|
||||||
'path': 'weechat',
|
'path': 'weechat',
|
||||||
'ssl': (window.location.protocol === "https:"),
|
'ssl': (window.location.protocol === "https:"),
|
||||||
@ -66,6 +66,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
});
|
});
|
||||||
$scope.settings = settings;
|
$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 () {
|
$rootScope.countWatchers = function () {
|
||||||
$log.debug($rootScope.$$watchersCount);
|
$log.debug($rootScope.$$watchersCount);
|
||||||
};
|
};
|
||||||
@ -658,30 +664,31 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.parseHost = function() {
|
$scope.parseHost = function() {
|
||||||
|
|
||||||
//The host field is multi purpose for advanced users
|
//The host field is multi purpose for advanced users
|
||||||
//There can be a combination of host, port and path
|
//There can be a combination of host, port and path
|
||||||
//If host is specified here the dedicated port field is disabled
|
//If host is specified here the dedicated port field is disabled
|
||||||
|
|
||||||
var parts;
|
var parts;
|
||||||
|
|
||||||
$rootScope.hostInvalid = false;
|
$rootScope.hostInvalid = false;
|
||||||
|
|
||||||
//host
|
//host
|
||||||
var regexHost = /^([^:\/]*|\[.*\])$/;
|
var regexHost = /^([^:\/]*|\[.*\])$/;
|
||||||
var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
|
var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/;
|
||||||
var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/;
|
var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/;
|
||||||
if((parts = regexHost.exec(settings.host)) !== null) {
|
if((parts = regexHost.exec(settings.hostField)) !== null) {
|
||||||
settings.hostOnly = parts[1];
|
settings.host = parts[1];
|
||||||
$rootScope.portDisabled = false;
|
$rootScope.portDisabled = false;
|
||||||
}
|
}
|
||||||
//host:port
|
//host:port
|
||||||
else if((parts = regexHostPort.exec(settings.host)) !== null) {
|
else if((parts = regexHostPort.exec(settings.hostField)) !== null) {
|
||||||
settings.hostOnly = parts[1];
|
settings.host = parts[1];
|
||||||
settings.port = parts[2];
|
settings.port = parts[2];
|
||||||
$rootScope.portDisabled = true;
|
$rootScope.portDisabled = true;
|
||||||
}
|
}
|
||||||
//host:port/path
|
//host:port/path
|
||||||
else if((parts = regexHostPortPath.exec(settings.host)) !== null) {
|
else if((parts = regexHostPortPath.exec(settings.hostField)) !== null) {
|
||||||
settings.hostOnly = parts[1];
|
settings.host = parts[1];
|
||||||
settings.port = parts[2];
|
settings.port = parts[2];
|
||||||
settings.path = parts[3];
|
settings.path = parts[3];
|
||||||
$rootScope.portDisabled = true;
|
$rootScope.portDisabled = true;
|
||||||
@ -700,7 +707,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||||||
$rootScope.bufferBottom = true;
|
$rootScope.bufferBottom = true;
|
||||||
$scope.connectbutton = 'Connecting';
|
$scope.connectbutton = 'Connecting';
|
||||||
$scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin';
|
$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.disconnect = function() {
|
||||||
$scope.connectbutton = 'Connect';
|
$scope.connectbutton = 'Connect';
|
||||||
|
Loading…
Reference in New Issue
Block a user