Add config option to globally enable/disable downloads
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user