platform: modularize api/gui, add docs-tests-web foundation, and refresh root config

This commit is contained in:
beckline
2026-03-26 22:40:54 +03:00
parent 0e2d7f61ea
commit 6a56d734c2
562 changed files with 70151 additions and 16423 deletions

View File

@@ -0,0 +1,43 @@
package app
import (
"encoding/json"
"log"
"net/http"
"os"
)
func handleGetStatus(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
data, err := os.ReadFile(statusFilePath)
if err != nil {
if os.IsNotExist(err) {
http.Error(w, "status file not found", http.StatusNotFound)
return
}
http.Error(w, "failed to read status file", http.StatusInternalServerError)
return
}
var st Status
if err := json.Unmarshal(data, &st); err != nil {
http.Error(w, "invalid status.json", http.StatusInternalServerError)
return
}
if st.Iface != "" && st.Iface != "-" && st.Table != "" && st.Table != "-" {
ok, err := checkPolicyRoute(st.Iface, st.Table)
if err != nil {
log.Printf("checkPolicyRoute error: %v", err)
} else {
st.PolicyRouteOK = &ok
st.RouteOK = &ok
}
}
writeJSON(w, http.StatusOK, st)
}