Add frontend pages, move static to www/, add resolution to tester
Frontend: - index.html: probe device, navigate to standard/homekit by type - standard.html: camera config, model search with multi-select - create.html: stream URL list, custom URL input, create test session - homekit.html: HomeKit device info, contact links, fallback to standard Backend: - Move static files to www/ package with embed (go2rtc pattern) - Add initStatic() in api with FileServer - Add width/height to test results from H264 SPS parsing - Contribute links to gostrix.github.io with auto-filled params
This commit is contained in:
+1
-9
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Strix</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: monospace; background: #1a1a1a; color: #e0e0e0; display: flex; align-items: center; justify-content: center; height: 100vh; }
|
||||
h1 { font-size: 24px; color: #888; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Strix 2.0</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user