Compare commits

..

No commits in common. "8c8e06b0157c97ee1771f848ed363c6a0ed398be" and "8c3ee80b21278eaa6fb29f73b79c16d443923dfa" have entirely different histories.

2 changed files with 14 additions and 26 deletions

View File

@ -2,19 +2,16 @@ body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: clamp(0.5rem, 2vw, 1rem);
}
.xP {
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
height: 100vh;
/* https://caniuse.com/viewport-unit-variants */
height: 100dvh;
}
.title, .status {
padding: .05em .3em;
padding: .05rem .3rem;
background: #eee;
position: relative;
@ -55,11 +52,10 @@ body {
.list {
overflow-y: auto;
border-right: 1px solid #ccc;
min-width: 10em;
flex-shrink: 0;
min-width: 10rem;
}
.item {
padding: .05em .3em;
padding: .05rem .3rem;
cursor: default;
}
.item.highlighted {
@ -93,7 +89,7 @@ body {
overflow-y: auto;
}
.log {
padding: .1em .3em;
padding: .1rem .3rem;
font-family: monospace;
white-space: pre-wrap;
overflow-y: auto;
@ -103,7 +99,7 @@ body {
opacity: 50%;
}
.date {
padding: .3em;
padding: .3rem;
grid-column: span 2;
font-weight: bold;
}
@ -113,16 +109,16 @@ body {
background: #ff5f00;
}
.time {
padding: .1em .3em;
padding: .1rem .3rem;
background: #f8f8f8;
color: #bbb;
border-right: 1px solid #ccc;
}
.mark {
padding-right: .3em;
padding-right: .3rem;
text-align: center;
display: inline-block;
min-width: 2em;
min-width: 2rem;
}
.mark.error {
color: red;
@ -137,7 +133,7 @@ body {
color: darkred;
}
.content {
padding: .1em .3em;
padding: .1rem .3rem;
white-space: pre-wrap;
}
.content .b {
@ -158,7 +154,7 @@ body {
textarea {
font: inherit;
padding: .05em .3em;
padding: .05rem .3rem;
margin: 0;
border: 2px inset #eee;
flex-shrink: 0;

View File

@ -22,7 +22,6 @@ import (
var (
addressBind string
addressConnect string
addressWS string
)
func clientToRelay(
@ -145,7 +144,6 @@ var page = template.Must(template.New("/").Parse(`<!DOCTYPE html>
<head>
<title>xP</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="xP.css" />
</head>
<body>
@ -165,24 +163,18 @@ func handleDefault(w http.ResponseWriter, r *http.Request) {
return
}
wsURI := addressWS
if wsURI == "" {
wsURI = fmt.Sprintf("ws://%s/ws", r.Host)
}
wsURI := fmt.Sprintf("ws://%s/ws", r.Host)
if err := page.Execute(w, wsURI); err != nil {
log.Println("Template execution failed: " + err.Error())
}
}
func main() {
if len(os.Args) < 3 || len(os.Args) > 4 {
log.Fatalf("usage: %s BIND CONNECT [WSURI]\n", os.Args[0])
if len(os.Args) != 3 {
log.Fatalf("usage: %s BIND CONNECT\n", os.Args[0])
}
addressBind, addressConnect = os.Args[1], os.Args[2]
if len(os.Args) > 3 {
addressWS = os.Args[3]
}
http.Handle("/ws", websocket.Handler(handleWebSocket))
http.Handle("/", http.HandlerFunc(handleDefault))