UX improvements

This commit is contained in:
raul 2024-06-07 08:31:52 +02:00
parent 5bde25c65f
commit 6a21d5bd0b
4 changed files with 44 additions and 15 deletions

View File

@ -75,5 +75,5 @@ func execCMD(c *gin.Context) {
return return
} }
prettyOut := strings.Replace(out, "\n", "<br>", -1) prettyOut := strings.Replace(out, "\n", "<br>", -1)
c.String(http.StatusOK, "$ "+prettyOut) c.String(http.StatusOK, "$ "+command+"<br>"+prettyOut)
} }

View File

@ -13,17 +13,26 @@
<body> <body>
<div class="container"> <div class="container">
<div id="main"> <div id="main">
<p>Hello {{ .UserAgent }}</p> <b>
<ul>
<li class="hor">
<p><a href="/">Home</a></p>
</li>
<li class="hor">
<p><a href="https://git.bulgariu.xyz/raul/aemet" target="_blank">Source code</a></p>
</li>
</ul>
</b>
<hr> <hr>
<h2>Executing commands for {{ .Client.ClientBasicInfo.Hostname }}</h2> <h2 align=center>Executing commands for {{ .Client.ClientBasicInfo.Hostname }}</h2>
<hr> <hr>
<div id=command> <div id=command>
</div> </div>
<br>
<form hx-post="/command/{{ .Client.ClientID }}" hx-target="#command" hx-on--after-request="this.reset()"> <form hx-post="/command/{{ .Client.ClientID }}" hx-target="#command" hx-on--after-request="this.reset()">
<label><input type="text" name="cmd" value=""></label> <label><input id="commandinput" type="text" name="cmd" value="" required autofocus></label>
<button type="submit" id="but">Submit</button> <button type="submit" id="but">Submit</button>
</form> </form>
<hr>
</div> </div>
</div> </div>
</body> </body>

View File

@ -13,7 +13,16 @@
<body> <body>
<div class="container"> <div class="container">
<div id="main"> <div id="main">
<p>Hello {{ .UserAgent }}</p> <b>
<ul>
<li class="hor">
<p><a href="/">Home</a></p>
</li>
<li class="hor">
<p><a href="https://git.bulgariu.xyz/raul/aemet" target="_blank">Source code</a></p>
</li>
</ul>
</b>
<hr> <hr>
<h2 align=center>Current clients</h2> <h2 align=center>Current clients</h2>
@ -26,9 +35,8 @@
<td>Username</td> <td>Username</td>
<td>Hostname</td> <td>Hostname</td>
<td>Operating System</td> <td>Operating System</td>
<td rowspan=2>Actions</td>
<td rowspan=2> <td rowspan=2>
<a target="_blank" href="command/{{ .ClientID }}">Execute commands</a> <a target="_blank" href="command/{{ .ClientID }}"><b>CMD</b></a>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -31,10 +31,9 @@ td.left {
padding-left: 5px; padding-left: 5px;
} }
td.date { td {
text-align: center; text-align: center;
padding-left: 5px; padding: 5px;
padding-right: 5px;
} }
on { on {
@ -99,9 +98,10 @@ form {
text-align: center; text-align: center;
} }
td a { td a.clickable {
display: block; display: block;
width: 100%; width: 100%;
margin: 0;
} }
a { a {
@ -139,13 +139,25 @@ footer {
} }
div#command { div#command {
width: 50%; width: 100%;
height: 40%; height: 50%;
border: 2px solid black; border: 2px solid black;
overflow: scroll; overflow: scroll;
padding-bottom: 30px;
text-wrap: nowrap; text-wrap: nowrap;
} }
input#commandinput {
width: 60%;
height: 20px;
}
input#commandinput:focus {
outline: 2px solid #ff6e00;
}
@media (max-width: 600px) { @media (max-width: 600px) {
#main { #main {
width: 60vw; width: 60vw;
@ -160,7 +172,7 @@ div#command {
top: 1px; top: 1px;
left: 1px; left: 1px;
outline: solid 1px black; /* outline: solid 1px black; */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 99vh; height: 99vh;