feat(subsonic): ping.view + getLicense.view handlers

This commit is contained in:
2026-04-19 17:38:34 +00:00
parent cdf56801cd
commit 2a75fc6687
+34
View File
@@ -0,0 +1,34 @@
package subsonic
import (
"encoding/xml"
"net/http"
)
// PingResponse is envelope-only; clients treat any ok response as success.
type PingResponse struct {
Envelope
}
func handlePing(w http.ResponseWriter, r *http.Request) {
Write(w, r, PingResponse{Envelope: NewEnvelope("ok")})
}
// LicenseResponse reports the (always-valid) self-hosted license. Many
// Subsonic clients refuse to stream until this endpoint returns valid=true.
type LicenseResponse struct {
Envelope
License License `json:"license" xml:"license"`
}
type License struct {
XMLName xml.Name `json:"-" xml:"license"`
Valid bool `json:"valid" xml:"valid,attr"`
}
func handleGetLicense(w http.ResponseWriter, r *http.Request) {
Write(w, r, LicenseResponse{
Envelope: NewEnvelope("ok"),
License: License{Valid: true},
})
}