diff --git a/main.py b/main.py
index af0eb4e..4541a76 100644
--- a/main.py
+++ b/main.py
@@ -937,7 +937,7 @@ async def admin_download_file_endpoint(request: Request):
return FileResponse(fpath, filename=safe_name)
-ADMIN_HTML_VERSION = "20260506e"
+ADMIN_HTML_VERSION = "20260506f"
@app.get("/admin", response_class=HTMLResponse)
diff --git a/static/admin.html b/static/admin.html
index 9511721..dd78593 100644
--- a/static/admin.html
+++ b/static/admin.html
@@ -48,7 +48,7 @@ a { color: var(--accent); text-decoration: none; }
Журнал
Файлы
← Вернуться в чат
-
v.2026-05-06e
+ v.2026-05-06f
@@ -225,11 +225,20 @@ async function loadFileUsers() {
opt.textContent = u.username + ' (' + u.file_count + ')';
sel.appendChild(opt);
}
- // Восстановить ранее выбранного юзера из localStorage и сразу подгрузить файлы
+ // 1) Сначала пробуем восстановить ранее выбранного юзера из localStorage
const saved = localStorage.getItem('admin_files_user');
if (saved && Array.from(sel.options).some(o => o.value === saved)) {
sel.value = saved;
loadFiles();
+ return;
+ }
+ // 2) Иначе — автовыбор первого юзера с file_count > 0,
+ // чтобы при первом заходе админ сразу видел список файлов
+ const firstWithFiles = d.users.find(u => u.file_count > 0);
+ if (firstWithFiles) {
+ sel.value = firstWithFiles.username;
+ localStorage.setItem('admin_files_user', firstWithFiles.username);
+ loadFiles();
}
}
function onFilesUserChange() {