Remove LastFM shared key

This commit is contained in:
Deluan 2023-12-10 21:11:40 -05:00
parent 546aa26a0a
commit 78d557c185
3 changed files with 10 additions and 14 deletions

View File

@ -335,8 +335,8 @@ func init() {
viper.SetDefault("agents", "lastfm,spotify") viper.SetDefault("agents", "lastfm,spotify")
viper.SetDefault("lastfm.enabled", true) viper.SetDefault("lastfm.enabled", true)
viper.SetDefault("lastfm.language", "en") viper.SetDefault("lastfm.language", "en")
viper.SetDefault("lastfm.apikey", consts.LastFMAPIKey) viper.SetDefault("lastfm.apikey", "")
viper.SetDefault("lastfm.secret", consts.LastFMAPISecret) viper.SetDefault("lastfm.secret", "")
viper.SetDefault("spotify.id", "") viper.SetDefault("spotify.id", "")
viper.SetDefault("spotify.secret", "") viper.SetDefault("spotify.secret", "")
viper.SetDefault("listenbrainz.enabled", true) viper.SetDefault("listenbrainz.enabled", true)

View File

@ -81,12 +81,6 @@ const (
DefaultCacheCleanUpInterval = 10 * time.Minute DefaultCacheCleanUpInterval = 10 * time.Minute
) )
// Shared secrets (only add here "secrets" that can be public)
const (
LastFMAPIKey = "9b94a5515ea66b2da3ec03c12300327e" // nolint:gosec
LastFMAPISecret = "74cb6557cec7171d921af5d7d887c587" // nolint:gosec
)
var ( var (
DefaultDownsamplingFormat = "opus" DefaultDownsamplingFormat = "opus"
DefaultTranscodings = []map[string]interface{}{ DefaultTranscodings = []map[string]interface{}{

View File

@ -311,12 +311,14 @@ func (l *lastfmAgent) IsAuthorized(ctx context.Context, userId string) bool {
func init() { func init() {
conf.AddHook(func() { conf.AddHook(func() {
if conf.Server.LastFM.Enabled { if conf.Server.LastFM.Enabled {
agents.Register(lastFMAgentName, func(ds model.DataStore) agents.Interface { if conf.Server.LastFM.ApiKey != "" && conf.Server.LastFM.Secret != "" {
return lastFMConstructor(ds) agents.Register(lastFMAgentName, func(ds model.DataStore) agents.Interface {
}) return lastFMConstructor(ds)
scrobbler.Register(lastFMAgentName, func(ds model.DataStore) scrobbler.Scrobbler { })
return lastFMConstructor(ds) scrobbler.Register(lastFMAgentName, func(ds model.DataStore) scrobbler.Scrobbler {
}) return lastFMConstructor(ds)
})
}
} }
}) })
} }