mirror of
https://github.com/syssecfsu/witty.git
synced 2025-01-12 05:02:34 +01:00
wip
This commit is contained in:
parent
91a18a3ff8
commit
2720c1ba3f
@ -10,19 +10,18 @@
|
|||||||
<title>Web Terminal</title>
|
<title>Web Terminal</title>
|
||||||
|
|
||||||
<!-- Bootstrap core CSS -->
|
<!-- Bootstrap core CSS -->
|
||||||
<link href="external/bootstrap.min.css" rel="stylesheet">
|
<link href="/assets/external/bootstrap.min.css" rel="stylesheet">
|
||||||
</script>
|
<link href="/assets/main.css" rel="stylesheet">
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-dark bg-dark shadow-sm">
|
<nav class="navbar navbar-dark bg-dark shadow-sm navbar-xs">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand">
|
<a class="navbar-brand">
|
||||||
<img src="logo.svg" style="margin-left: 3em;margin-right: 3em;" width="48" height="36"
|
<img src="/assets/logo.svg" style="margin-left: 2em;margin-right: 1em;" height="24"
|
||||||
class="d-inline-block align-text-top" />
|
class="d-inline-block align-text-top">
|
||||||
<strong>A web-based terminal emulator</strong></a>
|
Web-based Terminal Emulator
|
||||||
<a class="btn btn-primary float-end" href="{{.url}}" role="button">New Session</a>
|
<a class="btn btn-primary btn-sm float-end" href="/new" role="button">New Session</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -28,8 +28,28 @@
|
|||||||
background-color: #ffffff20;
|
background-color: #ffffff20;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
.banner {
|
||||||
font-family: 'Fira Sans', sans-serif;
|
position: absolute;
|
||||||
font-size: 32;
|
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;
|
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;
|
||||||
|
}
|
@ -22,10 +22,18 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h2>{{.title}}</h2>
|
<div class="banner">
|
||||||
|
<div class="banner-content">
|
||||||
|
{{.title}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 7em;">
|
||||||
<div id="terminal">
|
<div id="terminal">
|
||||||
<div id="terminal_view"></div>
|
<div id="terminal_view"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
term = createTerminal("{{.path}}");
|
term = createTerminal("{{.path}}");
|
||||||
// print something to test output and scroll
|
// print something to test output and scroll
|
||||||
@ -41,6 +49,7 @@
|
|||||||
|
|
||||||
term.writeln(str);
|
term.writeln(str);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
17
main.go
17
main.go
@ -57,12 +57,23 @@ func main() {
|
|||||||
rt.LoadHTMLGlob("./assets/*.html")
|
rt.LoadHTMLGlob("./assets/*.html")
|
||||||
|
|
||||||
rt.GET("/view/*sname", func(c *gin.Context) {
|
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",
|
"title": "Viewer terminal",
|
||||||
"path": "/ws_view",
|
"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) {
|
rt.GET("/ws_do", func(c *gin.Context) {
|
||||||
term_conn.ConnectTerm(c.Writer, c.Request, false, cmdToExec)
|
term_conn.ConnectTerm(c.Writer, c.Request, false, cmdToExec)
|
||||||
})
|
})
|
||||||
@ -75,12 +86,12 @@ func main() {
|
|||||||
rt.Static("/assets", "./assets")
|
rt.Static("/assets", "./assets")
|
||||||
|
|
||||||
rt.GET("/", func(c *gin.Context) {
|
rt.GET("/", func(c *gin.Context) {
|
||||||
|
host = &c.Request.Host
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "index.html", gin.H{
|
c.HTML(http.StatusOK, "index.html", gin.H{
|
||||||
"title": "Interactive terminal",
|
"title": "Interactive terminal",
|
||||||
"path": "/ws_do",
|
"path": "/ws_do",
|
||||||
})
|
})
|
||||||
|
|
||||||
host = &c.Request.Host
|
|
||||||
})
|
})
|
||||||
|
|
||||||
term_conn.Init(checkOrigin)
|
term_conn.Init(checkOrigin)
|
||||||
|
Loading…
Reference in New Issue
Block a user