logger, compiler logic, sse endpoints

This commit is contained in:
Maximilian Wagner
2025-12-25 20:05:33 +01:00
parent d9f7ead467
commit 891ebe0107
8 changed files with 110 additions and 26 deletions

View File

@@ -1,2 +1,32 @@
package frontend
import (
"net/http"
"fmt"
"git.noctra.dev/noctra/servtex/globals"
)
// Publishes Meta Information relating to last execution
// Does not use contained Mutex, ignore warning
func SSEStatus(writer http.ResponseWriter, request *http.Request) {
writer.Header().Set("Content-Type", "text/event-stream")
writer.Header().Set("Cache-Control", "no-cache")
writer.Header().Set("Connection", "keep-alive")
fmt.Fprintf(writer, "data: Execution Time: %s\n", globals.LatexExec.Timestamp)
fmt.Fprintf(writer, "data: Execution State: %s\n\n", globals.LatexExec.ExecutionState)
writer.(http.Flusher).Flush()
}
func SSEOutput(writer http.ResponseWriter, request *http.Request) {
writer.Header().Set("Content-Type", "text/event-stream")
writer.Header().Set("Cache-Control", "no-cache")
writer.Header().Set("Connection", "keep-alive")
fmt.Fprintf(writer, "data: Execution Time: %s\n", globals.LatexExec.Timestamp)
fmt.Fprintf(writer, "data: Execution State: %s\n\n", globals.LatexExec.ExecutionState)
writer.(http.Flusher).Flush()
}