Добавление камеры на сервер
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// ===== EMBED WEB =====
|
||||
//
|
||||
//go:embed web/*
|
||||
var webFiles embed.FS
|
||||
|
||||
@@ -75,6 +76,12 @@ func (a *API) HandleHistory(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
func (a *API) HandleStream(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, map[string]string{
|
||||
"cam": "http://192.168.77.1:1984/stream.html?src=cam",
|
||||
})
|
||||
}
|
||||
|
||||
// ===== PIPE READER =====
|
||||
|
||||
func startPipeReader(ctx context.Context, buf *adapter.RingBuffer, path string) {
|
||||
@@ -137,7 +144,6 @@ func main() {
|
||||
|
||||
// ===== API =====
|
||||
http.Handle("/api/", http.StripPrefix("/api", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
switch r.URL.Path {
|
||||
case "/latest":
|
||||
cors(api.HandleLatest)(w, r)
|
||||
@@ -145,6 +151,8 @@ func main() {
|
||||
cors(api.HandleHistory)(w, r)
|
||||
case "/health":
|
||||
cors(api.HandleHealth)(w, r)
|
||||
case "/stream":
|
||||
cors(api.HandleStream)(w, r)
|
||||
default:
|
||||
http.Error(w, "not found", 404)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user