all: Add configurable defaults (fixes #4224, fixes #6086) (#7131)

This commit is contained in:
Simon Frei
2021-02-04 21:10:41 +01:00
committed by GitHub
parent 31119ed61a
commit ffc14a77c6
41 changed files with 1708 additions and 1046 deletions
+14
View File
@@ -96,10 +96,12 @@ type Wrapper interface {
Folders() map[string]FolderConfiguration
FolderList() []FolderConfiguration
FolderPasswords(device protocol.DeviceID) map[string]string
DefaultFolder() FolderConfiguration
Device(id protocol.DeviceID) (DeviceConfiguration, bool)
Devices() map[protocol.DeviceID]DeviceConfiguration
DeviceList() []DeviceConfiguration
DefaultDevice() DeviceConfiguration
IgnoredDevices() []ObservedDevice
IgnoredDevice(id protocol.DeviceID) bool
@@ -353,6 +355,12 @@ func (w *wrapper) RemoveDevice(id protocol.DeviceID) (Waiter, error) {
})
}
func (w *wrapper) DefaultDevice() DeviceConfiguration {
w.mut.Lock()
defer w.mut.Unlock()
return w.cfg.Defaults.Device.Copy()
}
// Folders returns a map of folders.
func (w *wrapper) Folders() map[string]FolderConfiguration {
w.mut.Lock()
@@ -388,6 +396,12 @@ func (w *wrapper) FolderPasswords(device protocol.DeviceID) map[string]string {
return w.cfg.FolderPasswords(device)
}
func (w *wrapper) DefaultFolder() FolderConfiguration {
w.mut.Lock()
defer w.mut.Unlock()
return w.cfg.Defaults.Folder.Copy()
}
// Options returns the current options configuration object.
func (w *wrapper) Options() OptionsConfiguration {
w.mut.Lock()