Files
MeshTender/internal/core/templates/share_commands.html
T

54 lines
1.9 KiB
HTML

{{define "title"}}Commands for {{.Target.Name}} · MeshTender{{end}}
{{define "header"}}
<div class="row g-2 align-items-center">
<div class="col">
<div class="page-pretitle">Sharing</div>
<h2 class="page-title">Commands for {{.Target.Name}}</h2>
</div>
</div>
{{end}}
{{define "content"}}
<div class="card">
<div class="card-body">
<p class="text-secondary mb-0">
Choose which commands <strong>{{.Target.Name}}</strong> (@{{.Target.Username}}) may send to
“{{.Repeater.Name}}”. Risky commands can take over or brick the node — grant them only with care.
</p>
</div>
</div>
<form method="post" action="/repeaters/{{.Repeater.PublicID}}/share/{{.Target.ID}}/commands" id="cmdform-perms">
{{range .Groups}}
<div class="card mt-3">
<div class="card-header"><h3 class="card-title">{{.Name}}</h3></div>
<div class="card-body">
{{range .Commands}}
<label class="form-check">
<input class="form-check-input" type="checkbox" name="cmd" value="{{.ID}}" {{if .Checked}}checked{{end}} {{if .Risky}}data-risky="1"{{end}}>
<span class="form-check-label">
<code>{{.Template}}</code>
{{if .Risky}}<span class="badge bg-warning-lt">risky</span>{{end}}
{{if .Args}}<span class="text-secondary">{{.Args}}</span>{{end}}
</span>
</label>
{{end}}
</div>
</div>
{{end}}
<div class="btn-list mt-3">
<button type="submit" class="btn btn-primary">Save commands</button>
<a class="btn" href="/repeaters/{{.Repeater.PublicID}}/share">Cancel</a>
</div>
</form>
<script>
// Confirm before enabling a risky command.
document.querySelectorAll('input[data-risky]').forEach(function (cb) {
cb.addEventListener('change', function () {
if (cb.checked && !confirm('This command can take over, lock out, or brick the node. Grant it to this user?')) {
cb.checked = false;
}
});
});
</script>
{{end}}