33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
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()
|
|
}
|
|
|