fix: correct opensubsonic extensions response
This commit is contained in:
@@ -92,6 +92,9 @@ func NewRouter(cfg config.Config, database *sql.DB, scanService *scanner.Service
|
||||
restGet(rest, "getLicense", func(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, subsonic.PingResponse())
|
||||
})
|
||||
restGet(rest, "getOpenSubsonicExtensions", func(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, subsonic.OpenSubsonicExtensionsResponse())
|
||||
})
|
||||
rest.Group(func(authed chi.Router) {
|
||||
authed.Use(application.requireSubsonicAuth)
|
||||
restGet(authed, "getArtists", application.subsonicArtists)
|
||||
@@ -103,7 +106,6 @@ func NewRouter(cfg config.Config, database *sql.DB, scanService *scanner.Service
|
||||
restGet(authed, "getSongsByGenre", application.subsonicSongsByGenre)
|
||||
restGet(authed, "getMusicFolders", application.subsonicMusicFolders)
|
||||
restGet(authed, "getGenres", application.subsonicGenres)
|
||||
restGet(authed, "getOpenSubsonicExtensions", application.subsonicOpenSubsonicExtensions)
|
||||
restGet(authed, "getPodcasts", application.subsonicPodcasts)
|
||||
restGet(authed, "getNewestPodcasts", application.subsonicNewestPodcasts)
|
||||
restGet(authed, "getInternetRadioStations", application.subsonicInternetRadioStations)
|
||||
|
||||
@@ -37,7 +37,7 @@ type Response struct {
|
||||
Podcasts *Podcasts `json:"podcasts,omitempty"`
|
||||
NewestPods *NewestPods `json:"newestPodcasts,omitempty"`
|
||||
RadioStations *RadioStations `json:"internetRadioStations,omitempty"`
|
||||
Extensions *Extensions `json:"openSubsonicExtensions,omitempty"`
|
||||
Extensions []Extension `json:"openSubsonicExtensions,omitempty"`
|
||||
ScanStatus *ScanStatus `json:"scanStatus,omitempty"`
|
||||
Error *ErrorRef `json:"error,omitempty"`
|
||||
}
|
||||
@@ -195,13 +195,9 @@ type RadioStations struct {
|
||||
InternetRadioStation []any `json:"internetRadioStation,omitempty"`
|
||||
}
|
||||
|
||||
type Extensions struct {
|
||||
Extension []Extension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
type Extension struct {
|
||||
Name string `json:"name"`
|
||||
Versions string `json:"versions"`
|
||||
Versions []int `json:"versions"`
|
||||
}
|
||||
|
||||
type ErrorRef struct {
|
||||
@@ -546,11 +542,9 @@ func InternetRadioStationsResponse() Envelope {
|
||||
|
||||
func OpenSubsonicExtensionsResponse() Envelope {
|
||||
response := PingResponse()
|
||||
response.SubsonicResponse.Extensions = &Extensions{
|
||||
Extension: []Extension{
|
||||
{Name: "formPost", Versions: "1"},
|
||||
{Name: "apiKeyAuthentication", Versions: "1"},
|
||||
},
|
||||
response.SubsonicResponse.Extensions = []Extension{
|
||||
{Name: "formPost", Versions: []int{1}},
|
||||
{Name: "apiKeyAuthentication", Versions: []int{1}},
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user