diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 2fee612af..ffed6a1ff 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -386,15 +386,7 @@ angular.module('syncthing.core') }); }); - // If we're not listening on localhost, and there is no - // authentication configured, and the magic setting to silence the - // warning isn't set, then yell at the user. - var guiCfg = $scope.config.gui; - $scope.openNoAuth = guiCfg.address.substr(0, 4) !== "127." - && guiCfg.address.substr(0, 6) !== "[::1]:" - && (!guiCfg.user || !guiCfg.password) - && guiCfg.authMode !== 'ldap' - && !guiCfg.insecureAdminAccess; + refreshNoAuthWarning(); if (!hasConfig) { $scope.$emit('ConfigLoaded'); @@ -427,10 +419,32 @@ angular.module('syncthing.core') } } $scope.discoveryFailed = discoveryFailed; + + refreshNoAuthWarning(); + console.log("refreshSystem", data); }).error($scope.emitHTTPError); } + function refreshNoAuthWarning() { + if (!$scope.system || !$scope.config) { + // We need both to be able to determine the state. + return + } + + // If we're not listening on localhost, and there is no + // authentication configured, and the magic setting to silence the + // warning isn't set, then yell at the user. + var addr = $scope.system.guiAddressUsed; + var guiCfg = $scope.config.gui; + $scope.openNoAuth = addr.substr(0, 4) !== "127." + && addr.substr(0, 6) !== "[::1]:" + && (!guiCfg.user || !guiCfg.password) + && guiCfg.authMode !== 'ldap' + && !guiCfg.insecureAdminAccess; + } + + function refreshDiscoveryCache() { $http.get(urlbase + '/system/discovery').success(function (data) { for (var device in data) { diff --git a/lib/api/api.go b/lib/api/api.go index bbce4489c..11f085005 100644 --- a/lib/api/api.go +++ b/lib/api/api.go @@ -913,6 +913,7 @@ func (s *service) getSystemStatus(w http.ResponseWriter, r *http.Request) { res["uptime"] = s.urService.UptimeS() res["startTime"] = ur.StartTime res["guiAddressOverridden"] = s.cfg.GUI().IsOverridden() + res["guiAddressUsed"] = s.cfg.GUI().Address() sendJSON(w, res) }