gui, lib/config: Add GUI user and password notification (fixes #4703) (#6536)

This commit is contained in:
Jędrzej Kula
2020-06-02 12:08:22 +02:00
committed by GitHub
parent b033c36b31
commit 28d5c84599
6 changed files with 47 additions and 3 deletions
+10 -1
View File
@@ -31,7 +31,7 @@ import (
const (
OldestHandledVersion = 10
CurrentVersion = 30
CurrentVersion = 31
MaxRescanIntervalS = 365 * 24 * 60 * 60
)
@@ -103,6 +103,8 @@ func New(myID protocol.DeviceID) Configuration {
cfg.Version = CurrentVersion
cfg.OriginalVersion = CurrentVersion
cfg.Options.UnackedNotificationIDs = []string{"authenticationUserAndPassword"}
util.SetDefaults(&cfg)
util.SetDefaults(&cfg.Options)
util.SetDefaults(&cfg.GUI)
@@ -418,6 +420,13 @@ nextPendingDevice:
}
if cfg.Options.UnackedNotificationIDs == nil {
cfg.Options.UnackedNotificationIDs = []string{}
} else if cfg.GUI.User != "" && cfg.GUI.Password != "" {
for i, key := range cfg.Options.UnackedNotificationIDs {
if key == "authenticationUserAndPassword" {
cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs[:i], cfg.Options.UnackedNotificationIDs[i+1:]...)
break
}
}
}
return nil
+1 -1
View File
@@ -67,7 +67,7 @@ func TestDefaultValues(t *testing.T) {
AlwaysLocalNets: []string{},
OverwriteRemoteDevNames: false,
TempIndexMinBlocks: 10,
UnackedNotificationIDs: []string{},
UnackedNotificationIDs: []string{"authenticationUserAndPassword"},
DefaultFolderPath: "~",
SetLowPriority: true,
CRURL: "https://crash.syncthing.net/newcrash",
+6
View File
@@ -25,6 +25,7 @@ import (
// update the config version. The order of migrations doesn't matter here,
// put the newest on top for readability.
var migrations = migrationSet{
{31, migrateToConfigV31},
{30, migrateToConfigV30},
{29, migrateToConfigV29},
{28, migrateToConfigV28},
@@ -85,6 +86,11 @@ func (m migration) apply(cfg *Configuration) {
cfg.Version = m.targetVersion
}
func migrateToConfigV31(cfg *Configuration) {
// Show a notification about setting User and Password
cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs, "authenticationUserAndPassword")
}
func migrateToConfigV30(cfg *Configuration) {
// The "max concurrent scans" option is now spelled "max folder concurrency"
// to be more general.
+1 -1
View File
@@ -1,4 +1,4 @@
<configuration version="29">
<configuration version="31">
<options>
<listenAddress>tcp://:23000</listenAddress>
<allowDelete>false</allowDelete>