Files
MeshTender/internal/web/templates/share.html
T
2026-06-20 13:24:07 -04:00

120 lines
4.4 KiB
HTML

{{define "title"}}Sharing · {{.Repeater.Name}} · MeshTender{{end}}
{{define "content"}}
{{if .Error}}<p class="error banner">{{.Error}}</p>{{end}}
<section class="card">
<h1>Sharing · “{{.Repeater.Name}}”</h1>
<p class="muted">
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>
</section>
<section class="card">
<h2 style="margin-top:0">Organizations</h2>
<p class="muted">
Contribute this repeater to an organization so its admins and members can run their permitted
commands on it over the mesh — but only the specific commands you review and approve first. You can
withdraw anytime.
</p>
<h3>Contributed to</h3>
{{if .Contributed}}
<ul class="repeaters">
{{range .Contributed}}
<li class="rhead">
<span class="rname">{{.OrgName}}</span>
<span class="muted">consented to v{{.ConsentedVersion}}{{if .NeedsReconsent}} · org is now on v{{.CurrentVersion}}{{end}}</span>
{{if .NeedsReconsent}}
<a class="btnlink" href="/repeaters/{{$.Repeater.ID}}/orgs/{{.OrgID}}/contribute">Review changes</a>
{{end}}
<form method="post" action="/repeaters/{{$.Repeater.ID}}/orgs/{{.OrgID}}/withdraw" class="inline" onsubmit="return confirm('Withdraw this repeater from {{.OrgName}}?')">
<button type="submit" class="link danger">Withdraw</button>
</form>
</li>
{{end}}
</ul>
{{else}}
<p class="muted">Not contributed to any organization.</p>
{{end}}
{{if .Available}}
<h3>Contribute to</h3>
<ul class="repeaters">
{{range .Available}}
<li class="rhead">
<span class="rname">{{.Name}}</span>
<a class="btnlink" style="margin-left:auto" href="/repeaters/{{$.Repeater.ID}}/orgs/{{.ID}}/contribute">Review &amp; contribute</a>
</li>
{{end}}
</ul>
{{else if .Contributed}}
{{else}}
<p class="muted">Join an organization to contribute this repeater to it.</p>
{{end}}
</section>
<section class="card">
<h2 style="margin-top:0">People</h2>
<p class="muted">
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>
<h3>Share links</h3>
<p class="muted">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.ID}}/share/link">
<label>Description (optional)
<input type="text" name="description" placeholder="e.g. for Bob's modem" maxlength="100">
</label>
<button type="submit" class="primary">Create single-use link</button>
</form>
{{if .Invites}}
<ul class="repeaters">
{{range .Invites}}
<li>
<div class="rhead">
<span class="rname">{{if .Description}}{{.Description}}{{else}}(no label){{end}}</span>
{{if .UsedAt}}<span class="badge ok">Used by {{.UsedByName}}</span>{{else}}<span class="badge pending">Unused</span>{{end}}
</div>
{{if not .UsedAt}}
<div class="copyrow">
<code id="link-{{.ID}}">{{$.BaseURL}}/invite/{{.Token}}</code>
<button type="button" onclick="navigator.clipboard.writeText(document.getElementById('link-{{.ID}}').textContent)">Copy</button>
</div>
{{end}}
<form method="post" action="/repeaters/{{$.Repeater.ID}}/share/link/delete" class="inline">
<input type="hidden" name="invite_id" value="{{.ID}}">
<button type="submit" class="link danger">{{if .UsedAt}}Remove from list{{else}}Revoke link{{end}}</button>
</form>
</li>
{{end}}
</ul>
{{else}}
<p class="muted">No links yet.</p>
{{end}}
<h3>People with access</h3>
{{if .Shares}}
<ul class="repeaters">
{{range .Shares}}
<li class="rhead">
<span class="rname">{{.Name}}</span>
<span class="muted">@{{.Username}}</span>
<a class="btnlink" style="margin-left:auto" href="/repeaters/{{$.Repeater.ID}}/share/{{.UserID}}/commands">Edit commands</a>
<form method="post" action="/repeaters/{{$.Repeater.ID}}/unshare" class="inline">
<input type="hidden" name="user_id" value="{{.UserID}}">
<button type="submit" class="link danger">Revoke</button>
</form>
</li>
{{end}}
</ul>
{{else}}
<p class="muted">No one has accepted yet.</p>
{{end}}
</section>
<p><a class="backlink" href="/">← Back to dashboard</a></p>
{{end}}