From 2720c1ba3fb4d57dc94a49a6a87188932071118e Mon Sep 17 00:00:00 2001 From: Zhi Wang Date: Tue, 11 Jan 2022 15:22:24 -0500 Subject: [PATCH] wip --- assets/index.html | 15 +++++++-------- assets/main.css | 26 +++++++++++++++++++++++--- assets/term.html | 15 ++++++++++++--- main.go | 17 ++++++++++++++--- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/assets/index.html b/assets/index.html index db10b35..4a6755a 100644 --- a/assets/index.html +++ b/assets/index.html @@ -10,19 +10,18 @@ Web Terminal - - - + +
-
diff --git a/assets/main.css b/assets/main.css index 04ec9ae..40a44fa 100644 --- a/assets/main.css +++ b/assets/main.css @@ -28,8 +28,28 @@ background-color: #ffffff20; } -h2 { - font-family: 'Fira Sans', sans-serif; - font-size: 32; +.banner { + position: absolute; + top: 0; + left: 0; + background-color: #0b0b33; + width: 100%; +} + +.banner-content { + font-family: sans-serif; + font-size: 22px; + padding: 0.5rem; + color: #ffffffff; text-align: center; +} + +.navbar-xs .navbar-brand { + padding: 0px 12px; + font-size: 22px; +} + +.navbar-xs .navbar-nav>li>a { + padding-top: 0px; + padding-bottom: 0px; } \ No newline at end of file diff --git a/assets/term.html b/assets/term.html index 6fa08cd..236e29b 100644 --- a/assets/term.html +++ b/assets/term.html @@ -22,10 +22,18 @@ -

{{.title}}

-
-
+ + +
+
+
+
+
+ + \ No newline at end of file diff --git a/main.go b/main.go index b7278a8..fa29c1e 100644 --- a/main.go +++ b/main.go @@ -57,12 +57,23 @@ func main() { rt.LoadHTMLGlob("./assets/*.html") rt.GET("/view/*sname", func(c *gin.Context) { - c.HTML(http.StatusOK, "index.html", gin.H{ + c.HTML(http.StatusOK, "term.html", gin.H{ "title": "Viewer terminal", "path": "/ws_view", }) }) + rt.GET("/new", func(c *gin.Context) { + if host == nil { + host = &c.Request.Host + } + + c.HTML(http.StatusOK, "term.html", gin.H{ + "title": "Interactive terminal", + "path": "/ws_do", + }) + }) + rt.GET("/ws_do", func(c *gin.Context) { term_conn.ConnectTerm(c.Writer, c.Request, false, cmdToExec) }) @@ -75,12 +86,12 @@ func main() { rt.Static("/assets", "./assets") rt.GET("/", func(c *gin.Context) { + host = &c.Request.Host + c.HTML(http.StatusOK, "index.html", gin.H{ "title": "Interactive terminal", "path": "/ws_do", }) - - host = &c.Request.Host }) term_conn.Init(checkOrigin)