Skip to content

🎧 Your Personal Streaming Service

Introduce a new configuration to select the login background image URL

Deluandb246900a60b
diff --git a/conf/configuration.go b/conf/configuration.go
index 5ee4b5dde..635faf121 100644
--- a/conf/configuration.go
+++ b/conf/configuration.go
@@ -22,6 +22,8 @@ type nd struct {
SessionTimeout string `default:"30m"`
BaseURL string `default:""`
+ UILoginBackgroundURL string `default:"https://source.unsplash.com/random/1600x900?music"`
+
IgnoredArticles string `default:"The El La Los Las Le Les Os As O A"`
IndexGroups string `default:"A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ) [Unknown]([)"`
diff --git a/server/app/serve_index.go b/server/app/serve_index.go
index f2b175cdc..56f1666cc 100644
--- a/server/app/serve_index.go
+++ b/server/app/serve_index.go
@@ -30,8 +30,9 @@ func ServeIndex(ds model.DataStore, fs http.FileSystem) http.HandlerFunc {
}
t, _ = t.Parse(string(indexStr))
appConfig := map[string]interface{}{
- "firstTime": firstTime,
- "baseURL": strings.TrimSuffix(conf.Server.BaseURL, "/"),
+ "firstTime": firstTime,
+ "baseURL": strings.TrimSuffix(conf.Server.BaseURL, "/"),
+ "loginBackgroundURL": conf.Server.UILoginBackgroundURL,
}
j, _ := json.Marshal(appConfig)
data := map[string]interface{}{
diff --git a/server/app/serve_index_test.go b/server/app/serve_index_test.go
index 20f914ee8..bf68b000a 100644
--- a/server/app/serve_index_test.go
+++ b/server/app/serve_index_test.go
@@ -22,6 +22,7 @@ var _ = Describe("ServeIndex", func() {
BeforeEach(func() {
ds = &persistence.MockDataStore{MockedUser: mockUser}
+ conf.Server.UILoginBackgroundURL = ""
})
It("adds app_config to index.html", func() {
@@ -57,7 +58,7 @@ var _ = Describe("ServeIndex", func() {
Expect(config).To(HaveKeyWithValue("firstTime", false))
})
- It("sets baseURL ", func() {
+ It("sets baseURL", func() {
conf.Server.BaseURL = "base_url_test"
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()
@@ -67,6 +68,17 @@ var _ = Describe("ServeIndex", func() {
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("baseURL", "base_url_test"))
})
+
+ It("sets the uiLoginBackgroundURL", func() {
+ conf.Server.UILoginBackgroundURL = "my_background_url"
+ r := httptest.NewRequest("GET", "/index.html", nil)
+ w := httptest.NewRecorder()
+
+ ServeIndex(ds, fs)(w, r)
+
+ config := extractAppConfig(w.Body.String())
+ Expect(config).To(HaveKeyWithValue("loginBackgroundURL", "my_background_url"))
+ })
})
var appConfigRegex = regexp.MustCompile(`(?m)window.__APP_CONFIG__="([^"]*)`)