Files
MeshTender/internal/web/templates/console.html
T
2026-06-20 13:55:30 -04:00

56 lines
2.2 KiB
HTML

{{define "title"}}Console · {{.Repeater.Name}} · MeshTender{{end}}
{{define "header"}}
<div class="row g-2 align-items-center">
<div class="col">
<div class="page-pretitle">Console</div>
<h2 class="page-title">{{.Repeater.Name}}</h2>
</div>
</div>
{{end}}
{{define "content"}}
<div class="card">
<div class="card-body">
<p class="text-secondary">
Connect a MeshCore KISS modem and send commands to this repeater. You can run the commands listed
below; the server enforces what you're allowed to send.
</p>
<code class="pk">{{.Repeater.PublicKeyHex}}</code>
<div id="unsupported" class="alert alert-danger mt-3" hidden>
This browser does not support WebSerial. Use Chrome, Edge, or another Chromium-based browser over HTTPS or on localhost.
</div>
<button id="connect" class="btn btn-primary mt-3" type="button">{{template "icon-plug" "me-1"}}Connect modem</button>
<div class="row mt-3">
<div class="col-12 col-md-8">
<ul id="log" class="evlog console"></ul>
<form id="cmdform" class="input-group mt-3" autocomplete="off" hidden>
<input type="text" id="cmdinput" class="form-control font-monospace" placeholder="type a command, e.g. ver">
<button type="submit" id="cmdsend" class="btn btn-primary">Send</button>
</form>
</div>
<div class="col-12 col-md-4 mt-3 mt-md-0">
<div class="subheader mb-2">Allowed commands</div>
{{if .Commands}}
<div class="d-flex flex-column gap-1" style="max-height:320px;overflow-y:auto">
{{range .Commands}}
<button type="button" class="chip btn btn-sm w-100 text-start{{if .Risky}} btn-outline-danger{{end}}" data-template="{{.Template}}" title="{{.Args}}">{{.Template}}</button>
{{end}}
</div>
{{else}}
<p class="text-secondary">No commands allowed here yet.</p>
{{end}}
</div>
</div>
<a class="btn btn-link px-0 mt-3" href="/">{{template "icon-arrow-left" "me-1"}}Back to dashboard</a>
</div>
</div>
<script>
window.MESHTENDER_WS = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/repeaters/{{.Repeater.ID}}/console/ws";
</script>
<script src="/static/console.js"></script>
{{end}}