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

131 lines
6.2 KiB
HTML

{{define "title"}}Sharing · {{.Repeater.Name}} · MeshTender{{end}}
{{define "header"}}{{template "repeater-header" .Nav}}{{end}}
{{define "content"}}
{{template "repeater-tabs" .Nav}}
{{if .Error}}<div class="alert alert-danger">{{.Error}}</div>{{end}}
<div class="card">
<div class="card-body">
<p class="text-secondary mb-0">
Decide who can operate this repeater. Everyone you grant access uses MeshTender's single identity, so
you never hand out keys — and you can revoke or withdraw at any time.
</p>
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<h3 class="card-title">Organizations</h3>
<p class="text-secondary">
This repeater is shared with every organization you belong to, so their admins and members can run
the commands those organizations are permitted to run on it. Opt it out of any organization here. To
limit which commands an organization may run across all your shared repeaters, use
<strong>Actions &rarr; Limit commands</strong> on that organization's page.
</p>
{{if .Orgs}}
<div class="list-group list-group-flush">
{{range .Orgs}}
<div class="list-group-item d-flex align-items-center flex-wrap gap-2 px-0">
<span class="fw-bold">{{.OrgName}}</span>
{{if .Excluded}}
<span class="badge bg-secondary-lt">Opted out</span>
{{else}}
<span class="badge bg-success-lt">Shared</span>
{{end}}
<form method="post" action="/repeaters/{{$.Repeater.PublicID}}/orgs/{{.OrgSlug}}/participation" class="m-0 ms-auto">
{{if .Excluded}}
<input type="hidden" name="action" value="include">
<button type="submit" class="btn btn-sm">Share with {{.OrgName}}</button>
{{else}}
<input type="hidden" name="action" value="exclude">
<button type="submit" class="btn btn-sm btn-ghost-danger" data-confirm="Opt this repeater out of {{.OrgName}}?">Opt out</button>
{{end}}
</form>
</div>
{{end}}
</div>
{{else}}
<p class="text-secondary">Join an organization to share this repeater with it.</p>
{{end}}
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<h3 class="card-title">People</h3>
<p class="text-secondary">
Share single-use links with specific people. The recipient signs in and accepts to control this
repeater from their own browser-connected KISS modem.
</p>
<div class="subheader mt-3 mb-2">Share links</div>
<p class="text-secondary">Each link works once. Mint one per person and label it so you remember who it's for.</p>
<form method="post" action="/repeaters/{{.Repeater.PublicID}}/share/link">
<div class="mb-3">
<label class="form-label" for="share_description">Description <span class="text-secondary">(optional)</span></label>
<input type="text" class="form-control" id="share_description" name="description" placeholder="e.g. for Bob's modem" maxlength="100">
</div>
<button type="submit" class="btn btn-primary">Create single-use link</button>
</form>
{{if .Invites}}
<div class="list-group list-group-flush mt-3">
{{range .Invites}}
<div class="list-group-item px-0">
<div class="d-flex align-items-center gap-2 mb-1">
<span class="fw-bold">{{if .Description}}{{.Description}}{{else}}(no label){{end}}</span>
{{if .UsedAt}}<span class="badge bg-success-lt">Used by {{.UsedByName}}</span>{{else}}<span class="badge bg-yellow-lt">Unused</span>{{end}}
</div>
{{if not .UsedAt}}
<div class="input-group mb-2">
<code class="form-control font-monospace" id="link-{{.ID}}">{{$.BaseURL}}/invite/{{.Token}}</code>
<button type="button" class="btn" data-copy-target="#link-{{.ID}}">{{template "icon-copy" ""}}Copy</button>
</div>
{{end}}
<form method="post" action="/repeaters/{{$.Repeater.PublicID}}/share/link/delete" class="m-0">
<input type="hidden" name="invite_id" value="{{.ID}}">
<button type="submit" class="btn btn-sm btn-ghost-danger">{{if .UsedAt}}Remove from list{{else}}Revoke link{{end}}</button>
</form>
</div>
{{end}}
</div>
{{else}}
<p class="text-secondary mt-2">No links yet.</p>
{{end}}
<div class="subheader mt-3 mb-2">People with access</div>
<p class="text-secondary">
Mark a trusted person a <strong>steward</strong> to make them a co-operator: they can run
<strong>every</strong> command (including risky ones), just like you, and they're listed as a
backup maintainer on this repeater's public page — so the network knows who can service it if
you can't. Everyone else only gets the specific commands you grant them.
</p>
{{if .Shares}}
<div class="list-group list-group-flush">
{{range .Shares}}
<div class="list-group-item d-flex align-items-center flex-wrap gap-2 px-0">
<span class="fw-bold">{{.Name}}</span>
<span class="text-secondary">@{{.Username}}</span>
{{if .Steward}}<span class="badge bg-azure-lt" title="Co-operator: can run every command, including risky ones">Steward · full access</span>{{end}}
<form method="post" action="/repeaters/{{$.Repeater.PublicID}}/share/{{.UserID}}/steward" class="m-0 ms-auto">
<input type="hidden" name="steward" value="{{if .Steward}}0{{else}}1{{end}}">
<button type="submit" class="btn btn-sm"{{if not .Steward}} data-confirm="Make this person a steward? They will be able to run every command on this repeater, including risky ones."{{end}}>{{if .Steward}}Remove as steward{{else}}Make steward{{end}}</button>
</form>
{{if not .Steward}}<a class="btn btn-sm" href="/repeaters/{{$.Repeater.PublicID}}/share/{{.UserID}}/commands">Edit commands</a>{{end}}
<form method="post" action="/repeaters/{{$.Repeater.PublicID}}/unshare" class="m-0">
<input type="hidden" name="user_id" value="{{.UserID}}">
<button type="submit" class="btn btn-sm btn-ghost-danger">Revoke</button>
</form>
</div>
{{end}}
</div>
{{else}}
<p class="text-secondary">No one has accepted yet.</p>
{{end}}
</div>
</div>
<a class="back-link mt-3" href="/">{{template "icon-arrow-left" "me-1"}}Back to dashboard</a>
{{end}}