gui: Add addresses for disconnected devices (fixes #3340)
Also fixes an issue where the discovery cache call would only return the newest cache entry for a given device instead of the merged addresses from all cache entries (which is more useful). GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3344
This commit is contained in:
committed by
Audrius Butkevicius
parent
b0d03d1f1c
commit
ac3b03881a
@@ -29,6 +29,7 @@ angular.module('syncthing.core')
|
||||
$scope.myID = '';
|
||||
$scope.devices = [];
|
||||
$scope.deviceRejections = {};
|
||||
$scope.discoveryCache = {};
|
||||
$scope.folderRejections = {};
|
||||
$scope.protocolChanged = false;
|
||||
$scope.reportData = {};
|
||||
@@ -85,6 +86,7 @@ angular.module('syncthing.core')
|
||||
console.log('UIOnline');
|
||||
|
||||
refreshSystem();
|
||||
refreshDiscoveryCache();
|
||||
refreshConfig();
|
||||
refreshConnectionStats();
|
||||
refreshDeviceStats();
|
||||
@@ -418,6 +420,22 @@ angular.module('syncthing.core')
|
||||
}).error($scope.emitHTTPError);
|
||||
}
|
||||
|
||||
function refreshDiscoveryCache() {
|
||||
$http.get(urlbase + '/system/discovery').success(function (data) {
|
||||
for (var device in data) {
|
||||
for (var i = 0; i < data[device].addresses.length; i++) {
|
||||
// Relay addresses are URLs with
|
||||
// .../?foo=barlongstuff that we strip away here. We
|
||||
// remove the final slash as well for symmetry with
|
||||
// tcp://192.0.2.42:1234 type addresses.
|
||||
data[device].addresses[i] = data[device].addresses[i].replace(/\/\?.*/, '');
|
||||
}
|
||||
}
|
||||
$scope.discoveryCache = data;
|
||||
console.log("refreshDiscoveryCache", data);
|
||||
}).error($scope.emitHTTPError);
|
||||
}
|
||||
|
||||
function recalcLocalStateTotal () {
|
||||
$scope.localStateTotal = {
|
||||
bytes: 0,
|
||||
@@ -609,6 +627,7 @@ angular.module('syncthing.core')
|
||||
|
||||
$scope.refresh = function () {
|
||||
refreshSystem();
|
||||
refreshDiscoveryCache();
|
||||
refreshConnectionStats();
|
||||
refreshErrors();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user