feat: integrate security features into TUI
- SFTPBrowserTab: added storagePassword, passphraseCallback fields - Model: added storagePassword, knownHosts fields - cmd/hostkeeper/tui.go: initialize known_hosts on startup - SFTP connect: wire passphrase callback to SSH client - SetStoragePassword/SetKnownHosts/SetPassphraseCallback methods
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"git.tukangketik.id/swanadiva/hostkeeper/pkg/config"
|
||||
"git.tukangketik.id/swanadiva/hostkeeper/pkg/knownhosts"
|
||||
"git.tukangketik.id/swanadiva/hostkeeper/pkg/storage"
|
||||
"git.tukangketik.id/swanadiva/hostkeeper/pkg/tui"
|
||||
)
|
||||
@@ -39,6 +40,12 @@ func runTUI(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("failed to initialize storage: %w", err)
|
||||
}
|
||||
|
||||
// Initialize known_hosts
|
||||
kh, err := knownhosts.New(cfg.GetDataDir())
|
||||
if err != nil {
|
||||
fmt.Printf("Warning: failed to load known_hosts: %v\n", err)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
hosts, err := store.ListHosts(ctx)
|
||||
if err != nil {
|
||||
@@ -48,6 +55,9 @@ func runTUI(cmd *cobra.Command, args []string) error {
|
||||
model := tui.New()
|
||||
model.SetDataDir(cfg.GetDataDir())
|
||||
model.LoadHosts(hosts)
|
||||
if kh != nil {
|
||||
model.SetKnownHosts(kh)
|
||||
}
|
||||
|
||||
p := tea.NewProgram(model)
|
||||
model.SetProgram(p)
|
||||
|
||||
Reference in New Issue
Block a user