From 7bcdc5b08ea3881987ca14ae4a63ddca7f295873 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 20 Sep 2019 11:02:43 +0200 Subject: [PATCH 1/2] docker: Build using Go 1.13 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8f3c1279..701681ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12 AS builder +FROM golang:1.13 AS builder WORKDIR /src COPY . . From c0b5a70ce34de815966c45cb2a05d5d8a6b58612 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 20 Sep 2019 15:22:24 +0100 Subject: [PATCH 2/2] gui, lib/api: Use effective listen address for no auth warning This adds a field `guiAddressUsed` to the system status response, that holds the current listening address actually in use. This may be different from the one stored in the config because it may have been overridden by environment or command line flag. The GUI now checks this field to see if we are listening on localhost. If we are not, the authentication required warning is displayed, regardless of the *configured* listening address. --- .../syncthing/core/syncthingController.js | 32 +++++++++++++------ lib/api/api.go | 1 + 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 2fee612a..ffed6a1f 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 bbce4489..11f08500 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) }