diff options
author | Jakob Borg <jakob@nym.se> | 2016-05-09 09:43:40 +0000 |
---|---|---|
committer | Audrius Butkevicius <audrius.butkevicius@gmail.com> | 2016-05-09 09:43:40 +0000 |
commit | 0761d804a48f0fc6e720392ee32c3446385026c9 (patch) | |
tree | e409e73d5ccdb2f5f476930c3b716a5e2abeee09 | |
parent | 3ad42d9279a49ba6ac5495b0127421f076e654fc (diff) |
cmd/syncthing: Use random folder ID for default folder, limit random charset
This uses the same charset as the Javascript code, excluding confusing
characters like 0, O, I, 1, l etc.
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3064
-rw-r--r-- | cmd/syncthing/main.go | 5 | ||||
-rw-r--r-- | lib/util/random.go | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index a34a39249d..af48ada26f 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -946,8 +946,9 @@ func defaultConfig(myName string) config.Configuration { if !noDefaultFolder { l.Infoln("Default folder created and/or linked to new config") - - defaultFolder = config.NewFolderConfiguration("default", locations[locDefFolder]) + folderID := util.RandomString(5) + "-" + util.RandomString(5) + defaultFolder = config.NewFolderConfiguration(folderID, locations[locDefFolder]) + defaultFolder.Label = "Default Folder (" + folderID + ")" defaultFolder.RescanIntervalS = 60 defaultFolder.MinDiskFreePct = 1 defaultFolder.Devices = []config.FolderDeviceConfiguration{{DeviceID: myID}} diff --git a/lib/util/random.go b/lib/util/random.go index 8b6c485fd7..21a37fde64 100644 --- a/lib/util/random.go +++ b/lib/util/random.go @@ -15,7 +15,7 @@ import ( ) // randomCharset contains the characters that can make up a randomString(). -const randomCharset = "01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" +const randomCharset = "2345679abcdefghijkmnopqrstuvwxyzACDEFGHJKLMNPQRSTUVWXYZ" func init() { // The default RNG should be seeded with something good. |