feat: imported playlists are public by default (#3143)

* feat: imported playlists are public by default

* chore: make linter happy

---------

Co-authored-by: John White <john@activecode.dev>
This commit is contained in:
John White
2024-08-29 01:20:05 +02:00
committed by GitHub
parent 9f65f8f5a8
commit 67d11dd144
2 changed files with 72 additions and 67 deletions
+69 -67
View File
@@ -17,73 +17,74 @@ import (
) )
type configOptions struct { type configOptions struct {
ConfigFile string ConfigFile string
Address string Address string
Port int Port int
UnixSocketPerm string UnixSocketPerm string
MusicFolder string MusicFolder string
DataFolder string DataFolder string
CacheFolder string CacheFolder string
DbPath string DbPath string
LogLevel string LogLevel string
ScanInterval time.Duration ScanInterval time.Duration
ScanSchedule string ScanSchedule string
SessionTimeout time.Duration SessionTimeout time.Duration
BaseURL string BaseURL string
BasePath string BasePath string
BaseHost string BaseHost string
BaseScheme string BaseScheme string
TLSCert string TLSCert string
TLSKey string TLSKey string
UILoginBackgroundURL string UILoginBackgroundURL string
UIWelcomeMessage string UIWelcomeMessage string
MaxSidebarPlaylists int MaxSidebarPlaylists int
EnableTranscodingConfig bool EnableTranscodingConfig bool
EnableDownloads bool EnableDownloads bool
EnableExternalServices bool EnableExternalServices bool
EnableMediaFileCoverArt bool EnableMediaFileCoverArt bool
TranscodingCacheSize string TranscodingCacheSize string
ImageCacheSize string ImageCacheSize string
AlbumPlayCountMode string AlbumPlayCountMode string
EnableArtworkPrecache bool EnableArtworkPrecache bool
AutoImportPlaylists bool AutoImportPlaylists bool
PlaylistsPath string DefaultPlaylistPublicVisibility bool
AutoTranscodeDownload bool PlaylistsPath string
DefaultDownsamplingFormat string AutoTranscodeDownload bool
SearchFullString bool DefaultDownsamplingFormat string
RecentlyAddedByModTime bool SearchFullString bool
PreferSortTags bool RecentlyAddedByModTime bool
IgnoredArticles string PreferSortTags bool
IndexGroups string IgnoredArticles string
SubsonicArtistParticipations bool IndexGroups string
FFmpegPath string SubsonicArtistParticipations bool
MPVPath string FFmpegPath string
MPVCmdTemplate string MPVPath string
CoverArtPriority string MPVCmdTemplate string
CoverJpegQuality int CoverArtPriority string
ArtistArtPriority string CoverJpegQuality int
EnableGravatar bool ArtistArtPriority string
EnableFavourites bool EnableGravatar bool
EnableStarRating bool EnableFavourites bool
EnableUserEditing bool EnableStarRating bool
EnableSharing bool EnableUserEditing bool
DefaultDownloadableShare bool EnableSharing bool
DefaultTheme string DefaultDownloadableShare bool
DefaultLanguage string DefaultTheme string
DefaultUIVolume int DefaultLanguage string
EnableReplayGain bool DefaultUIVolume int
EnableCoverAnimation bool EnableReplayGain bool
GATrackingID string EnableCoverAnimation bool
EnableLogRedacting bool GATrackingID string
AuthRequestLimit int EnableLogRedacting bool
AuthWindowLength time.Duration AuthRequestLimit int
PasswordEncryptionKey string AuthWindowLength time.Duration
ReverseProxyUserHeader string PasswordEncryptionKey string
ReverseProxyWhitelist string ReverseProxyUserHeader string
HTTPSecurityHeaders secureOptions ReverseProxyWhitelist string
Prometheus prometheusOptions HTTPSecurityHeaders secureOptions
Scanner scannerOptions Prometheus prometheusOptions
Jukebox jukeboxOptions Scanner scannerOptions
Jukebox jukeboxOptions
Agents string Agents string
LastFM lastfmOptions LastFM lastfmOptions
@@ -299,6 +300,7 @@ func init() {
viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute) viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute)
viper.SetDefault("enableartworkprecache", true) viper.SetDefault("enableartworkprecache", true)
viper.SetDefault("autoimportplaylists", true) viper.SetDefault("autoimportplaylists", true)
viper.SetDefault("defaultplaylistpublicvisibility", true)
viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath) viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath)
viper.SetDefault("enabledownloads", true) viper.SetDefault("enabledownloads", true)
viper.SetDefault("enableexternalservices", true) viper.SetDefault("enableexternalservices", true)
+3
View File
@@ -14,6 +14,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/navidrome/navidrome/conf"
"github.com/RaveNoX/go-jsoncommentstrip" "github.com/RaveNoX/go-jsoncommentstrip"
"github.com/navidrome/navidrome/log" "github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model" "github.com/navidrome/navidrome/model"
@@ -193,6 +195,7 @@ func (s *playlists) updatePlaylist(ctx context.Context, newPls *model.Playlist)
} else { } else {
log.Info(ctx, "Adding synced playlist", "playlist", newPls.Name, "path", newPls.Path, "owner", owner.UserName) log.Info(ctx, "Adding synced playlist", "playlist", newPls.Name, "path", newPls.Path, "owner", owner.UserName)
newPls.OwnerID = owner.ID newPls.OwnerID = owner.ID
newPls.Public = conf.Server.DefaultPlaylistPublicVisibility
} }
return s.ds.Playlist(ctx).Put(newPls) return s.ds.Playlist(ctx).Put(newPls)
} }