Only compute version once

This commit is contained in:
Deluan
2022-09-14 21:09:39 -04:00
parent ebad96b8a4
commit 4cf43ed735
8 changed files with 20 additions and 10 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ func (b *broker) listen() {
// Send a serverStart event to new client
msg := b.prepareMessage(context.Background(),
&ServerStart{StartTime: consts.ServerStart, Version: consts.Version()})
&ServerStart{StartTime: consts.ServerStart, Version: consts.Version})
c.diode.put(msg)
case c := <-b.unsubscribing:
+2 -2
View File
@@ -27,7 +27,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
return
}
appConfig := map[string]interface{}{
"version": consts.Version(),
"version": consts.Version,
"firstTime": firstTime,
"variousArtistsId": consts.VariousArtistsID,
"baseURL": utils.SanitizeText(strings.TrimSuffix(conf.Server.BaseURL, "/")),
@@ -63,7 +63,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
}
log.Debug("UI configuration", "appConfig", appConfig)
version := consts.Version()
version := consts.Version
if version != "dev" {
version = "v" + version
}
+1 -1
View File
@@ -188,7 +188,7 @@ var _ = Describe("serveIndex", func() {
serveIndex(ds, fs)(w, r)
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("version", consts.Version()))
Expect(config).To(HaveKeyWithValue("version", consts.Version))
})
It("sets the losslessFormats", func() {
+1 -1
View File
@@ -15,7 +15,7 @@ import (
)
func newResponse() *responses.Subsonic {
return &responses.Subsonic{Status: "ok", Version: Version, Type: consts.AppName, ServerVersion: consts.Version()}
return &responses.Subsonic{Status: "ok", Version: Version, Type: consts.AppName, ServerVersion: consts.Version}
}
func requiredParamString(r *http.Request, param string) (string, error) {