diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index 85e1969f..88419048 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -1042,7 +1042,8 @@ func (s *apiService) getSystemUpgrade(w http.ResponseWriter, r *http.Request) { http.Error(w, upgrade.ErrUpgradeUnsupported.Error(), 500) return } - rel, err := upgrade.LatestRelease(s.cfg.Options().ReleasesURL, Version) + opts := s.cfg.Options() + rel, err := upgrade.LatestRelease(opts.ReleasesURL, Version, opts.UpgradeToPreReleases) if err != nil { http.Error(w, err.Error(), 500) return @@ -1083,7 +1084,8 @@ func (s *apiService) getLang(w http.ResponseWriter, r *http.Request) { } func (s *apiService) postSystemUpgrade(w http.ResponseWriter, r *http.Request) { - rel, err := upgrade.LatestRelease(s.cfg.Options().ReleasesURL, Version) + opts := s.cfg.Options() + rel, err := upgrade.LatestRelease(opts.ReleasesURL, Version, opts.UpgradeToPreReleases) if err != nil { l.Warnln("getting latest release:", err) http.Error(w, err.Error(), 500) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 26b6dbf6..a9da4ca4 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -481,8 +481,8 @@ func debugFacilities() string { func checkUpgrade() upgrade.Release { cfg, _ := loadConfig() - releasesURL := cfg.Options().ReleasesURL - release, err := upgrade.LatestRelease(releasesURL, Version) + opts := cfg.Options() + release, err := upgrade.LatestRelease(opts.ReleasesURL, Version, opts.UpgradeToPreReleases) if err != nil { l.Fatalln("Upgrade:", err) } @@ -1158,8 +1158,8 @@ func autoUpgrade(cfg *config.Wrapper) { l.Infof("Connected to device %s with a newer version (current %q < remote %q). Checking for upgrades.", data["id"], Version, data["clientVersion"]) case <-timer.C: } - - rel, err := upgrade.LatestRelease(cfg.Options().ReleasesURL, Version) + opts := cfg.Options() + rel, err := upgrade.LatestRelease(opts.ReleasesURL, Version, opts.UpgradeToPreReleases) if err == upgrade.ErrUpgradeUnsupported { events.Default.Unsubscribe(sub) return diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json index 97ce06cf..d1d31a90 100644 --- a/gui/default/assets/lang/lang-en.json +++ b/gui/default/assets/lang/lang-en.json @@ -26,6 +26,7 @@ "Be careful!": "Be careful!", "Bugs": "Bugs", "CPU Utilization": "CPU Utilization", + "Candidate releases": "Candidate releases", "Changelog": "Changelog", "Clean out after": "Clean out after", "Close": "Close", @@ -81,6 +82,7 @@ "GUI Authentication Password": "GUI Authentication Password", "GUI Authentication User": "GUI Authentication User", "GUI Listen Addresses": "GUI Listen Addresses", + "GUI Theme": "GUI Theme", "Generate": "Generate", "Global Changes": "Global Changes", "Global Discovery": "Global Discovery", @@ -120,6 +122,7 @@ "Newest First": "Newest First", "No": "No", "No File Versioning": "No File Versioning", + "No upgrades": "No upgrades", "Normal": "Normal", "Notice": "Notice", "OK": "OK", @@ -181,6 +184,7 @@ "Single level wildcard (matches within a directory only)": "Single level wildcard (matches within a directory only)", "Smallest First": "Smallest First", "Source Code": "Source Code", + "Stable releases only": "Stable releases only", "Staggered File Versioning": "Staggered File Versioning", "Start Browser": "Start Browser", "Statistics": "Statistics", @@ -234,6 +238,7 @@ "Upgrading": "Upgrading", "Upload Rate": "Upload Rate", "Uptime": "Uptime", + "Usage reporting is always enabled for candidate releases.": "Usage reporting is always enabled for candidate releases.", "Use HTTPS for GUI": "Use HTTPS for GUI", "Version": "Version", "Versions Path": "Versions Path", diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index de5d6a9d..3626cb9c 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1004,7 +1004,13 @@ angular.module('syncthing.core') $scope.tmpOptions = angular.copy($scope.config.options); $scope.tmpOptions.urEnabled = ($scope.tmpOptions.urAccepted > 0); $scope.tmpOptions.deviceName = $scope.thisDevice().name; - $scope.tmpOptions.autoUpgradeEnabled = ($scope.tmpOptions.autoUpgradeIntervalH > 0); + $scope.tmpOptions.upgrades = "none"; + if ($scope.tmpOptions.autoUpgradeIntervalH > 0) { + $scope.tmpOptions.upgrades = "stable"; + } + if ($scope.tmpOptions.upgradeToPreReleases) { + $scope.tmpOptions.upgrades = "candidate"; + } $scope.tmpGUI = angular.copy($scope.config.gui); $('#settings').modal(); }; @@ -1028,6 +1034,20 @@ angular.module('syncthing.core') var changed = !angular.equals($scope.config.options, $scope.tmpOptions) || !angular.equals($scope.config.gui, $scope.tmpGUI); var themeChanged = $scope.config.gui.theme !== $scope.tmpGUI.theme; if (changed) { + // Check if auto-upgrade has been enabled or disabled. This + // also has an effect on usage reporting, so do the check + // for that later. + if ($scope.tmpOptions.upgrades == "candidate") { + $scope.tmpOptions.autoUpgradeIntervalH = $scope.tmpOptions.autoUpgradeIntervalH || 12; + $scope.tmpOptions.upgradeToPreReleases = true; + $scope.tmpOptions.urEnabled = true; + } else if ($scope.tmpOptions.upgrades == "stable") { + $scope.tmpOptions.autoUpgradeIntervalH = $scope.tmpOptions.autoUpgradeIntervalH || 12; + $scope.tmpOptions.upgradeToPreReleases = false; + } else { + $scope.tmpOptions.autoUpgradeIntervalH = 0; + } + // Check if usage reporting has been enabled or disabled if ($scope.tmpOptions.urEnabled && $scope.tmpOptions.urAccepted <= 0) { $scope.tmpOptions.urAccepted = 1000; @@ -1035,13 +1055,6 @@ angular.module('syncthing.core') $scope.tmpOptions.urAccepted = -1; } - // Check if auto-upgrade has been enabled or disabled - if ($scope.tmpOptions.autoUpgradeEnabled) { - $scope.tmpOptions.autoUpgradeIntervalH = $scope.tmpOptions.autoUpgradeIntervalH || 12; - } else { - $scope.tmpOptions.autoUpgradeIntervalH = 0; - } - // Check if protocol will need to be changed on restart if ($scope.config.gui.useTLS !== $scope.tmpGUI.useTLS) { $scope.protocolChanged = true; diff --git a/gui/default/syncthing/settings/settingsModalView.html b/gui/default/syncthing/settings/settingsModalView.html index 9593347b..e114f175 100644 --- a/gui/default/syncthing/settings/settingsModalView.html +++ b/gui/default/syncthing/settings/settingsModalView.html @@ -107,19 +107,24 @@ +
+  Help + +
+
-
+
-
-
-
- -
+

+ Usage reporting is always enabled for candidate releases. (Preview) +


@@ -133,7 +138,7 @@
- +