From bc1a4ac8e4c48c4cd3182b512bf25964207e2ce5 Mon Sep 17 00:00:00 2001 From: Alex X Date: Mon, 10 Nov 2025 15:34:39 +0300 Subject: [PATCH] Fix API /api/homekit/accessories --- internal/homekit/api.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/homekit/api.go b/internal/homekit/api.go index 5d2b38d2..d46ace84 100644 --- a/internal/homekit/api.go +++ b/internal/homekit/api.go @@ -72,9 +72,18 @@ func apiHomekit(w http.ResponseWriter, r *http.Request) { } func apiHomekitAccessories(w http.ResponseWriter, r *http.Request) { - src := r.URL.Query().Get("src") - stream := streams.Get(src) + id := r.URL.Query().Get("id") + stream := streams.Get(id) + if stream == nil { + http.Error(w, "", http.StatusNotFound) + return + } + rawURL := findHomeKitURL(stream.Sources()) + if rawURL == "" { + http.Error(w, "", http.StatusBadRequest) + return + } client, err := hap.Dial(rawURL) if err != nil {