diff --git a/trusted_applet/main.go b/trusted_applet/main.go index cdebeef..345b226 100644 --- a/trusted_applet/main.go +++ b/trusted_applet/main.go @@ -328,6 +328,17 @@ func runWithNetworking(ctx context.Context) error { w.Header().Add("Content-Type", "text/plain") w.Write([]byte("ok, check /consolelog!")) }) + srvMux.HandleFunc("/status", func(w http.ResponseWriter, _ *http.Request) { + var s api.Status + if err := syscall.Call("RPC.Status", nil, &s); err != nil { + w.Header().Add("Content-Type", "text/plain") + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(err.Error())) + return + } + w.Header().Add("Content-Type", "text/plain") + w.Write([]byte(s.Print())) + }) srv := &http.Server{ ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second,