logger, compiler logic, sse endpoints
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<iframe class="pdf-frame" src="servetex.pdf?ts=0" hx-sse="connect:/sse/pdf" hx-swap="outerHTML"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="command-out">
|
||||
<div class="command-out" hx-sse="connect:/sse/status" hx-swap="innerHTML">
|
||||
compile start
|
||||
compile file-x
|
||||
compile file-y
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user