Add VPN client users with inbound access and subscription links.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{.Title}} · VPN Panel</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
</head>
|
||||
<body class="page-admin">
|
||||
<aside class="sidebar">
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a href="/admin">Обзор</a>
|
||||
<a class="active" href="/admin/clients">Пользователи</a>
|
||||
<a href="/admin/nodes">Ноды</a>
|
||||
<a href="/admin/profiles">Профили</a>
|
||||
<a href="/admin/protocols">Протоколы</a>
|
||||
</nav>
|
||||
<div class="sidebar-foot">
|
||||
<span class="user-chip">{{.UserName}}</span>
|
||||
<form method="POST" action="/logout"><button type="submit" class="link-btn">Выйти</button></form>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="admin-main">
|
||||
<header class="admin-header">
|
||||
<h1>Новый пользователь</h1>
|
||||
<p class="muted">Создайте VPN-клиента и назначьте инбаунды</p>
|
||||
</header>
|
||||
{{if .Error}}<div class="alert">{{.Error}}</div>{{end}}
|
||||
|
||||
<form class="form-card" method="POST" action="/admin/clients/new">
|
||||
<div class="form-grid">
|
||||
<label>Username *
|
||||
<input name="username" required value="{{.Form.Username}}" placeholder="user1" autofocus>
|
||||
</label>
|
||||
<label>Email
|
||||
<input name="email" type="email" value="{{.Form.Email}}" placeholder="optional@mail.com">
|
||||
</label>
|
||||
<label>Статус
|
||||
<select name="status">
|
||||
<option value="active" selected>Активен</option>
|
||||
<option value="disabled">Отключён</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Лимит трафика (GB, 0 = ∞)
|
||||
<input name="traffic_limit_gb" type="number" step="0.1" min="0" value="{{.Form.TrafficLimitGB}}" placeholder="0">
|
||||
</label>
|
||||
<label>Истекает
|
||||
<input name="expire_at" type="datetime-local" value="{{.Form.ExpireAt}}">
|
||||
</label>
|
||||
<label>Заметка
|
||||
<input name="note" value="{{.Form.Note}}" placeholder="опционально">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<fieldset class="mode-pick">
|
||||
<legend>Инбаунды</legend>
|
||||
{{if .Inbounds}}
|
||||
{{range .Inbounds}}
|
||||
<label class="radio">
|
||||
<input type="checkbox" name="inbound_ids" value="{{.ID}}">
|
||||
<span><code>{{.Tag}}</code> · {{.ProtocolName}} :{{.Port}} ({{.Network}}/{{.Security}})</span>
|
||||
</label>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<p class="muted">Сначала создайте профиль и добавьте inbound.</p>
|
||||
{{end}}
|
||||
</fieldset>
|
||||
|
||||
<div class="cta-row">
|
||||
<button class="btn btn-primary" type="submit">Создать</button>
|
||||
<a class="btn btn-ghost" href="/admin/clients">Отмена</a>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{.Title}} · VPN Panel</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
</head>
|
||||
<body class="page-admin">
|
||||
<aside class="sidebar">
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a href="/admin">Обзор</a>
|
||||
<a class="active" href="/admin/clients">Пользователи</a>
|
||||
<a href="/admin/nodes">Ноды</a>
|
||||
<a href="/admin/profiles">Профили</a>
|
||||
<a href="/admin/protocols">Протоколы</a>
|
||||
</nav>
|
||||
<div class="sidebar-foot">
|
||||
<span class="user-chip">{{.UserName}}</span>
|
||||
<form method="POST" action="/logout"><button type="submit" class="link-btn">Выйти</button></form>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="admin-main">
|
||||
<header class="admin-header row-head">
|
||||
<div>
|
||||
<h1>{{.Client.Username}}</h1>
|
||||
<p class="muted"><code>{{.Client.UUID}}</code></p>
|
||||
</div>
|
||||
<span class="badge {{statusClass (printf "%s" .Client.Status)}}">{{.Client.StatusLabel}}</span>
|
||||
</header>
|
||||
|
||||
{{if .Flash}}<div class="alert ok">{{.Flash}}</div>{{end}}
|
||||
{{if .Error}}<div class="alert">{{.Error}}</div>{{end}}
|
||||
|
||||
<div class="cta-row" style="margin-bottom:1.25rem">
|
||||
<form method="POST" action="/admin/clients/{{.Client.ID}}/toggle">
|
||||
<button class="btn btn-ghost" type="submit">{{if eq (printf "%s" .Client.Status) "active"}}Отключить{{else}}Включить{{end}}</button>
|
||||
</form>
|
||||
<form method="POST" action="/admin/clients/{{.Client.ID}}/delete" onsubmit="return confirm('Удалить пользователя?');">
|
||||
<button class="btn btn-ghost" type="submit">Удалить</button>
|
||||
</form>
|
||||
<a class="btn btn-ghost" href="/admin/clients">К списку</a>
|
||||
</div>
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Subscription</h2>
|
||||
<p class="muted">Ссылка для клиента (нужны online-ноды с назначенным профилем и включёнными inbound):</p>
|
||||
<pre class="code-block">{{.SubURL}}</pre>
|
||||
{{if .Links}}
|
||||
<h3 style="margin-top:1rem;font-size:1rem">Сгенерированные ссылки</h3>
|
||||
<pre class="code-block log">{{range .Links}}{{.}}
|
||||
{{end}}</pre>
|
||||
{{else}}
|
||||
<p class="hint">Пока нет ссылок — назначьте inbound пользователю, профиль ноде, и дождитесь Online.</p>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Редактирование</h2>
|
||||
<form class="form-card" method="POST" action="/admin/clients/{{.Client.ID}}">
|
||||
<div class="form-grid">
|
||||
<label>Username
|
||||
<input name="username" required value="{{.Client.Username}}">
|
||||
</label>
|
||||
<label>Email
|
||||
<input name="email" type="email" value="{{.Client.Email}}">
|
||||
</label>
|
||||
<label>Статус
|
||||
<select name="status">
|
||||
<option value="active" {{if eq (printf "%s" .Client.Status) "active"}}selected{{end}}>Активен</option>
|
||||
<option value="disabled" {{if eq (printf "%s" .Client.Status) "disabled"}}selected{{end}}>Отключён</option>
|
||||
<option value="expired" {{if eq (printf "%s" .Client.Status) "expired"}}selected{{end}}>Истёк</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Лимит трафика (GB, 0 = ∞)
|
||||
<input name="traffic_limit_gb" type="number" step="0.1" min="0" value="{{printf "%.2f" .Client.TrafficLimitGB}}">
|
||||
</label>
|
||||
<label>Истекает
|
||||
<input name="expire_at" type="datetime-local" value="{{formatTime .Client.ExpireAt}}">
|
||||
</label>
|
||||
<label>Заметка
|
||||
<input name="note" value="{{.Client.Note}}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<fieldset class="mode-pick">
|
||||
<legend>Инбаунды</legend>
|
||||
{{range .Inbounds}}
|
||||
<label class="radio">
|
||||
<input type="checkbox" name="inbound_ids" value="{{.ID}}" {{if $.Client.HasInbound .ID}}checked{{end}}>
|
||||
<span><code>{{.Tag}}</code> · {{.ProtocolName}} :{{.Port}}</span>
|
||||
</label>
|
||||
{{else}}
|
||||
<p class="muted">Нет доступных inbound — создайте в профиле.</p>
|
||||
{{end}}
|
||||
</fieldset>
|
||||
|
||||
<button class="btn btn-primary" type="submit">Сохранить</button>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{.Title}} · VPN Panel</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
</head>
|
||||
<body class="page-admin">
|
||||
<aside class="sidebar">
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
</nav>
|
||||
<div class="sidebar-foot">
|
||||
<span class="user-chip">{{.UserName}}</span>
|
||||
<form method="POST" action="/logout"><button type="submit" class="link-btn">Выйти</button></form>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="admin-main">
|
||||
<header class="admin-header row-head">
|
||||
<div>
|
||||
<h1>Пользователи</h1>
|
||||
<p class="muted">VPN-клиенты: доступ к инбаундам и subscription-ссылка</p>
|
||||
</div>
|
||||
<a class="btn btn-primary" href="/admin/clients/new">+ Создать пользователя</a>
|
||||
</header>
|
||||
|
||||
{{if .Flash}}<div class="alert ok">{{.Flash}}</div>{{end}}
|
||||
{{if .Error}}<div class="alert">{{.Error}}</div>{{end}}
|
||||
|
||||
{{if .Clients}}
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Статус</th>
|
||||
<th>Инбаунды</th>
|
||||
<th>Лимит</th>
|
||||
<th>Истекает</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Clients}}
|
||||
<tr>
|
||||
<td>
|
||||
<strong><a href="/admin/clients/{{.ID}}">{{.Username}}</a></strong>
|
||||
{{if .Email}}<div class="cell-desc">{{.Email}}</div>{{end}}
|
||||
</td>
|
||||
<td><span class="badge {{statusClass (printf "%s" .Status)}}">{{.StatusLabel}}</span></td>
|
||||
<td>{{.InboundCount}}</td>
|
||||
<td>{{if gt .TrafficLimitBytes 0}}{{printf "%.1f" .TrafficLimitGB}} GB{{else}}∞{{end}}</td>
|
||||
<td>{{if .ExpireAt}}{{.ExpireAt.Format "02.01.2006 15:04"}}{{else}}—{{end}}</td>
|
||||
<td class="actions"><a class="btn btn-sm btn-ghost" href="/admin/clients/{{.ID}}">Открыть</a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="empty-state">
|
||||
<p>Пользователей пока нет.</p>
|
||||
<a class="btn btn-primary" href="/admin/clients/new">Создать первого</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
@@ -31,6 +32,14 @@
|
||||
</header>
|
||||
|
||||
<section class="stats stats-5">
|
||||
<div class="stat">
|
||||
<span class="stat-label">Пользователи</span>
|
||||
<span class="stat-value">{{.Stats.ClientsTotal}}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">Активные</span>
|
||||
<span class="stat-value accent">{{.Stats.ClientsActive}}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">Ноды</span>
|
||||
<span class="stat-value">{{.Stats.NodesTotal}}</span>
|
||||
@@ -43,14 +52,6 @@
|
||||
<span class="stat-label">Профили</span>
|
||||
<span class="stat-value">{{.Stats.ProfilesTotal}}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">Протоколов</span>
|
||||
<span class="stat-value">{{.Stats.ProtocolsTotal}}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">Включено</span>
|
||||
<span class="stat-value accent">{{.Stats.ProtocolsEnabled}}</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel-section">
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a href="/admin">Обзор</a>
|
||||
<a href="/admin/clients">Пользователи</a>
|
||||
<a href="/admin/nodes">Ноды</a>
|
||||
<a class="active" href="/admin/profiles">Профили</a>
|
||||
<a href="/admin/protocols">Протоколы</a>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a href="/admin">Обзор</a>
|
||||
<a href="/admin/clients">Пользователи</a>
|
||||
<a href="/admin/nodes">Ноды</a>
|
||||
<a class="active" href="/admin/profiles">Профили</a>
|
||||
<a href="/admin/protocols">Протоколы</a>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a class="brand" href="/admin">VPN Panel</a>
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</a>
|
||||
<a class="{{if eq .Active "clients"}}active{{end}}" href="/admin/clients">Пользователи</a>
|
||||
<a class="{{if eq .Active "nodes"}}active{{end}}" href="/admin/nodes">Ноды</a>
|
||||
<a class="{{if eq .Active "profiles"}}active{{end}}" href="/admin/profiles">Профили</a>
|
||||
<a class="{{if eq .Active "protocols"}}active{{end}}" href="/admin/protocols">Протоколы</a>
|
||||
|
||||
Reference in New Issue
Block a user