Add support for multiple announce servers (fixes #677)

Somebody owes me a beer.
This commit is contained in:
Audrius Butkevicius
2014-11-18 22:57:21 +00:00
committed by Jakob Borg
parent 78981862be
commit fd2d2c035e
9 changed files with 162 additions and 80 deletions

View File

@@ -245,7 +245,8 @@ angular.module('syncthing.core')
var hasConfig = !isEmptyObject($scope.config);
$scope.config = config;
$scope.config.Options.ListenStr = $scope.config.Options.ListenAddress.join(', ');
$scope.config.Options.ListenAddressStr = $scope.config.Options.ListenAddress.join(', ');
$scope.config.Options.GlobalAnnServersStr = $scope.config.Options.GlobalAnnServers.join(', ');
$scope.devices = $scope.config.Devices;
$scope.devices.forEach(function (deviceCfg) {
@@ -272,6 +273,14 @@ angular.module('syncthing.core')
$http.get(urlbase + '/system').success(function (data) {
$scope.myID = data.myID;
$scope.system = data;
$scope.announceServersTotal = Object.keys(data.extAnnounceOK).length;
var failed = [];
for (var server in data.extAnnounceOK) {
if (!data.extAnnounceOK[server]) {
failed.push(server);
}
}
$scope.announceServersFailed = failed;
console.log("refreshSystem", data);
});
}
@@ -599,8 +608,11 @@ angular.module('syncthing.core')
$scope.thisDevice().Name = $scope.tmpOptions.DeviceName;
$scope.config.Options = angular.copy($scope.tmpOptions);
$scope.config.GUI = angular.copy($scope.tmpGUI);
$scope.config.Options.ListenAddress = $scope.config.Options.ListenStr.split(',').map(function (x) {
return x.trim();
['ListenAddress', 'GlobalAnnServers'].forEach(function (key) {
$scope.config.Options[key] = $scope.config.Options[key + "Str"].split(/[ ,]+/).map(function (x) {
return x.trim();
});
});
$scope.saveConfig();