diff --git a/internal/api/api.go b/internal/api/api.go index cf86300..4ef2bb0 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -1,9 +1,7 @@ package api import ( - "embed" "encoding/json" - "io/fs" "net" "net/http" "time" @@ -25,10 +23,7 @@ func Init() { HandleFunc("api/health", apiHealth) HandleFunc("api/log", apiLog) - // serve frontend from embedded web/ directory - if sub, err := fs.Sub(webFS, "web"); err == nil { - http.Handle("/", http.FileServer(http.FS(sub))) - } + initStatic() Handler = middlewareCORS(http.DefaultServeMux) @@ -39,9 +34,6 @@ func Init() { go listen_serve("tcp", listen) } -//go:embed web -var webFS embed.FS - func listen_serve(network, address string) { ln, err := net.Listen(network, address) if err != nil { diff --git a/internal/api/static.go b/internal/api/static.go new file mode 100644 index 0000000..012abbf --- /dev/null +++ b/internal/api/static.go @@ -0,0 +1,16 @@ +package api + +import ( + "net/http" + + "github.com/eduard256/strix/www" +) + +func initStatic() { + root := http.FS(www.Static) + fileServer := http.FileServer(root) + + HandleFunc("", func(w http.ResponseWriter, r *http.Request) { + fileServer.ServeHTTP(w, r) + }) +} diff --git a/internal/api/web/index.html b/internal/api/web/index.html deleted file mode 100644 index de2ed02..0000000 --- a/internal/api/web/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - -
- - -+ We are working on adding Apple HomeKit camera support to Strix, but we don't have HomeKit cameras available for testing. +
++ The device at this IP supports HomeKit protocol. If you'd like to help us add support for HomeKit cameras, please reach out. Your contribution would be greatly appreciated. +
+ + + +Camera Stream Discovery
+IP address of the camera
+Examples
+Camera channel number (0 for most cameras, 1+ for NVR)
+Only test streams on these ports. Leave empty to test all.
+