From 1a9dcc04b435cdaec2e78951c3efd8c7016a2247 Mon Sep 17 00:00:00 2001 From: Brian Harrison Date: Tue, 7 Apr 2026 19:33:29 -0400 Subject: [PATCH] feat: add webapp --- sfm/server.py | 9 +- sfm/sfm_webapp.html | 1110 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1118 insertions(+), 1 deletion(-) create mode 100644 sfm/sfm_webapp.html diff --git a/sfm/server.py b/sfm/server.py index 2ea6789..e257038 100644 --- a/sfm/server.py +++ b/sfm/server.py @@ -36,13 +36,14 @@ from __future__ import annotations import logging import sys +from pathlib import Path from typing import Optional # FastAPI / Pydantic try: from fastapi import Body, FastAPI, HTTPException, Query from fastapi.middleware.cors import CORSMiddleware - from fastapi.responses import JSONResponse + from fastapi.responses import FileResponse, JSONResponse from pydantic import BaseModel import uvicorn except ImportError: @@ -246,6 +247,12 @@ def health() -> dict: return {"status": "ok", "service": "sfm", "version": "0.1.0"} +@app.get("/", response_class=FileResponse) +def webapp(): + """Serve the SFM web app.""" + return str(Path(__file__).parent / "sfm_webapp.html") + + @app.get("/device/info") def device_info( port: Optional[str] = Query(None, description="Serial port (e.g. COM5, /dev/ttyUSB0)"), diff --git a/sfm/sfm_webapp.html b/sfm/sfm_webapp.html new file mode 100644 index 0000000..c99efc5 --- /dev/null +++ b/sfm/sfm_webapp.html @@ -0,0 +1,1110 @@ + + + + + + SFM — Seismograph Field Module + + + + + + +
+
SFM Seismograph Field Module
+
+
+ + +
+
+ + + + +
+ +
+ + +
+
+ Serial + +
+
+ Firmware + +
+
+ Sample rate + +
+
+ Record time + +
+
+ Trigger + +
+
+ Events + +
+
+ Project + +
+
+ Client + +
+
+ Operator + +
+
+ + +
Ready — enter device host and click Connect.
+ + +
+ + + +
+ + +
+
+
Connect to a device to view its information.
+ +
+
+ + +
+ +
+ + + +
+
+ +
+
Tran
+
Vert
+
Long
+
MicL
+
PVS
+
+ +
+
+ + + +

No waveform loaded

+
+ +
+
+ + +
+ +
+ + +
+
Recording
+ +
+ + +
+ +
+ + +
Waveform capture duration per trigger event
+
+ +
+ + +
Recording starts when any geo channel exceeds this level
+
+ +
+ + +
Alarm flagged when any geo channel exceeds this level
+
+ +
+ + +
Full-scale calibration constant — only change if you have a cal cert
+
+
+ + +
+
Project Info
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + +
+ +
+ + + + +