Fix import cameras from Hass config
This commit is contained in:
+6
-1
@@ -1,6 +1,7 @@
|
|||||||
package hass
|
package hass
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/AlexxIT/go2rtc/cmd/api"
|
"github.com/AlexxIT/go2rtc/cmd/api"
|
||||||
@@ -62,12 +63,16 @@ func Init() {
|
|||||||
var options struct {
|
var options struct {
|
||||||
StreamSource string `json:"stream_source"`
|
StreamSource string `json:"stream_source"`
|
||||||
}
|
}
|
||||||
if err = json.Unmarshal(entrie.Data, &options); err != nil {
|
if err = json.Unmarshal(entrie.Options, &options); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
urls[entrie.Title] = options.StreamSource
|
urls[entrie.Title] = options.StreamSource
|
||||||
|
|
||||||
case "homekit_controller":
|
case "homekit_controller":
|
||||||
|
if !bytes.Contains(entrie.Data, []byte("iOSPairingId")) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
ClientID string `json:"iOSPairingId"`
|
ClientID string `json:"iOSPairingId"`
|
||||||
ClientPrivate string `json:"iOSDeviceLTSK"`
|
ClientPrivate string `json:"iOSDeviceLTSK"`
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func apiHandle(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "GET":
|
case "GET":
|
||||||
if Auth.UserData == nil {
|
if Auth.UserData == nil {
|
||||||
http.Error(w, "", http.StatusNotFound)
|
http.Error(w, "no auth", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user