Fix import cameras from Hass config

This commit is contained in:
Alexey Khit
2023-03-19 16:53:36 +03:00
parent 43840576ea
commit 7c79c1ff26
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -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"`
+1 -1
View File
@@ -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
}