Refactor: fix socket leak, deduplicate stat/path logic, simplify config

- get_local_ip: use context manager to prevent socket leak
- _route_files: single stat() per file instead of two
- _safe_path helper: DRY path resolution for download/delete
- load_config: loop over vars(args) instead of 6 repetitive blocks
- Remove stale comment from index.html

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 20:38:53 +04:00
co-authored by Claude Opus 4.6
parent 266308a2eb
commit ebe5c6ec90
2 changed files with 17 additions and 27 deletions
-2
View File
@@ -259,8 +259,6 @@ $('lang-sw').addEventListener('click', e => {
if (e.target.dataset.l) setLang(e.target.dataset.l);
});
/* File type is determined server-side via /files API ("text" | "image" | "other") */
/* ── Helpers ── */
let toastTimer;