Files
wg/web/templates/wg_public.html
T

42 lines
1.6 KiB
HTML

{{define "wg_public.html"}}
<!DOCTYPE html>
<html lang="ru">
<head>
{{template "layout_head" .}}
<title>{{.FileName}}</title>
</head>
<body>
<div class="bg-pattern"></div><div class="bg-glow"></div>
<div class="wrap" style="max-width:560px">
<div class="nav">
<h1 style="font-size:1.2rem">{{.FileName}}</h1>
</div>
<div class="alert success">Конфиг готов.</div>
{{if .QR}}
<div class="card center qr">
<h1 style="font-size:1rem;margin-bottom:1rem">Отсканируйте QR-код</h1>
<img src="{{.QR}}" width="300" height="300" alt="QR">
</div>
{{end}}
<div class="center" style="margin-bottom:1.25rem">
{{if .ShowZipFull}}<a class="btn" href="/wg?token={{.Token}}&download=full">ZIP (conf + QR)</a>{{end}}
{{if .ShowZipConf}}<a class="btn btn-ghost" href="/wg?token={{.Token}}&download=conf">ZIP только conf</a>{{end}}
</div>
<div class="card">
<h1 style="font-size:1rem;margin-bottom:0.8rem">Текст конфигурации</h1>
<pre class="config" id="cfg">{{.Config}}</pre>
<button class="btn btn-ghost" style="margin-top:0.8rem" type="button" id="copyBtn">Копировать</button>
</div>
</div>
<script>
document.getElementById('copyBtn')?.addEventListener('click', async function() {
const t = document.getElementById('cfg')?.textContent || '';
try { await navigator.clipboard.writeText(t); this.textContent = 'Скопировано'; }
catch(e) { this.textContent = 'Ошибка'; }
setTimeout(() => this.textContent = 'Копировать', 2000);
});
</script>
</body>
</html>
{{end}}