diff --git a/.goreleaser.yml b/.goreleaser.yml
index 856a73bee..dc7f0c5eb 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -19,7 +19,7 @@ builds:
flags:
- -tags=embed
ldflags:
- - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+ - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
- id: navidrome_linux
env:
@@ -32,7 +32,7 @@ builds:
- -tags=embed
ldflags:
- "-extldflags '-static'"
- - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+ - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
- id: navidrome_windows_i686
env:
@@ -47,7 +47,7 @@ builds:
- -tags=embed
ldflags:
- "-extldflags '-static'"
- - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+ - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
- id: navidrome_windows_x64
env:
@@ -62,7 +62,7 @@ builds:
- -tags=embed
ldflags:
- "-extldflags '-static'"
- - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+ - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
archives:
-
diff --git a/Dockerfile b/Dockerfile
index e09eaa3ec..7043c716e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -41,7 +41,7 @@ RUN GIT_TAG=$(git name-rev --name-only HEAD) && \
GIT_SHA=$(git rev-parse --short HEAD) && \
echo "Building version: ${GIT_TAG} (${GIT_SHA})" && \
go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/... && \
- go build -ldflags="-X main.gitSha=${GIT_SHA} -X main.gitTag=${GIT_TAG}" -tags=embed
+ go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=${GIT_SHA} -X github.com/deluan/navidrome/consts.gitTag=${GIT_TAG}" -tags=embed
#####################################################
### Build Final Image
diff --git a/Makefile b/Makefile
index e0bbef9aa..d93ee47a8 100644
--- a/Makefile
+++ b/Makefile
@@ -69,8 +69,8 @@ assets/embedded_gen.go: ui/build
.PHONY: build
build: check_go_env
- go build -ldflags="-X main.gitSha=$(GIT_SHA) -X main.gitTag=master"
+ go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/deluan/navidrome/consts.gitTag=master"
.PHONY: buildall
buildall: check_go_env assets/embedded_gen.go
- go build -ldflags="-X main.gitSha=$(GIT_SHA) -X main.gitTag=master" -tags=embed
+ go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/deluan/navidrome/consts.gitTag=master" -tags=embed
diff --git a/banner.go b/banner.go
index abef60dd5..e32b80917 100644
--- a/banner.go
+++ b/banner.go
@@ -4,33 +4,17 @@ import (
"fmt"
"strings"
+ "github.com/deluan/navidrome/consts"
"github.com/deluan/navidrome/static"
)
-var (
- // This will be set in build time. If not, version will be set to "dev"
- gitTag string
- gitSha string
-)
-
-// Formats:
-// dev
-// v0.2.0 (5b84188)
-// master (9ed35cb)
-func getVersion() string {
- if gitSha == "" {
- return "dev"
- }
- return fmt.Sprintf("%s (%s)", gitTag, gitSha)
-}
-
func getBanner() string {
data, _ := static.Asset("banner.txt")
return strings.TrimSuffix(string(data), "\n")
}
func ShowBanner() {
- version := "Version: " + getVersion()
+ version := "Version: " + consts.Version()
padding := strings.Repeat(" ", 52-len(version))
fmt.Printf("%s%s%s\n\n", getBanner(), padding, version)
}
diff --git a/conf/configuration.go b/conf/configuration.go
index 2118de737..9652d13fa 100644
--- a/conf/configuration.go
+++ b/conf/configuration.go
@@ -52,8 +52,6 @@ func newWithPath(path string, skipFlags ...bool) *multiconfig.DefaultLoader {
if strings.HasSuffix(path, "yml") || strings.HasSuffix(path, "yaml") {
loaders = append(loaders, &multiconfig.YAMLLoader{Path: path})
}
- } else {
- println("Skipping config file not found: ", path)
}
e := &multiconfig.EnvironmentLoader{}
diff --git a/consts/consts.go b/consts/consts.go
index 6cf3e37f9..d1ff9dbe1 100644
--- a/consts/consts.go
+++ b/consts/consts.go
@@ -3,6 +3,8 @@ package consts
import "time"
const (
+ AppName = "navidrome"
+
LocalConfigFile = "./navidrome.toml"
InitialSetupFlagKey = "InitialSetup"
@@ -10,7 +12,5 @@ const (
JWTIssuer = "ND"
JWTTokenExpiration = 30 * time.Minute
- InitialUserName = "admin"
-
UIAssetsLocalPath = "ui/build"
)
diff --git a/consts/version.go b/consts/version.go
new file mode 100644
index 000000000..38f7f7992
--- /dev/null
+++ b/consts/version.go
@@ -0,0 +1,20 @@
+package consts
+
+import "fmt"
+
+var (
+ // This will be set in build time. If not, version will be set to "dev"
+ gitTag string
+ gitSha string
+)
+
+// Formats:
+// dev
+// v0.2.0 (5b84188)
+// master (9ed35cb)
+func Version() string {
+ if gitSha == "" {
+ return "dev"
+ }
+ return fmt.Sprintf("%s (%s)", gitTag, gitSha)
+}
diff --git a/engine/playlists.go b/engine/playlists.go
index d05323de2..5033c434a 100644
--- a/engine/playlists.go
+++ b/engine/playlists.go
@@ -3,7 +3,6 @@ package engine
import (
"context"
- "github.com/deluan/navidrome/consts"
"github.com/deluan/navidrome/model"
"github.com/deluan/navidrome/utils"
)
@@ -52,12 +51,11 @@ func (p *playlists) Create(ctx context.Context, playlistId, name string, ids []s
}
func (p *playlists) getUser(ctx context.Context) string {
- owner := consts.InitialUserName
user, ok := ctx.Value("user").(*model.User)
if ok {
- owner = user.UserName
+ return user.UserName
}
- return owner
+ return ""
}
func (p *playlists) Delete(ctx context.Context, playlistId string) error {
diff --git a/server/app/auth.go b/server/app/auth.go
index 4a9f53585..edc9ff679 100644
--- a/server/app/auth.go
+++ b/server/app/auth.go
@@ -109,7 +109,7 @@ func CreateAdmin(ds model.DataStore) func(w http.ResponseWriter, r *http.Request
func createDefaultUser(ctx context.Context, ds model.DataStore, username, password string) error {
id, _ := uuid.NewRandom()
- log.Warn("Creating initial user", "user", consts.InitialUserName)
+ log.Warn("Creating initial user", "user", username)
initialUser := model.User{
ID: id.String(),
UserName: username,
diff --git a/server/subsonic/api.go b/server/subsonic/api.go
index b4a8e7db7..a2f6a4318 100644
--- a/server/subsonic/api.go
+++ b/server/subsonic/api.go
@@ -151,11 +151,12 @@ func HGone(r chi.Router, path string) {
}
func SendError(w http.ResponseWriter, r *http.Request, err error) {
- response := &responses.Subsonic{Version: Version, Status: "fail"}
+ response := NewResponse()
code := responses.ErrorGeneric
if e, ok := err.(SubsonicError); ok {
code = e.code
}
+ response.Status = "fail"
response.Error = &responses.Error{Code: code, Message: err.Error()}
SendResponse(w, r, response)
diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.go
index 016d6b257..fdf87c13e 100644
--- a/server/subsonic/helpers.go
+++ b/server/subsonic/helpers.go
@@ -7,6 +7,7 @@ import (
"strings"
"time"
+ "github.com/deluan/navidrome/consts"
"github.com/deluan/navidrome/engine"
"github.com/deluan/navidrome/model"
"github.com/deluan/navidrome/server/subsonic/responses"
@@ -14,7 +15,7 @@ import (
)
func NewResponse() *responses.Subsonic {
- return &responses.Subsonic{Status: "ok", Version: Version}
+ return &responses.Subsonic{Status: "ok", Version: Version, Type: consts.AppName, ServerVersion: consts.Version()}
}
func RequiredParamString(r *http.Request, param string, msg string) (string, error) {
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .JSON
index 50eb05c07..917958781 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","albumList":{"album":[{"id":"1","isDir":false,"title":"title"}]}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","albumList":{"album":[{"id":"1","isDir":false,"title":"title"}]}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .XML
index e9a9e284f..b2a841784 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList with data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .JSON
index 52933f99c..497f1609e 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","albumList":{}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","albumList":{}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .XML
index 66367095d..b710114cf 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses AlbumList without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .JSON
index de1b4ab54..ab135140e 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","directory":{"child":[{"id":"1","isDir":true,"title":"title","album":"album","artist":"artist","track":1,"year":1985,"genre":"Rock","coverArt":"1","size":"8421341","contentType":"audio/flac","suffix":"flac","starred":"2016-03-02T20:30:00Z","transcodedContentType":"audio/mpeg","transcodedSuffix":"mp3","duration":146,"bitRate":320}],"id":"1","name":"N"}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","directory":{"child":[{"id":"1","isDir":true,"title":"title","album":"album","artist":"artist","track":1,"year":1985,"genre":"Rock","coverArt":"1","size":"8421341","contentType":"audio/flac","suffix":"flac","starred":"2016-03-02T20:30:00Z","transcodedContentType":"audio/mpeg","transcodedSuffix":"mp3","duration":146,"bitRate":320}],"id":"1","name":"N"}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .XML
index 08ce917ae..a22088866 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Child with data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .JSON
index d2374a7b1..f8efcb064 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","directory":{"child":[{"id":"1","isDir":false,"title":"title"}],"id":"1","name":"N"}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","directory":{"child":[{"id":"1","isDir":false,"title":"title"}],"id":"1","name":"N"}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .XML
index 37d5f05da..4ecfa0401 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory with data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .JSON
index 634b2ac97..3964f66d8 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","directory":{"id":"1","name":"N"}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","directory":{"id":"1","name":"N"}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .XML
index 7dc25197d..8cd0bece4 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Directory without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .JSON
index 88a5af615..6348cab1c 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0"}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0"}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .XML
index c392d4b88..bb84788d6 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses EmptyResponse should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .JSON
index 08a4fb50c..1138cfc69 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","genres":{"genre":[{"value":"Rock","songCount":1000,"albumCount":100},{"value":"Reggae","songCount":500,"albumCount":50},{"value":"Pop","songCount":0,"albumCount":0}]}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","genres":{"genre":[{"value":"Rock","songCount":1000,"albumCount":100},{"value":"Reggae","songCount":500,"albumCount":50},{"value":"Pop","songCount":0,"albumCount":0}]}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .XML
index e99952d47..038255b1d 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres with data should match .XML
@@ -1 +1 @@
-RockReggaePop
+RockReggaePop
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .JSON
index f7f97bf4e..ca90b27a6 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","genres":{}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","genres":{}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .XML
index 1d0c9e4b7..f0ba9ea65 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Genres without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .JSON
index 5eac46ab2..93b3a275f 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","indexes":{"index":[{"name":"A","artist":[{"id":"111","name":"aaa","starred":"2016-03-02T20:30:00Z"}]}],"lastModified":"1","ignoredArticles":"A"}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","indexes":{"index":[{"name":"A","artist":[{"id":"111","name":"aaa","starred":"2016-03-02T20:30:00Z"}]}],"lastModified":"1","ignoredArticles":"A"}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .XML
index f89fb21a1..cf47d9e49 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes with data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .JSON
index 1354becac..cb318f453 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","indexes":{"lastModified":"1","ignoredArticles":"A"}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","indexes":{"lastModified":"1","ignoredArticles":"A"}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .XML
index a63f84ea8..7943840df 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Indexes without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .JSON
index 81044ba91..89e522485 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","license":{"valid":true}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","license":{"valid":true}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .XML
index 4ef4e2b68..0a724f69b 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses License should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .JSON
index 3aec470a9..0b659d362 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","musicFolders":{"musicFolder":[{"id":"111","name":"aaa"},{"id":"222","name":"bbb"}]}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","musicFolders":{"musicFolder":[{"id":"111","name":"aaa"},{"id":"222","name":"bbb"}]}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .XML
index e657891c0..4a4e88b58 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders with data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .JSON
index fd722392f..d0a73ebdc 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","musicFolders":{}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","musicFolders":{}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .XML
index a659b4cce..71a88eed3 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses MusicFolders without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .JSON
index 851e598bc..5f0a425e9 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","playlists":{"playlist":[{"id":"111","name":"aaa"},{"id":"222","name":"bbb"}]}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","playlists":{"playlist":[{"id":"111","name":"aaa"},{"id":"222","name":"bbb"}]}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .XML
index 6fbaf11a9..df243dbb7 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists with data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .JSON
index 8f34d597f..3dec0b4b7 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","playlists":{}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","playlists":{}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .XML
index 7a3f391dd..c12651c91 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Playlists without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .JSON
index 79db8035b..917d9c367 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","user":{"username":"deluan","email":"navidrome@deluan.com","scrobblingEnabled":false,"adminRole":false,"settingsRole":false,"downloadRole":false,"uploadRole":false,"playlistRole":false,"coverArtRole":false,"commentRole":false,"podcastRole":false,"streamRole":false,"jukeboxRole":false,"shareRole":false,"videoConversionRole":false,"folder":[1]}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","user":{"username":"deluan","email":"navidrome@deluan.com","scrobblingEnabled":false,"adminRole":false,"settingsRole":false,"downloadRole":false,"uploadRole":false,"playlistRole":false,"coverArtRole":false,"commentRole":false,"podcastRole":false,"streamRole":false,"jukeboxRole":false,"shareRole":false,"videoConversionRole":false,"folder":[1]}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .XML
index 72e5872a5..ad4245097 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User with data should match .XML
@@ -1 +1 @@
-1
+1
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .JSON
index f348788a9..0fec700d0 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","user":{"username":"deluan","scrobblingEnabled":false,"adminRole":false,"settingsRole":false,"downloadRole":false,"uploadRole":false,"playlistRole":false,"coverArtRole":false,"commentRole":false,"podcastRole":false,"streamRole":false,"jukeboxRole":false,"shareRole":false,"videoConversionRole":false}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","user":{"username":"deluan","scrobblingEnabled":false,"adminRole":false,"settingsRole":false,"downloadRole":false,"uploadRole":false,"playlistRole":false,"coverArtRole":false,"commentRole":false,"podcastRole":false,"streamRole":false,"jukeboxRole":false,"shareRole":false,"videoConversionRole":false}}
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .XML
index ec540d7c5..d49c10785 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .XML
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses User without data should match .XML
@@ -1 +1 @@
-
+
diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.go
index 901297ce3..e77e9ed32 100644
--- a/server/subsonic/responses/responses.go
+++ b/server/subsonic/responses/responses.go
@@ -9,6 +9,8 @@ type Subsonic struct {
XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response" json:"-"`
Status string `xml:"status,attr" json:"status"`
Version string `xml:"version,attr" json:"version"`
+ Type string `xml:"type,attr" json:"type"`
+ ServerVersion string `xml:"serverVersion,attr" json:"serverVersion"`
Error *Error `xml:"error,omitempty" json:"error,omitempty"`
License *License `xml:"license,omitempty" json:"license,omitempty"`
MusicFolders *MusicFolders `xml:"musicFolders,omitempty" json:"musicFolders,omitempty"`
diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.go
index c7e808bf8..30ad62758 100644
--- a/server/subsonic/responses/responses_test.go
+++ b/server/subsonic/responses/responses_test.go
@@ -10,6 +10,7 @@ import (
"encoding/xml"
"time"
+ "github.com/deluan/navidrome/consts"
. "github.com/deluan/navidrome/server/subsonic/responses"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -18,7 +19,7 @@ import (
var _ = Describe("Responses", func() {
var response *Subsonic
BeforeEach(func() {
- response = &Subsonic{Status: "ok", Version: "1.8.0"}
+ response = &Subsonic{Status: "ok", Version: "1.8.0", Type: consts.AppName, ServerVersion: "v0.0.0"}
})
Describe("EmptyResponse", func() {