Add API Server (Go/PocketBase), Web App (Go BFF + Vue), Fly App (Flutter/DJI MSDK), Adobe Plugin, and Docker/Docker AIO deployment configs. Design assets and build artifacts are gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
570 B
Go
23 lines
570 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
// POST /api/telemetry?id=<deviceId> — HTTP alternative to the websocket for
|
|
// pushing a single event (handy for testing with curl).
|
|
func (s *Server) handleTelemetryPost(w http.ResponseWriter, r *http.Request) {
|
|
id := r.URL.Query().Get("id")
|
|
if id == "" {
|
|
id = "default"
|
|
}
|
|
var raw map[string]any
|
|
if err := json.NewDecoder(r.Body).Decode(&raw); err != nil {
|
|
writeError(w, http.StatusBadRequest, "invalid json")
|
|
return
|
|
}
|
|
s.hub.Ingest(id, raw)
|
|
writeJSON(w, http.StatusOK, map[string]any{"ok": true})
|
|
}
|