🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add devEnableShare config option (#1141)
Yash Jipkate7b05c492153f
diff --git a/conf/configuration.go b/conf/configuration.goindex cd0bd8034..fb540f1c6 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -64,6 +64,7 @@ type configOptions struct {DevFastAccessCoverArt boolDevOldCacheLayout boolDevActivityPanel bool+ DevEnableShare bool}type scannerOptions struct {@@ -211,6 +212,7 @@ func init() {viper.SetDefault("devoldcachelayout", false)viper.SetDefault("devFastAccessCoverArt", false)viper.SetDefault("devactivitypanel", true)+ viper.SetDefault("devenableshare", false)}func InitConfig(cfgFile string) {diff --git a/server/app/serve_index.go b/server/app/serve_index.goindex 02f54b4e4..8d35af207 100644--- a/server/app/serve_index.go+++ b/server/app/serve_index.go@@ -49,6 +49,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {"devActivityPanel": conf.Server.DevActivityPanel,"devFastAccessCoverArt": conf.Server.DevFastAccessCoverArt,"enableUserEditing": conf.Server.EnableUserEditing,+ "devEnableShare": conf.Server.DevEnableShare,}j, err := json.Marshal(appConfig)if err != nil {diff --git a/server/app/serve_index_test.go b/server/app/serve_index_test.goindex 04f4c80c9..ab6daa8dc 100644--- a/server/app/serve_index_test.go+++ b/server/app/serve_index_test.go@@ -199,6 +199,16 @@ var _ = Describe("serveIndex", func() {config := extractAppConfig(w.Body.String())Expect(config).To(HaveKeyWithValue("enableUserEditing", true))})++ It("sets the devEnableShare", func() {+ r := httptest.NewRequest("GET", "/index.html", nil)+ w := httptest.NewRecorder()++ serveIndex(ds, fs)(w, r)++ config := extractAppConfig(w.Body.String())+ Expect(config).To(HaveKeyWithValue("devEnableShare", false))+ })})var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)diff --git a/ui/src/config.js b/ui/src/config.jsindex ec7a3c8b2..5d8f9123c 100644--- a/ui/src/config.js+++ b/ui/src/config.js@@ -18,6 +18,7 @@ const defaultConfig = {enableStarRating: true,defaultTheme: 'Dark',enableUserEditing: true,+ devEnableShare: true,}let config