mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 16:46:17 +00:00
feat: add Spotify, management, and ZeroConf CLI flags
This commit is contained in:
committed by
Tobias Gesellchen
parent
be017440b7
commit
a87783d8c6
@@ -40,6 +40,13 @@ type Server struct {
|
||||
Version string
|
||||
Commit string
|
||||
Date string
|
||||
mgmtUsername string
|
||||
mgmtPassword string
|
||||
spotifyClientID string
|
||||
spotifyClientSecret string
|
||||
spotifyRedirectURI string
|
||||
zeroconfEnabled bool
|
||||
baseURL string
|
||||
}
|
||||
|
||||
// NewServer creates a new SoundTouch service server.
|
||||
@@ -215,6 +222,41 @@ func (s *Server) SetRecorder(r *proxy.Recorder) {
|
||||
}
|
||||
}
|
||||
|
||||
// SetSpotifyConfig sets the Spotify OAuth configuration.
|
||||
func (s *Server) SetSpotifyConfig(clientID, clientSecret, redirectURI string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.spotifyClientID = clientID
|
||||
s.spotifyClientSecret = clientSecret
|
||||
s.spotifyRedirectURI = redirectURI
|
||||
}
|
||||
|
||||
// SetMgmtConfig sets the management API authentication credentials.
|
||||
func (s *Server) SetMgmtConfig(username, password string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.mgmtUsername = username
|
||||
s.mgmtPassword = password
|
||||
}
|
||||
|
||||
// SetZeroconfEnabled sets whether ZeroConf Spotify primer is enabled.
|
||||
func (s *Server) SetZeroconfEnabled(enabled bool) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.zeroconfEnabled = enabled
|
||||
}
|
||||
|
||||
// SetBaseURL sets the external base URL for OAuth callbacks.
|
||||
func (s *Server) SetBaseURL(baseURL string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
s.baseURL = baseURL
|
||||
}
|
||||
|
||||
// GetRecordEnabled returns whether recording is enabled.
|
||||
func (s *Server) GetRecordEnabled() bool {
|
||||
s.mu.RLock()
|
||||
|
||||
Reference in New Issue
Block a user