Making short deviceID length consistent and referencing to protocol file for future-proof edits. Closes #9313.
This commit is contained in:
@@ -18,6 +18,9 @@ var syncthing = angular.module('syncthing', [
|
||||
var urlbase = 'rest';
|
||||
var authUrlbase = urlbase + '/noauth/auth';
|
||||
|
||||
// keep consistent with ShortIDStringLength in lib/protocol/deviceid.go
|
||||
var shortIDStringLength = 7;
|
||||
|
||||
syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvider) {
|
||||
// language and localisation
|
||||
|
||||
|
||||
@@ -1460,7 +1460,7 @@ angular.module('syncthing.core')
|
||||
|
||||
$scope.friendlyNameFromShort = function (shortID) {
|
||||
var matches = Object.keys($scope.devices).filter(function (id) {
|
||||
return id.substr(0, 7) === shortID;
|
||||
return id.substr(0, shortIDStringLength) === shortID;
|
||||
});
|
||||
if (matches.length !== 1) {
|
||||
return shortID;
|
||||
@@ -1473,7 +1473,7 @@ angular.module('syncthing.core')
|
||||
if (match) {
|
||||
return $scope.deviceName(match);
|
||||
}
|
||||
return deviceID.substr(0, 6);
|
||||
return deviceID.substr(0, shortIDStringLength);
|
||||
};
|
||||
|
||||
$scope.deviceName = function (deviceCfg) {
|
||||
@@ -1490,7 +1490,7 @@ angular.module('syncthing.core')
|
||||
if (typeof deviceID === 'undefined') {
|
||||
return "";
|
||||
}
|
||||
return deviceID.substr(0, 6);
|
||||
return deviceID.substr(0, shortIDStringLength);
|
||||
};
|
||||
|
||||
$scope.thisDeviceName = function () {
|
||||
@@ -1501,7 +1501,7 @@ angular.module('syncthing.core')
|
||||
if (device.name) {
|
||||
return device.name;
|
||||
}
|
||||
return device.deviceID.substr(0, 6);
|
||||
return device.deviceID.substr(0, shortIDStringLength);
|
||||
};
|
||||
|
||||
$scope.showDeviceIdentification = function (deviceCfg) {
|
||||
|
||||
Reference in New Issue
Block a user