From 7c79c1ff2651542596efd8080812c19b773e4e79 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sun, 19 Mar 2023 16:53:36 +0300 Subject: [PATCH] Fix import cameras from Hass config --- cmd/hass/hass.go | 7 ++++++- cmd/roborock/roborock.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/hass/hass.go b/cmd/hass/hass.go index dc29b979..79c8be88 100644 --- a/cmd/hass/hass.go +++ b/cmd/hass/hass.go @@ -1,6 +1,7 @@ package hass import ( + "bytes" "encoding/json" "fmt" "github.com/AlexxIT/go2rtc/cmd/api" @@ -62,12 +63,16 @@ func Init() { var options struct { StreamSource string `json:"stream_source"` } - if err = json.Unmarshal(entrie.Data, &options); err != nil { + if err = json.Unmarshal(entrie.Options, &options); err != nil { continue } urls[entrie.Title] = options.StreamSource case "homekit_controller": + if !bytes.Contains(entrie.Data, []byte("iOSPairingId")) { + continue + } + var data struct { ClientID string `json:"iOSPairingId"` ClientPrivate string `json:"iOSDeviceLTSK"` diff --git a/cmd/roborock/roborock.go b/cmd/roborock/roborock.go index 7e719c8f..6e3457b7 100644 --- a/cmd/roborock/roborock.go +++ b/cmd/roborock/roborock.go @@ -35,7 +35,7 @@ func apiHandle(w http.ResponseWriter, r *http.Request) { switch r.Method { case "GET": if Auth.UserData == nil { - http.Error(w, "", http.StatusNotFound) + http.Error(w, "no auth", http.StatusNotFound) return }