v2→main: интеграция — v2 как основной UI (/), старый UI закомментирован

This commit is contained in:
2026-06-15 09:33:45 +04:00
parent 3e418f9f4a
commit 5b92dfe1e7
11 changed files with 51 additions and 50 deletions
+9 -9
View File
@@ -11,26 +11,26 @@
</style></head><body>
<div class="bar">
<span><strong>V2 IP WhiteList</strong> <small>v<%= version %></small></span>
<span><%= user.email %> <% if (user.isAdmin) { %>| <a href="/v2/admin">ADMIN</a><% } %></span>
<span><%= user.email %> <% if (user.isAdmin) { %>| <a href="/admin">ADMIN</a><% } %></span>
<span>
<form method="GET" action="/v2/app" style="display:inline">
<form method="GET" action="/app" style="display:inline">
<select name="switchTo" onchange="this.form.submit()">
<% companies.forEach(function(c) { %>
<option value="<%= c.client_id %>" <%= c.client_id === activeClientId ? 'selected' : '' %>><%= c.company_name || c.client_id %> (<%= c.client_id %>)</option>
<% }) %>
</select>
</form>
<a href="/v2/logout">Выйти</a>
<a href="/logout">Выйти</a>
</span>
</div>
<script>
const p=new URLSearchParams(location.search);
if(p.get('msg')){document.body.insertAdjacentHTML('afterbegin','<div style="background:#4caf50;color:#fff;padding:8px">'+p.get('msg')+'</div>');history.replaceState(null,'','/v2/app')}
if(p.get('error')){document.body.insertAdjacentHTML('afterbegin','<div style="background:#f44336;color:#fff;padding:8px">'+p.get('error')+'</div>');history.replaceState(null,'','/v2/app')}
if(p.get('msg')){document.body.insertAdjacentHTML('afterbegin','<div style="background:#4caf50;color:#fff;padding:8px">'+p.get('msg')+'</div>');history.replaceState(null,'','/app')}
if(p.get('error')){document.body.insertAdjacentHTML('afterbegin','<div style="background:#f44336;color:#fff;padding:8px">'+p.get('error')+'</div>');history.replaceState(null,'','/app')}
</script>
<p>Записей: <strong><%= used %></strong> из <%= limit %></p>
<div class="add-form">
<form method="POST" action="/v2/app/add">
<form method="POST" action="/app/add">
<input name="cidr" placeholder="x.x.x.x/xx" size="18" required>
<input name="comment" placeholder="комментарий" size="30">
<button>Добавить</button>
@@ -51,12 +51,12 @@
<% if (e.deleted_at) { %>
<span style="color:#888">удалено</span>
<% } else { %>
<form method="POST" action="/v2/app/edit/<%= e.id %>" style="display:inline">
<form method="POST" action="/app/edit/<%= e.id %>" style="display:inline">
<input name="cidr" value="<%= e.value_cidr %>" size="18">
<input name="comment" value="<%= e.comment || '' %>" size="20">
<button>изменить</button>
</form>
<form method="POST" action="/v2/app/delete/<%= e.id %>" style="display:inline">
<form method="POST" action="/app/delete/<%= e.id %>" style="display:inline">
<button onclick="return confirm('Удалить?')">удалить</button>
</form>
<% } %>
@@ -64,5 +64,5 @@
</tr>
<% }) %>
</table>
<p><a href="/v2/app?deleted=<%= includeDeleted ? '0' : '1' %>"><%= includeDeleted ? 'Скрыть удалённые' : 'Показать удалённые' %></a></p>
<p><a href="/app?deleted=<%= includeDeleted ? '0' : '1' %>"><%= includeDeleted ? 'Скрыть удалённые' : 'Показать удалённые' %></a></p>
</body></html>