small refactor - move keyring logic to ServerManager
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/dweymouth/go-subsonic/subsonic"
|
||||
"github.com/google/uuid"
|
||||
"github.com/zalando/go-keyring"
|
||||
)
|
||||
|
||||
type ServerManager struct {
|
||||
@@ -39,3 +40,11 @@ func (s *ServerManager) ConnectToServer(conf *ServerConfig, password string) err
|
||||
func (s *ServerManager) OnServerConnected(cb func()) {
|
||||
s.onServerConnected = append(s.onServerConnected, cb)
|
||||
}
|
||||
|
||||
func (s *ServerManager) GetServerPassword(server *ServerConfig) (string, error) {
|
||||
return keyring.Get(AppName, server.ID.String())
|
||||
}
|
||||
|
||||
func (s *ServerManager) SetServerPassword(server *ServerConfig, password string) error {
|
||||
return keyring.Set(AppName, server.ID.String(), password)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user