feat(sharing): enable sharing by default (#5714)

Flip the EnableSharing default from false to true so new installations have the sharing feature available out of the box. Users can still disable it via the EnableSharing config option.

The native API only registers the /share route when sharing is enabled, so the nativeapi tests that build the router without wiring a share service now explicitly disable sharing in their setup to avoid registering a route backed by a nil service.
This commit is contained in:
Deluan Quintão 2026-07-04 19:55:34 -04:00 committed by GitHub
parent 89aa58a713
commit 37e75c4354
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 1 deletions

View file

@ -794,7 +794,7 @@ func setViperDefaults() {
viper.SetDefault("uiplaybackreportinterval", consts.DefaultUIPlaybackReportInterval) viper.SetDefault("uiplaybackreportinterval", consts.DefaultUIPlaybackReportInterval)
viper.SetDefault("enableartworkupload", true) viper.SetDefault("enableartworkupload", true)
viper.SetDefault("maximageuploadsize", consts.DefaultMaxImageUploadSize) viper.SetDefault("maximageuploadsize", consts.DefaultMaxImageUploadSize)
viper.SetDefault("enablesharing", false) viper.SetDefault("enablesharing", true)
viper.SetDefault("shareurl", "") viper.SetDefault("shareurl", "")
viper.SetDefault("defaultshareexpiration", 8760*time.Hour) viper.SetDefault("defaultshareexpiration", 8760*time.Hour)
viper.SetDefault("defaultdownloadableshare", false) viper.SetDefault("defaultdownloadableshare", false)

View file

@ -25,6 +25,7 @@ var _ = Describe("Config API", func() {
BeforeEach(func() { BeforeEach(func() {
DeferCleanup(configtest.SetupConfig()) DeferCleanup(configtest.SetupConfig())
conf.Server.EnableSharing = false
conf.Server.DevUIShowConfig = true // Enable config endpoint for tests conf.Server.DevUIShowConfig = true // Enable config endpoint for tests
ds = &tests.MockDataStore{} ds = &tests.MockDataStore{}
auth.Init(ds) auth.Init(ds)

View file

@ -9,6 +9,7 @@ import (
"net/http/httptest" "net/http/httptest"
"strings" "strings"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/conf/configtest" "github.com/navidrome/navidrome/conf/configtest"
"github.com/navidrome/navidrome/consts" "github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/auth" "github.com/navidrome/navidrome/core/auth"
@ -27,6 +28,7 @@ var _ = Describe("Library API", func() {
BeforeEach(func() { BeforeEach(func() {
DeferCleanup(configtest.SetupConfig()) DeferCleanup(configtest.SetupConfig())
conf.Server.EnableSharing = false
ds = &tests.MockDataStore{} ds = &tests.MockDataStore{}
auth.Init(ds) auth.Init(ds)
nativeRouter := New(ds, nil, nil, nil, tests.NewMockLibraryService(), tests.NewMockUserService(), nil, nil, nil) nativeRouter := New(ds, nil, nil, nil, tests.NewMockLibraryService(), tests.NewMockUserService(), nil, nil, nil)

View file

@ -32,6 +32,7 @@ var _ = Describe("Song Endpoints", func() {
BeforeEach(func() { BeforeEach(func() {
DeferCleanup(configtest.SetupConfig()) DeferCleanup(configtest.SetupConfig())
conf.Server.EnableSharing = false
conf.Server.SessionTimeout = time.Minute conf.Server.SessionTimeout = time.Minute
// Setup mock repositories // Setup mock repositories

View file

@ -76,6 +76,7 @@ var _ = Describe("Playlist Tracks Endpoint", func() {
BeforeEach(func() { BeforeEach(func() {
DeferCleanup(configtest.SetupConfig()) DeferCleanup(configtest.SetupConfig())
conf.Server.EnableSharing = false
conf.Server.SessionTimeout = time.Minute conf.Server.SessionTimeout = time.Minute
plsSvc = &mockPlaylistsService{} plsSvc = &mockPlaylistsService{}

View file

@ -29,6 +29,7 @@ var _ = Describe("Plugin API", func() {
BeforeEach(func() { BeforeEach(func() {
DeferCleanup(configtest.SetupConfig()) DeferCleanup(configtest.SetupConfig())
conf.Server.EnableSharing = false
conf.Server.Plugins.Enabled = true conf.Server.Plugins.Enabled = true
ds = &tests.MockDataStore{} ds = &tests.MockDataStore{}
mockManager = &tests.MockPluginManager{} mockManager = &tests.MockPluginManager{}