work: добавли отображение доменов в два столбца
This commit is contained in:
@@ -690,10 +690,27 @@ def index():
|
|||||||
state = load_state()
|
state = load_state()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
state = ([], [], False, f"Cannot read Caddy config: {exc}", False, f"Cannot read dnsmasq config: {exc}")
|
state = ([], [], False, f"Cannot read Caddy config: {exc}", False, f"Cannot read dnsmasq config: {exc}")
|
||||||
|
|
||||||
|
dns_records = state[1]
|
||||||
|
xray_records = sorted(
|
||||||
|
(r for r in dns_records if r.service_key == "xray"),
|
||||||
|
key=lambda r: r.domain.lower(),
|
||||||
|
)
|
||||||
|
byedpi_records = sorted(
|
||||||
|
(r for r in dns_records if r.service_key == "byedpi"),
|
||||||
|
key=lambda r: r.domain.lower(),
|
||||||
|
)
|
||||||
|
other_dns_records = sorted(
|
||||||
|
(r for r in dns_records if r.service_key not in {"xray", "byedpi"}),
|
||||||
|
key=lambda r: r.domain.lower(),
|
||||||
|
)
|
||||||
|
|
||||||
return render_template_string(
|
return render_template_string(
|
||||||
TEMPLATE,
|
TEMPLATE,
|
||||||
caddy_records=state[0],
|
caddy_records=state[0],
|
||||||
dns_records=state[1],
|
xray_records=xray_records,
|
||||||
|
byedpi_records=byedpi_records,
|
||||||
|
other_dns_records=other_dns_records,
|
||||||
caddy_ok=state[2],
|
caddy_ok=state[2],
|
||||||
caddy_status=state[3],
|
caddy_status=state[3],
|
||||||
dns_ok=state[4],
|
dns_ok=state[4],
|
||||||
@@ -985,6 +1002,12 @@ TEMPLATE = r"""
|
|||||||
details { margin-top:10px; color:var(--muted); }
|
details { margin-top:10px; color:var(--muted); }
|
||||||
pre { white-space:pre-wrap; word-break:break-word; font-size:12px; }
|
pre { white-space:pre-wrap; word-break:break-word; font-size:12px; }
|
||||||
.tag { display:inline-block; padding:2px 7px; border:1px solid #3a4657; border-radius:999px; color:#b8c6d9; font-size:11px; }
|
.tag { display:inline-block; padding:2px 7px; border:1px solid #3a4657; border-radius:999px; color:#b8c6d9; font-size:11px; }
|
||||||
|
.dns-group { margin-top:18px; border:1px solid var(--line); border-radius:11px; overflow:hidden; background:#12161c; }
|
||||||
|
.dns-group-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:11px 13px; border-bottom:1px solid var(--line); }
|
||||||
|
.dns-group-title { display:flex; align-items:baseline; gap:8px; font-weight:700; }
|
||||||
|
.dns-group table { margin:0; }
|
||||||
|
.dns-group td:last-child, .dns-group th:last-child { width:1%; white-space:nowrap; }
|
||||||
|
.dns-warning { margin-top:18px; border-color:#735b2e; background:rgba(255,190,70,.04); }
|
||||||
@media (max-width:900px) { .grid { grid-template-columns:1fr; } }
|
@media (max-width:900px) { .grid { grid-template-columns:1fr; } }
|
||||||
@media (max-width:560px) { form.add { grid-template-columns:1fr; } .wide { grid-column:auto; } table { display:block; overflow-x:auto; } }
|
@media (max-width:560px) { form.add { grid-template-columns:1fr; } .wide { grid-column:auto; } table { display:block; overflow-x:auto; } }
|
||||||
</style>
|
</style>
|
||||||
@@ -1063,26 +1086,96 @@ TEMPLATE = r"""
|
|||||||
</form>
|
</form>
|
||||||
<p><a class="button-link" href="{{ url_for('dns_export') }}">Экспортировать список доменов</a></p>
|
<p><a class="button-link" href="{{ url_for('dns_export') }}">Экспортировать список доменов</a></p>
|
||||||
|
|
||||||
<table>
|
<div class="dns-group">
|
||||||
<thead><tr><th>Domain</th><th>Сервис</th><th>IPv4</th><th>IPv6</th><th></th></tr></thead>
|
<div class="dns-group-head">
|
||||||
<tbody>
|
<div class="dns-group-title">
|
||||||
{% for r in dns_records %}
|
<span>XRAY</span>
|
||||||
<tr>
|
<span class="tag">{{ xray_records|length }} доменов</span>
|
||||||
<td><strong>{{ r.domain }}</strong></td>
|
</div>
|
||||||
<td><span class="tag">{{ r.service_name }}</span></td>
|
<code>{{ dns_services['xray']['ip'] }}</code>
|
||||||
<td><code>{{ r.ip }}</code></td>
|
</div>
|
||||||
<td>{% if r.ipv6_blocked %}<span class="tag">заблокирован</span>{% else %}<span class="muted">нет local=</span>{% endif %}</td>
|
<table>
|
||||||
<td>
|
<thead><tr><th>Domain</th><th>IPv6</th><th></th></tr></thead>
|
||||||
<form method="post" action="{{ url_for('dns_delete') }}" onsubmit="return confirm('Удалить {{ r.domain }}?')">
|
<tbody>
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
{% for r in xray_records %}
|
||||||
<input type="hidden" name="record_id" value="{{ r.record_id }}">
|
<tr>
|
||||||
<button class="delete" type="submit">Удалить</button>
|
<td><strong>{{ r.domain }}</strong></td>
|
||||||
</form>
|
<td>{% if r.ipv6_blocked %}<span class="tag">заблокирован</span>{% else %}<span class="muted">нет local=</span>{% endif %}</td>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<form method="post" action="{{ url_for('dns_delete') }}" onsubmit="return confirm('Удалить {{ r.domain }} из XRAY?')">
|
||||||
{% else %}<tr><td colspan="5" class="muted">Записей не найдено.</td></tr>{% endfor %}
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||||
</tbody>
|
<input type="hidden" name="record_id" value="{{ r.record_id }}">
|
||||||
</table>
|
<button class="delete" type="submit">Удалить</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr><td colspan="3" class="muted">Нет доменов, направленных через XRAY.</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dns-group">
|
||||||
|
<div class="dns-group-head">
|
||||||
|
<div class="dns-group-title">
|
||||||
|
<span>ByeDPI</span>
|
||||||
|
<span class="tag">{{ byedpi_records|length }} доменов</span>
|
||||||
|
</div>
|
||||||
|
<code>{{ dns_services['byedpi']['ip'] }}</code>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>Domain</th><th>IPv6</th><th></th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{% for r in byedpi_records %}
|
||||||
|
<tr>
|
||||||
|
<td><strong>{{ r.domain }}</strong></td>
|
||||||
|
<td>{% if r.ipv6_blocked %}<span class="tag">заблокирован</span>{% else %}<span class="muted">нет local=</span>{% endif %}</td>
|
||||||
|
<td>
|
||||||
|
<form method="post" action="{{ url_for('dns_delete') }}" onsubmit="return confirm('Удалить {{ r.domain }} из ByeDPI?')">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||||
|
<input type="hidden" name="record_id" value="{{ r.record_id }}">
|
||||||
|
<button class="delete" type="submit">Удалить</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr><td colspan="3" class="muted">Нет доменов, направленных через ByeDPI.</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if other_dns_records %}
|
||||||
|
<div class="dns-group dns-warning">
|
||||||
|
<div class="dns-group-head">
|
||||||
|
<div class="dns-group-title">
|
||||||
|
<span>Другие маршруты</span>
|
||||||
|
<span class="tag">{{ other_dns_records|length }}</span>
|
||||||
|
</div>
|
||||||
|
<span class="muted">IP не соответствует XRAY/ByeDPI</span>
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>Domain</th><th>IPv4</th><th>IPv6</th><th></th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{% for r in other_dns_records %}
|
||||||
|
<tr>
|
||||||
|
<td><strong>{{ r.domain }}</strong></td>
|
||||||
|
<td><code>{{ r.ip }}</code></td>
|
||||||
|
<td>{% if r.ipv6_blocked %}<span class="tag">заблокирован</span>{% else %}<span class="muted">нет local=</span>{% endif %}</td>
|
||||||
|
<td>
|
||||||
|
<form method="post" action="{{ url_for('dns_delete') }}" onsubmit="return confirm('Удалить {{ r.domain }}?')">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||||
|
<input type="hidden" name="record_id" value="{{ r.record_id }}">
|
||||||
|
<button class="delete" type="submit">Удалить</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<details><summary>Результат dnsmasq --test</summary><pre>{{ dns_status }}</pre></details>
|
<details><summary>Результат dnsmasq --test</summary><pre>{{ dns_status }}</pre></details>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user