Fix API /api/homekit/accessories
This commit is contained in:
+11
-2
@@ -72,9 +72,18 @@ func apiHomekit(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func apiHomekitAccessories(w http.ResponseWriter, r *http.Request) {
|
func apiHomekitAccessories(w http.ResponseWriter, r *http.Request) {
|
||||||
src := r.URL.Query().Get("src")
|
id := r.URL.Query().Get("id")
|
||||||
stream := streams.Get(src)
|
stream := streams.Get(id)
|
||||||
|
if stream == nil {
|
||||||
|
http.Error(w, "", http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
rawURL := findHomeKitURL(stream.Sources())
|
rawURL := findHomeKitURL(stream.Sources())
|
||||||
|
if rawURL == "" {
|
||||||
|
http.Error(w, "", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
client, err := hap.Dial(rawURL)
|
client, err := hap.Dial(rawURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user