feat(subsonic): ping.view + getLicense.view handlers
This commit is contained in:
@@ -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},
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user