diff --git a/conf/configuration.go b/conf/configuration.go index 5ddec29f..aa1b1a14 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -29,6 +29,7 @@ type configOptions struct { UILoginBackgroundURL string EnableTranscodingConfig bool EnableDownloads bool + EnableExternalServices bool TranscodingCacheSize string ImageCacheSize string AutoImportPlaylists bool @@ -138,12 +139,24 @@ func Load() { fmt.Println(prettyConf) } + if !Server.EnableExternalServices { + disableExternalServices() + } + // Call init hooks for _, hook := range hooks { hook() } } +func disableExternalServices() { + log.Info("All external integrations are DISABLED!") + Server.LastFM.Enabled = false + Server.Spotify.ID = "" + Server.UILoginBackgroundURL = consts.DefaultUILoginBackgroundURLOffline + Server.DevListenBrainzEnabled = false +} + func validateScanSchedule() error { if Server.ScanInterval != -1 { log.Warn("ScanInterval is DEPRECATED. Please use ScanSchedule. See docs at https://navidrome.org/docs/usage/configuration-options/") @@ -195,6 +208,7 @@ func init() { viper.SetDefault("autoimportplaylists", true) viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath) viper.SetDefault("enabledownloads", true) + viper.SetDefault("enableexternalservices", true) // Config options only valid for file/env configuration viper.SetDefault("searchfullstring", false) diff --git a/consts/consts.go b/consts/consts.go index 0471cf7f..af7f74a6 100644 --- a/consts/consts.go +++ b/consts/consts.go @@ -35,6 +35,8 @@ const ( // Login backgrounds from https://unsplash.com/collections/20072696/navidrome DefaultUILoginBackgroundURL = "https://source.unsplash.com/collection/20072696/1600x900" + // In case external integrations are disabled + DefaultUILoginBackgroundURLOffline = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAABGdBTUEAALGPC/xhBQAAAiJJREFUeF7t0IEAAAAAw6D5Ux/khVBhwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDDwMDDVlwABBWcSrQAAAABJRU5ErkJggg==" RequestThrottleBacklogLimit = 100 RequestThrottleBacklogTimeout = time.Minute