report configuration failures instead of crashing
Return errors from the save path rather than panicking. Every write panicked on failure, so a read-only or missing configuration directory killed a running client. The parent directory is created when absent, and callers now show the failure in the output window and carry on. Write through an unpredictable temporary file. The old fixed ".tmp" name next to the configuration was a symlink target an attacker could plant in advance. Serialize configuration reads and writes. Hotkey handlers, the audio thread, and the connection callbacks all touch the same structure, so saves could interleave with updates. Parse addresses with SplitHostPort. Splitting on every colon broke IPv6 addresses and panicked outright on an address with no port. Both now fall back to Mumble's default port. Fail immediately when an explicitly requested config file is missing or is not a regular file. Silently falling back to defaults hid a mistyped -config path. Supply defaults for the clear-output and scroll-to-top and -bottom hotkeys. The UI registered listeners for them but the configuration never filled the keys in, so the bindings were nil and the keys did nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
7e1faba06b
commit
17173b779b
@@ -99,7 +99,9 @@ func (b *Barnard) OnTimestampToggle(ui *uiterm.Ui, key uiterm.Key) {
|
||||
|
||||
func (b *Barnard) OnNoiseSuppressionToggle(ui *uiterm.Ui, key uiterm.Key) {
|
||||
enabled := !b.UserConfig.GetNoiseSuppressionEnabled()
|
||||
b.UserConfig.SetNoiseSuppressionEnabled(enabled)
|
||||
if err := b.UserConfig.SetNoiseSuppressionEnabled(enabled); err != nil {
|
||||
b.AddOutputLine("Noise suppression: could not save setting: " + err.Error())
|
||||
}
|
||||
b.NoiseSuppressor.SetEnabled(enabled)
|
||||
|
||||
if enabled {
|
||||
@@ -161,7 +163,9 @@ func (b *Barnard) CommandMicDown(ui *uiterm.Ui, cmd string) {
|
||||
|
||||
func (b *Barnard) CommandNoiseSuppressionToggle(ui *uiterm.Ui, cmd string) {
|
||||
enabled := !b.UserConfig.GetNoiseSuppressionEnabled()
|
||||
b.UserConfig.SetNoiseSuppressionEnabled(enabled)
|
||||
if err := b.UserConfig.SetNoiseSuppressionEnabled(enabled); err != nil {
|
||||
b.AddOutputLine("Noise suppression: could not save setting: " + err.Error())
|
||||
}
|
||||
b.NoiseSuppressor.SetEnabled(enabled)
|
||||
|
||||
if enabled {
|
||||
|
||||
Reference in New Issue
Block a user