Files
wg/web/templates/admin_wg.html
T

84 lines
3.5 KiB
HTML

{{define "admin_wg.html"}}
<!DOCTYPE html>
<html lang="ru">
<head>
{{template "layout_head" .}}
<title>WireGuard — {{siteName}}</title>
</head>
<body>
<div class="bg-pattern"></div><div class="bg-glow"></div>
<div class="wrap">
<div class="nav">
<a href="/admin">← Админка</a>
<strong class="title">WireGuard .conf</strong>
<span style="flex:1"></span>
<a href="/logout">Выход</a>
</div>
{{if .Message}}
<div class="alert {{.MessageType}}">{{.Message}}{{if .NewToken}} · <code>{{.PublicURL}}{{.NewToken}}</code>{{end}}</div>
{{end}}
<div class="card">
<h1 style="font-size:1.1rem;margin-bottom:1rem">Загрузить .conf</h1>
<form method="POST" action="/admin/wg/upload" enctype="multipart/form-data">
<div class="form-group">
<label for="wg_conf">Файл WireGuard (.conf)</label>
<input id="wg_conf" type="file" name="wg_conf" accept=".conf" required>
</div>
<button class="btn" type="submit" name="submit_form" value="1">Сохранить</button>
</form>
</div>
<div class="card">
<h1 style="font-size:1.1rem;margin-bottom:1rem">Настройки скачивания</h1>
<form method="POST" action="/admin/wg/settings">
<div class="form-group" style="display:flex;gap:0.6rem;align-items:center">
<input type="checkbox" id="show_zip_full" name="show_zip_full" value="1" {{if .ShowZipFull}}checked{{end}}>
<label for="show_zip_full" style="margin:0;text-transform:none;font-family:var(--font-sans)">ZIP (conf + QR)</label>
</div>
<div class="form-group" style="display:flex;gap:0.6rem;align-items:center">
<input type="checkbox" id="show_zip_conf" name="show_zip_conf" value="1" {{if .ShowZipConf}}checked{{end}}>
<label for="show_zip_conf" style="margin:0;text-transform:none;font-family:var(--font-sans)">ZIP только conf</label>
</div>
<button class="btn btn-ghost" type="submit">Обновить настройки</button>
</form>
</div>
<div class="card">
<h1 style="font-size:1.1rem;margin-bottom:1rem">Конфиги</h1>
<table class="table">
<thead>
<tr><th>ID</th><th>Токен</th><th>Файл</th><th>Дата</th><th>Ссылка</th><th></th></tr>
</thead>
<tbody>
{{range .Configs}}
<tr>
<td>{{.ID}}</td>
<td><code>{{.Token}}</code></td>
<td>{{.OriginalFilename}}</td>
<td class="muted">{{.CreatedAt.Format "2006-01-02 15:04"}}</td>
<td><a style="color:var(--accent)" href="/wg?token={{.Token}}" target="_blank">открыть</a></td>
<td>
<form method="POST" action="/admin/wg/delete" onsubmit="return confirm('Удалить?')">
<input type="hidden" name="id" value="{{.ID}}">
<button class="btn btn-danger" type="submit">Удалить</button>
</form>
</td>
</tr>
{{else}}
<tr><td colspan="6" class="muted">Пока нет конфигов</td></tr>
{{end}}
</tbody>
</table>
<div class="pager">
{{if gt .Page 1}}<a class="btn btn-ghost" href="/admin/wg?page={{sub .Page 1}}"></a>{{end}}
<span class="muted">стр. {{.Page}} / {{.TotalPages}}</span>
{{if lt .Page .TotalPages}}<a class="btn btn-ghost" href="/admin/wg?page={{add .Page 1}}"></a>{{end}}
</div>
</div>
</div>
</body>
</html>
{{end}}