replay UI is almost done

This commit is contained in:
Zhi Wang 2022-01-15 07:13:42 -05:00
parent 7a65c02495
commit c144151c42
3 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#terminal { #terminal {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin: 10px 0 20px; margin: 10px 0 10px;
} }
#terminal #terminal_view { #terminal #terminal_view {

View File

@ -47,7 +47,7 @@
btn.innerHTML = btn.value btn.innerHTML = btn.value
fetch("/record/{{.id}}") fetch("/record/{{.id}}")
} else { } else {
btn.value = "Record"; btn.value = "Record";
btn.innerHTML = btn.value btn.innerHTML = btn.value
fetch("/stop/{{.id}}") fetch("/stop/{{.id}}")
} }
@ -58,12 +58,12 @@
// print something to test output and scroll // print something to test output and scroll
var str = [ var str = [
' ┌────────────────────────────────────────────────────────────────────────────┐\n', ' ┌────────────────────────────────────────────────────────────────────────────┐\n',
' │ Powered by \u001b[32;1mGo, Gin, websocket, pty, and xterm.js\x1b[0m │\n', ' │ \u001b[32;1mhttps://github.com/syssecfsu/witty\x1b[0m <- click it! \n',
' └────────────────────────────────────────────────────────────────────────────┘\n', ' └────────────────────────────────────────────────────────────────────────────┘\n',
'' ''
].join(''); ].join('');
term.writeln(str); term.writeln (str)
} }
Init() Init()

View File

@ -131,6 +131,13 @@ func main() {
term_conn.StopRecord(id) term_conn.StopRecord(id)
}) })
// create a viewer of an interactive session
rt.GET("/replay/*id", func(c *gin.Context) {
id := c.Param("id")
log.Println("replay/ called with", id)
c.HTML(http.StatusOK, "replay.html", nil)
})
// handle static files // handle static files
rt.Static("/assets", "./assets") rt.Static("/assets", "./assets")