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) {
|
restGet(rest, "getLicense", func(w http.ResponseWriter, r *http.Request) {
|
||||||
writeJSON(w, http.StatusOK, subsonic.PingResponse())
|
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) {
|
rest.Group(func(authed chi.Router) {
|
||||||
authed.Use(application.requireSubsonicAuth)
|
authed.Use(application.requireSubsonicAuth)
|
||||||
restGet(authed, "getArtists", application.subsonicArtists)
|
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, "getSongsByGenre", application.subsonicSongsByGenre)
|
||||||
restGet(authed, "getMusicFolders", application.subsonicMusicFolders)
|
restGet(authed, "getMusicFolders", application.subsonicMusicFolders)
|
||||||
restGet(authed, "getGenres", application.subsonicGenres)
|
restGet(authed, "getGenres", application.subsonicGenres)
|
||||||
restGet(authed, "getOpenSubsonicExtensions", application.subsonicOpenSubsonicExtensions)
|
|
||||||
restGet(authed, "getPodcasts", application.subsonicPodcasts)
|
restGet(authed, "getPodcasts", application.subsonicPodcasts)
|
||||||
restGet(authed, "getNewestPodcasts", application.subsonicNewestPodcasts)
|
restGet(authed, "getNewestPodcasts", application.subsonicNewestPodcasts)
|
||||||
restGet(authed, "getInternetRadioStations", application.subsonicInternetRadioStations)
|
restGet(authed, "getInternetRadioStations", application.subsonicInternetRadioStations)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ type Response struct {
|
|||||||
Podcasts *Podcasts `json:"podcasts,omitempty"`
|
Podcasts *Podcasts `json:"podcasts,omitempty"`
|
||||||
NewestPods *NewestPods `json:"newestPodcasts,omitempty"`
|
NewestPods *NewestPods `json:"newestPodcasts,omitempty"`
|
||||||
RadioStations *RadioStations `json:"internetRadioStations,omitempty"`
|
RadioStations *RadioStations `json:"internetRadioStations,omitempty"`
|
||||||
Extensions *Extensions `json:"openSubsonicExtensions,omitempty"`
|
Extensions []Extension `json:"openSubsonicExtensions,omitempty"`
|
||||||
ScanStatus *ScanStatus `json:"scanStatus,omitempty"`
|
ScanStatus *ScanStatus `json:"scanStatus,omitempty"`
|
||||||
Error *ErrorRef `json:"error,omitempty"`
|
Error *ErrorRef `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -195,13 +195,9 @@ type RadioStations struct {
|
|||||||
InternetRadioStation []any `json:"internetRadioStation,omitempty"`
|
InternetRadioStation []any `json:"internetRadioStation,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Extensions struct {
|
|
||||||
Extension []Extension `json:"extension,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Extension struct {
|
type Extension struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Versions string `json:"versions"`
|
Versions []int `json:"versions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ErrorRef struct {
|
type ErrorRef struct {
|
||||||
@@ -546,11 +542,9 @@ func InternetRadioStationsResponse() Envelope {
|
|||||||
|
|
||||||
func OpenSubsonicExtensionsResponse() Envelope {
|
func OpenSubsonicExtensionsResponse() Envelope {
|
||||||
response := PingResponse()
|
response := PingResponse()
|
||||||
response.SubsonicResponse.Extensions = &Extensions{
|
response.SubsonicResponse.Extensions = []Extension{
|
||||||
Extension: []Extension{
|
{Name: "formPost", Versions: []int{1}},
|
||||||
{Name: "formPost", Versions: "1"},
|
{Name: "apiKeyAuthentication", Versions: []int{1}},
|
||||||
{Name: "apiKeyAuthentication", Versions: "1"},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user