Add config option to globally enable/disable downloads

This commit is contained in:
Deluan
2020-11-10 16:14:43 -05:00
parent bf69c5589f
commit 08e63c867b
9 changed files with 76 additions and 28 deletions
+1
View File
@@ -34,6 +34,7 @@ func serveIndex(ds model.DataStore, fs http.FileSystem) http.HandlerFunc {
"welcomeMessage": policy.Sanitize(conf.Server.UIWelcomeMessage),
"enableTranscodingConfig": conf.Server.EnableTranscodingConfig,
"gaTrackingId": conf.Server.GATrackingID,
"enableDownloads": conf.Server.EnableDownloads,
"devActivityMenu": conf.Server.DevActivityMenu,
}
j, err := json.Marshal(appConfig)
+11
View File
@@ -103,6 +103,17 @@ var _ = Describe("serveIndex", func() {
Expect(config).To(HaveKeyWithValue("enableTranscodingConfig", true))
})
It("sets the enableDownloads", func() {
conf.Server.EnableDownloads = true
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()
serveIndex(ds, fs)(w, r)
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("enableDownloads", true))
})
It("sets the gaTrackingId", func() {
conf.Server.GATrackingID = "UA-12345"
r := httptest.NewRequest("GET", "/index.html", nil)