Fully support non-destructive append in core.LibmuttonInit(); update copyright year for 2026

This commit is contained in:
2026-01-01 19:52:08 -05:00
parent 571bc0a3bd
commit 28286788a0
6 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024-2025 Randall Winkhart
Copyright (c) 2024-2026 Randall Winkhart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -21,7 +21,7 @@ type CfgT struct {
SSHKeyProtected *bool `json:"sshKeyProtected"`
SSHIsWindows *bool `json:"sshIsWindows"`
} `json:"libmutton"`
ThirdParty *map[string]any `json:"thirdParty"`
ClientSpecific *map[string]any `json:"clientSpecific"`
}
// Load loads libmuttoncfg.json and returns the configuration.
+10 -10
View File
@@ -14,14 +14,14 @@ import (
)
// LibmuttonInit creates the libmutton config structure based on user input.
// rcwPassword and clientSpecificIniData can be left blank if not needed.
func LibmuttonInit(inputCB func(prompt string) string, clientSpecificIniData map[string]any, rcwPassword []byte, preserveOldCfgDir bool, forceOfflineMode bool) error {
// handle clientSpecificIniData
// rcwPassword and clientSpecificCfg can be left blank/nil if not needed.
func LibmuttonInit(inputCB func(prompt string) string, clientSpecificCfg map[string]any, rcwPassword []byte, appendMode, forceOfflineMode bool) error {
// handle clientSpecificCfg
newCfg := &config.CfgT{}
if clientSpecificIniData != nil {
newThirdPartyMap := make(map[string]any)
maps.Copy(newThirdPartyMap, clientSpecificIniData)
newCfg.ThirdParty = &newThirdPartyMap
if clientSpecificCfg != nil {
newClientSpecificMap := make(map[string]any)
maps.Copy(newClientSpecificMap, clientSpecificCfg)
newCfg.ClientSpecific = &newClientSpecificMap
}
var r string
@@ -32,7 +32,7 @@ func LibmuttonInit(inputCB func(prompt string) string, clientSpecificIniData map
}
if len(r) > 0 && r[0] == 'n' {
// initialize libmutton directories
_, err := global.DirInit(preserveOldCfgDir)
_, err := global.DirInit(appendMode)
if err != nil {
return errors.New("unable to initialize libmutton directories: " + err.Error())
}
@@ -65,7 +65,7 @@ func LibmuttonInit(inputCB func(prompt string) string, clientSpecificIniData map
// perform operations based on collected user input
//// initialize libmutton directories
oldDeviceID, err := global.DirInit(preserveOldCfgDir)
oldDeviceID, err := global.DirInit(appendMode)
if err != nil {
return errors.New("unable to initialize libmutton directories: " + err.Error())
}
@@ -77,7 +77,7 @@ func LibmuttonInit(inputCB func(prompt string) string, clientSpecificIniData map
newCfg.Libmutton.SSHPort = &sshPort
newCfg.Libmutton.SSHKeyPath = &sshKeyPath
newCfg.Libmutton.SSHKeyProtected = &sshKeyProtected
err = config.Write(newCfg, false)
err = config.Write(newCfg, appendMode) // pass appendMode to allow not completely destroying existing (client-specific) config
if err != nil {
return err
}
+4
View File
@@ -0,0 +1,4 @@
**libmutton v0.5.0**
Release date TBD
This release adds password age tracking support and improves the robustness of core functionality.
+2 -2
View File
@@ -153,7 +153,7 @@ func main() {
}
func helpServer() {
fmt.Print(back.AnsiBold + "\nlibmuttonserver | Copyright (c) 2024-2025 Randall Winkhart\n" + back.AnsiReset + `
fmt.Print(back.AnsiBold + "\nlibmuttonserver | Copyright (c) 2024-2026 Randall Winkhart\n" + back.AnsiReset + `
This software exists under the MIT license; you may redistribute it under certain conditions.
This program comes with absolutely no warranty; type "libmuttonserver version" for details.
@@ -192,5 +192,5 @@ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.` + "\n\n---------------------------------------------------------")
fmt.Print(back.AnsiBold + "\n\n libmuttonserver" + back.AnsiReset + " Version " + global.LibmuttonVersion + "\n\n Copyright (c) 2024-2025: Randall Winkhart" + "\n\n")
fmt.Print(back.AnsiBold + "\n\n libmuttonserver" + back.AnsiReset + " Version " + global.LibmuttonVersion + "\n\n Copyright (c) 2024-2026: Randall Winkhart" + "\n\n")
}
+1 -1
View File
@@ -28,7 +28,7 @@ libmutton-based password manager clients should all share the same JSON configur
On UNIX-like systems, this is located at `~/.config/libmutton/libmuttoncfg.json`. On Windows, it is located at `~\AppData\Local\libmutton\config\libmuttoncfg.json`.
If creating a third-party client that requires extra configuration to be stored, please use the `ThirdParty` map in the `cfg.ConfigT` type (as used by `cfg.WriteConfig()`) to save your application-specific configuration.
If creating a third-party client that requires extra configuration to be stored, please use the `ClientSpecific` map in the `cfg.ConfigT` type (as used by `cfg.WriteConfig()`) to save your application-specific configuration.
This ensures that a user can use multiple client applications with the same configuration while avoiding conflicts.