diff --git a/main.py b/main.py
index 23a635c..55ed209 100644
--- a/main.py
+++ b/main.py
@@ -226,6 +226,13 @@ else:
app = FastAPI(title="smeta-web", docs_url=None, redoc_url=None, openapi_url=None)
app.mount("/static", StaticFiles(directory="static"), name="static")
+
+@app.get("/favicon.ico", include_in_schema=False)
+async def favicon():
+ """Значок вкладки. Браузер просит его сам, без ссылки со страницы; отсутствие
+ давало 404 в журнале на каждом заходе."""
+ return FileResponse("static/brand/logo-znachok-128.png", media_type="image/png")
+
import admin_api
app.include_router(admin_api.router)
diff --git a/static/admin.html b/static/admin.html
index ed8159b..a19a107 100644
--- a/static/admin.html
+++ b/static/admin.html
@@ -2621,7 +2621,7 @@ async function loadAudit(offset) {
const upd = document.getElementById('audit-updated');
const more = document.getElementById('audit-more');
const my = ++auditReq;
- t.querySelectorAll('.row-err').forEach(e => e.remove());
+ t.querySelectorAll('[data-err]').forEach(e => e.remove());
if (auditOffset === 0) t.innerHTML = AUDIT_HEAD + '
| Загрузка… |
';
if (more) more.disabled = true;
try {
@@ -2646,7 +2646,7 @@ async function loadAudit(offset) {
if (more) { more.disabled = false; more.style.display = rows.length >= AUDIT_LIMIT ? '' : 'none'; }
} catch (e) {
if (my !== auditReq) return;
- const errRow = '| Не удалось загрузить журнал: '
+ const errRow = ' |
| Не удалось загрузить журнал: '
+ esc(e.message || 'сеть') + ' |
';
if (auditOffset === 0) t.innerHTML = AUDIT_HEAD + errRow;
diff --git a/static/brand/logo-znachok-128.png b/static/brand/logo-znachok-128.png
new file mode 100644
index 0000000..ff08f85
Binary files /dev/null and b/static/brand/logo-znachok-128.png differ
diff --git a/static/brand/logo-znachok-256.png b/static/brand/logo-znachok-256.png
new file mode 100644
index 0000000..30f629e
Binary files /dev/null and b/static/brand/logo-znachok-256.png differ
diff --git a/static/chat.html b/static/chat.html
index ad4eaa8..307f9ea 100644
--- a/static/chat.html
+++ b/static/chat.html
@@ -1737,8 +1737,17 @@ function hideDevicePanel(){ document.getElementById('device-panel').style.displa
let _reviewCardId = null;
async function pollReviewCard(){
if (document.hidden) return;
+ const card0 = document.getElementById('review-card');
+ // Публичной странице список проверок не нужен: без пропуска опрос только сорил бы
+ // отказом 401 каждые десять секунд.
+ if (!localStorage.getItem('token')) {
+ if (card0) card0.style.display = 'none';
+ _reviewCardId = null;
+ return;
+ }
try {
- const r = await fetch(API + '/api/reviews', {headers: authHeaders()});
+ // authFetch: при истёкшем пропуске обновляет его и повторяет запрос.
+ const r = await authFetch(API + '/api/reviews');
if (!r.ok) { document.getElementById('review-card').style.display = 'none'; return; }
const d = await r.json();
const live = (d.items||[]).find(x => ['queued','running','paused'].includes(x.status));
@@ -1757,8 +1766,8 @@ async function pollReviewCard(){
}
document.getElementById('review-card-stop').onclick = async () => {
if (!_reviewCardId) return;
- await fetch(API + '/api/reviews/' + _reviewCardId + '/cancel',
- {method:'POST', headers: authHeaders()});
+ await authFetch(API + '/api/reviews/' + _reviewCardId + '/cancel',
+ {method:'POST'});
pollReviewCard();
};
setInterval(pollReviewCard, 10000);
diff --git a/tests/test_admin_column_hints_ui.py b/tests/test_admin_column_hints_ui.py
index 08e2588..767b4ab 100644
--- a/tests/test_admin_column_hints_ui.py
+++ b/tests/test_admin_column_hints_ui.py
@@ -37,16 +37,17 @@ def _hints():
def test_agent_column_explains_itself(browser, site):
- """Тот самый случай: Хозяин навёл на «Агент» и прочитал, что это.
+ """Тот самый случай: Хозяин навёл на столбец с доступом и прочитал, что это.
+ Столбец назывался «Агент», теперь «Доступ»: там же провайдер и режим справки.
Порча: убрать подсказку у колонки → упадёт."""
ctx, page = _open(browser, site, "plain")
try:
page.click('.sidebar a[href="#users"]')
page.wait_for_selector("#users td")
- page.locator("#users th", has_text="Агент").first.hover()
+ page.locator("#users th", has_text="Доступ").first.hover()
page.wait_for_selector("#hint", state="visible")
text = page.inner_text("#hint")
- assert "агентн" in text.lower(), text
+ assert "агент" in text.lower() and "справка" in text.lower(), text
box = page.locator("#hint").bounding_box()
assert box["x"] >= 0 and box["x"] + box["width"] <= 1280, box
finally:
diff --git a/tests/test_admin_soft_delete_ui.py b/tests/test_admin_soft_delete_ui.py
index 9c60ba1..5456d3c 100644
--- a/tests/test_admin_soft_delete_ui.py
+++ b/tests/test_admin_soft_delete_ui.py
@@ -26,13 +26,14 @@ def html():
return open(ADMIN, encoding="utf-8").read()
-def test_users_table_has_a_column_for_deletion_mark(html):
- """В таблице людей есть столбец про удаление — иначе метку негде показать.
- Порча: убрать столбец → проверка упадёт."""
- # Первой колонкой теперь идёт галочка выбора, поэтому якорь — сам столбец Email.
- headers = re.findall(r"(?:(?!
).)*?Email | .*?", html, re.S)
- assert headers, "не нашёл заголовок таблицы людей"
- assert all("Удалён" in h for h in headers), f"столбца нет: {headers}"
+def test_deleted_account_is_marked_in_the_list(html):
+ """Удалённая учётка видна в списке: в столбце «Статус» написано «Удалена», строка
+ получает свой признак. Отдельного столбца «Удалён» больше нет — метка переехала
+ в статус при переделке таблицы людей.
+ Порча: убрать метку или класс строки → проверка упадёт."""
+ assert 'Удалена' in html, "в статусе нет метки удалённой"
+ assert "if (u.deleted_at) tr.className = 'row-deleted'" in html, \
+ "строка удалённой не помечается классом"
def test_deleted_row_shows_the_former_address_and_time(html):
@@ -70,10 +71,15 @@ def test_no_controls_at_all_for_a_deleted_account(html):
part = html[html.index("// === Users ==="):]
assert "u.deleted_at" in part, "список не различает удалённых при отрисовке"
branch = part.index("if (u.deleted_at) {")
- for control in ("const provTd = document.createElement('td')",
- "const agTd = document.createElement('td')",
- "const addBtn ="):
- assert branch < part.index(control), f"управление создаётся раньше ветки: {control}"
+ тело = part[branch:part.index("} else {", branch)]
+ assert "Восстановить" in тело, "у удалённой нет единственного действия — вернуть"
+ assert "createElement('select')" not in тело, "в ветке удалённой создаётся выбор провайдера"
+ for control in ("const menuBtn = document.createElement('button')",
+ "const provRow = document.createElement('label')"):
+ assert part.index(control) > branch, f"управление создаётся раньше ветки: {control}"
+ # Галочка выбора — тоже только у живых: у удалённой её быть не должно.
+ assert part.index("if (!u.deleted_at) {") < part.index("cb = document.createElement('input')"), \
+ "галочка выбора создаётся без проверки на удаление"
def test_operator_can_ask_to_see_deleted(html):
@@ -81,7 +87,7 @@ def test_operator_can_ask_to_see_deleted(html):
оператор их видит. Порча: убрать переключатель или не передавать признак в запрос →
удалённых нельзя будет посмотреть вовсе."""
assert 'id="show-deleted"' in html, "нет переключателя"
- line = next((ln for ln in html.splitlines()
- if "/api/admin/users'" in ln and "{headers: H}" in ln), None)
- assert line, "не нашёл запрос списка людей"
- assert "deleted" in line, f"запрос списка не передаёт признак: {line.strip()[:100]}"
+ assert "const showDeleted = !!(document.getElementById('show-deleted')" in html, \
+ "признак не читается из переключателя"
+ assert "if (showDeleted) p.set('deleted', '1')" in html, \
+ "запрос списка не передаёт признак удалённых"
diff --git a/tests/test_admin_states_ui.py b/tests/test_admin_states_ui.py
index 20060d8..f86d7d0 100644
--- a/tests/test_admin_states_ui.py
+++ b/tests/test_admin_states_ui.py
@@ -85,10 +85,10 @@ def test_audit_retry_clears_error_row(browser, site):
page.wait_for_timeout(1200)
page.evaluate("showPage('audit')")
page.wait_for_timeout(400)
- assert page.locator("#audit .row-err").count() == 1
+ assert page.locator("#audit [data-err]").count() == 1
page.locator("#audit button", has_text="Повторить").click()
page.wait_for_timeout(700)
- assert page.locator("#audit .row-err").count() == 0
+ assert page.locator("#audit [data-err]").count() == 0
assert "обновлено" in page.locator("#audit-updated").inner_text()
page.close()
diff --git a/tests/test_bulk_limits.py b/tests/test_bulk_limits.py
index b077837..f9ce587 100644
--- a/tests/test_bulk_limits.py
+++ b/tests/test_bulk_limits.py
@@ -350,12 +350,12 @@ def test_rows_can_be_picked_with_checkboxes(html):
assert "indeterminate" in html, "нет промежуточного состояния при частичном выборе"
assert "shiftKey" in html, "нет выбора диапазона"
# Удалённым галочка не положена: их нельзя ни выбрать, ни отправить на сервер.
- row = html[html.index("const selTd"):html.index("tr.insertBefore(selTd")]
+ row = html[html.index("// 1. Клиент: галочка"):html.index("tr.append(clientTd")]
assert "!u.deleted_at" in row
- # И ячейка с галочкой не должна затираться следующей же строкой: присваивание
- # innerHTML стирает всё, что добавлено до него (нашёл дипсик 09.09.2026).
- assert html.index("tr.innerHTML =") < html.index("tr.insertBefore(selTd"), \
- "ячейку с галочкой затирает перерисовка строки"
+ # Строка собирается из ячеек-элементов: присваивание tr.innerHTML стёрло бы уже
+ # добавленную ячейку с галочкой (нашёл дипсик 09.09.2026). Проверяем, что его нет.
+ assert "tr.innerHTML" not in row, \
+ "строку людей снова собирают через innerHTML — галочка может пропасть"
def test_selection_counter_is_announced(html):
diff --git a/tests/test_ux_quickwins.py b/tests/test_ux_quickwins.py
index 14f283c..fa3dd82 100644
--- a/tests/test_ux_quickwins.py
+++ b/tests/test_ux_quickwins.py
@@ -193,6 +193,16 @@ def client_env(main_env):
return db, auth, main, TestClient(main.app)
+def test_site_has_an_icon(client_env):
+ """Браузер сам просит /favicon.ico: без ответа в журнале 404, а вкладка без значка.
+ Порча: убрать ручку → упадёт."""
+ _, _, _, client = client_env
+ r = client.get("/favicon.ico")
+ assert r.status_code == 200, r.status_code
+ assert r.headers["content-type"].startswith("image/"), r.headers.get("content-type")
+ assert r.content[:8] == b"\x89PNG\r\n\x1a\n", "значок отдаётся не картинкой"
+
+
def test_demo_file_requires_auth(client_env):
_, _, _, client = client_env
r = client.post("/api/demo-file")