Add config profiles with inbound assignment for nodes.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</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">
|
||||
@@ -38,6 +39,10 @@
|
||||
<span class="stat-label">Online</span>
|
||||
<span class="stat-value accent">{{.Stats.NodesOnline}}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<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>
|
||||
@@ -46,10 +51,6 @@
|
||||
<span class="stat-label">Включено</span>
|
||||
<span class="stat-value accent">{{.Stats.ProtocolsEnabled}}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">Админов</span>
|
||||
<span class="stat-value">{{.Stats.AdminsTotal}}</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel-section">
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</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">
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</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">
|
||||
@@ -58,6 +59,64 @@
|
||||
<a class="btn btn-ghost" href="/admin/nodes">К списку</a>
|
||||
</div>
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Config Profile</h2>
|
||||
<form class="form-card" method="POST" action="/admin/nodes/{{.Node.ID}}/profile">
|
||||
<label>Профиль для этой ноды
|
||||
<select name="profile_id">
|
||||
<option value="none">— без профиля —</option>
|
||||
{{range .Profiles}}
|
||||
<option value="{{.ID}}" {{if eq $.Node.ProfileIDString (printf "%s" .ID)}}selected{{end}}>{{.Name}} ({{.InboundCount}} inbound)</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<p class="hint">При назначении все inbound профиля включаются на ноде. Потом можно выключить отдельные.</p>
|
||||
<button class="btn btn-primary" type="submit">Назначить профиль</button>
|
||||
</form>
|
||||
{{if .Node.ProfileName}}
|
||||
<p class="muted" style="margin-top:0.75rem">Текущий: <strong>{{.Node.ProfileName}}</strong> · <a href="/admin/profiles/{{.Node.ProfileIDString}}">открыть профиль</a></p>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
{{if .NodeInbounds}}
|
||||
<section class="panel-section">
|
||||
<h2>Инбаунды на ноде</h2>
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th>Протокол</th>
|
||||
<th>Порт</th>
|
||||
<th>Network / Security</th>
|
||||
<th>На ноде</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .NodeInbounds}}
|
||||
<tr>
|
||||
<td><code>{{.Tag}}</code></td>
|
||||
<td>{{.ProtocolName}}</td>
|
||||
<td>{{.Port}}</td>
|
||||
<td>{{.Network}} / {{.Security}}</td>
|
||||
<td><span class="badge {{if .NodeEnabled}}on{{else}}off{{end}}">{{if .NodeEnabled}}ON{{else}}OFF{{end}}</span></td>
|
||||
<td class="actions">
|
||||
<form method="POST" action="/admin/nodes/{{$.Node.ID}}/inbounds/{{.ID}}">
|
||||
<input type="hidden" name="action" value="{{if .NodeEnabled}}disable{{else}}enable{{end}}">
|
||||
<button class="btn btn-sm {{if .NodeEnabled}}btn-ghost{{else}}btn-primary{{end}}" type="submit">
|
||||
{{if .NodeEnabled}}Выключить{{else}}Включить{{end}}
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Протоколы на этом сервере</h2>
|
||||
<div class="table-wrap">
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</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">
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<!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 href="/admin/nodes">Ноды</a>
|
||||
<a class="active" 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">Шаблон конфигурации ноды с набором инбаундов</p>
|
||||
</header>
|
||||
{{if .Error}}<div class="alert">{{.Error}}</div>{{end}}
|
||||
<form class="form-card" method="POST" action="/admin/profiles/new">
|
||||
<label>Имя
|
||||
<input name="name" required value="{{.Form.Name}}" placeholder="Sample / EU-Reality">
|
||||
</label>
|
||||
<label>Описание
|
||||
<textarea name="description" rows="3" placeholder="Кратко для чего профиль">{{.Form.Description}}</textarea>
|
||||
</label>
|
||||
<div class="cta-row">
|
||||
<button class="btn btn-primary" type="submit">Создать</button>
|
||||
<a class="btn btn-ghost" href="/admin/profiles">Отмена</a>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,147 @@
|
||||
<!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 href="/admin/nodes">Ноды</a>
|
||||
<a class="active" 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>{{.Profile.Name}}</h1>
|
||||
<p class="muted">{{.Profile.InboundCount}} inbound(s) · {{.Profile.NodeCount}} node(s)</p>
|
||||
</div>
|
||||
<a class="btn btn-ghost" href="/admin/profiles">К списку</a>
|
||||
</header>
|
||||
|
||||
{{if .Flash}}<div class="alert ok">{{.Flash}}</div>{{end}}
|
||||
{{if .Error}}<div class="alert">{{.Error}}</div>{{end}}
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Профиль</h2>
|
||||
<form class="form-card" method="POST" action="/admin/profiles/{{.Profile.ID}}">
|
||||
<div class="form-grid">
|
||||
<label>Имя
|
||||
<input name="name" required value="{{.Profile.Name}}">
|
||||
</label>
|
||||
<label>Описание
|
||||
<input name="description" value="{{.Profile.Description}}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="cta-row">
|
||||
<button class="btn btn-primary" type="submit">Сохранить</button>
|
||||
<button class="btn btn-ghost" type="submit" form="delete-profile" onclick="return confirm('Удалить профиль и все инбаунды?');">Удалить</button>
|
||||
</div>
|
||||
</form>
|
||||
<form id="delete-profile" method="POST" action="/admin/profiles/{{.Profile.ID}}/delete"></form>
|
||||
</section>
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Инбаунды</h2>
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th>Протокол</th>
|
||||
<th>Порт</th>
|
||||
<th>Network</th>
|
||||
<th>Security</th>
|
||||
<th>В профиле</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Profile.Inbounds}}
|
||||
<tr>
|
||||
<td><code>{{.Tag}}</code>{{if .Remark}}<div class="cell-desc">{{.Remark}}</div>{{end}}</td>
|
||||
<td>{{.ProtocolName}} <code>{{.ProtocolCode}}</code></td>
|
||||
<td>{{.Port}}</td>
|
||||
<td>{{.Network}}</td>
|
||||
<td>{{.Security}}</td>
|
||||
<td><span class="badge {{if .Enabled}}on{{else}}off{{end}}">{{if .Enabled}}ON{{else}}OFF{{end}}</span></td>
|
||||
<td class="actions actions-multi">
|
||||
<form method="POST" action="/admin/profiles/{{$.Profile.ID}}/inbounds/{{.ID}}/toggle">
|
||||
<button class="btn btn-sm btn-ghost" type="submit">{{if .Enabled}}Выкл{{else}}Вкл{{end}}</button>
|
||||
</form>
|
||||
<form method="POST" action="/admin/profiles/{{$.Profile.ID}}/inbounds/{{.ID}}/delete" onsubmit="return confirm('Удалить inbound?');">
|
||||
<button class="btn btn-sm btn-ghost" type="submit">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr><td colspan="7"><span class="muted">Инбаундов пока нет — добавьте ниже</span></td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Добавить inbound</h2>
|
||||
<form class="form-card" method="POST" action="/admin/profiles/{{.Profile.ID}}/inbounds">
|
||||
<div class="form-grid">
|
||||
<label>Протокол
|
||||
<select name="protocol_id" required>
|
||||
{{range .Protocols}}
|
||||
<option value="{{.ID}}">{{.Name}} ({{.Code}})</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</label>
|
||||
<label>Tag
|
||||
<input name="tag" placeholder="VLESS-443 (авто если пусто)">
|
||||
</label>
|
||||
<label>Порт
|
||||
<input name="port" type="number" placeholder="443">
|
||||
</label>
|
||||
<label>Listen
|
||||
<input name="listen" value="0.0.0.0">
|
||||
</label>
|
||||
<label>Network
|
||||
<select name="network">
|
||||
<option value="tcp">tcp</option>
|
||||
<option value="ws">ws</option>
|
||||
<option value="grpc">grpc</option>
|
||||
<option value="quic">quic</option>
|
||||
<option value="udp">udp</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Security
|
||||
<select name="security">
|
||||
<option value="none">none</option>
|
||||
<option value="tls">tls</option>
|
||||
<option value="reality">reality</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Порядок
|
||||
<input name="sort_order" type="number" value="0">
|
||||
</label>
|
||||
<label>Заметка
|
||||
<input name="remark" placeholder="опционально">
|
||||
</label>
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Добавить inbound</button>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,62 @@
|
||||
<!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 "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>Config Profiles</h1>
|
||||
<p class="muted">Профили конфигурации и инбаунды для нод (как Remnawave)</p>
|
||||
</div>
|
||||
<a class="btn btn-primary" href="/admin/profiles/new">+ Создать профиль</a>
|
||||
</header>
|
||||
|
||||
{{if .Flash}}<div class="alert ok">{{.Flash}}</div>{{end}}
|
||||
{{if .Error}}<div class="alert">{{.Error}}</div>{{end}}
|
||||
|
||||
{{if .Profiles}}
|
||||
<div class="proto-grid">
|
||||
{{range .Profiles}}
|
||||
<article class="proto-card">
|
||||
<div class="proto-top">
|
||||
<h3><a href="/admin/profiles/{{.ID}}">{{.Name}}</a></h3>
|
||||
</div>
|
||||
<p>{{if .Description}}{{.Description}}{{else}}Без описания{{end}}</p>
|
||||
<div class="proto-meta">
|
||||
<span>{{.InboundCount}} inbound(s)</span>
|
||||
<span>{{.NodeCount}} node(s)</span>
|
||||
</div>
|
||||
</article>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="empty-state">
|
||||
<p>Профилей ещё нет. Создайте профиль и добавьте инбаунды (VLESS, Trojan…).</p>
|
||||
<a class="btn btn-primary" href="/admin/profiles/new">Создать профиль</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -15,6 +15,7 @@
|
||||
<nav>
|
||||
<a class="{{if eq .Active "dashboard"}}active{{end}}" href="/admin">Обзор</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">
|
||||
|
||||
Reference in New Issue
Block a user