10 Commits

Author SHA1 Message Date
Андрей Бобырев
11eb3d3c45 fix(keenetic): safe delete URLs and not-found handling
Encode router names in Keenetic API calls and return an error when delete targets a missing device.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 19:38:43 +03:00
Андрей Бобырев
50b4dac52e fix(alerts,data): startup grace + sustained offline + atomic JSON writes
- 5 min sustained offline window для VPS/PC/Synology/HA (раньше было только у
  Keenetic) + новый STARTUP_GRACE_SEC=300 — первые 5 минут после старта сервиса
  алёрты offline не отправляются, но состояние трекается. Это убирает массовый
  fantom-alert при перезапуске vps-monitoring.
- Атомарная запись JSON-файлов через tempfile+os.replace и явный encoding=utf-8
  везде (data/keenetic.json, pc_agents.json, synology.json, homeassistant.json,
  servers.json, settings.json, metrics.json). Краш в момент записи больше не
  оставляет битый файл с русскими названиями.
- Чистка: убран неиспользуемый passlib + dead bcrypt-импорт в auth.py
  (verify_password всё равно был обычным сравнением); SECRET_KEY можно
  переопределить через VPS_MONITORING_SECRET; убран мертвый import json там,
  где он больше не нужен.
- Bump app.js cache bust до 20260524c.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 02:30:15 +03:00
Андрей Бобырев
3a5a4beb3f feat(keenetic): full edit form for all router fields
Replace KeenDNS-only edit with a complete form (name, URL, login,
password, AnyDesk). PATCH API now supports rename and keeps password
when the field is left empty.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 01:45:52 +03:00
Андрей Бобырев
91e675566f fix(keenetic): switch RCI client from aiohttp to httpx
aiohttp hung on KeenDNS from VPS while httpx works (keenetic-unified
pattern). Align add/import/bulk URL parsing with parse_keenetic_web_url.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 15:37:32 +03:00
Андрей Бобырев
dc161e151d fix(keenetic): try all DNS A records on auth failure
KeenDNS returns multiple A records including unreachable IPs; aiohttp
was timing out on the first bad address. Iterate all resolved IPs with
short connect timeouts, serialize polls with a lock, and fail faster.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 03:05:34 +03:00
Андрей Бобырев
40f6ac4f7e fix(keenetic): use REFRESH_ALL_GAP_SEC in monitor loop
Monitor loop referenced undefined REFRESH_GAP_SEC after refresh-all refactor.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 02:22:13 +03:00
Андрей Бобырев
8826e40d95 fix(keenetic): non-blocking refresh-all and longer timeouts
Run refresh-all in background so API stays responsive during 24-router
poll. Cap per-device poll at 75s, add 2s gap between routers, bump
KeenDNS connect/read timeouts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 02:07:07 +03:00
Андрей Бобырев
8f8e9a3234 feat(keenetic): edit KeenDNS address from dashboard
Add PATCH endpoint and inline card editor to update web_url and host,
with URL validation and automatic refresh after save.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 01:02:01 +03:00
Андрей Бобырев
746ecfc343 fix(keenetic): preserve URL scheme/ports and IPv4 polling
Use web_url scheme and host:port for API base URL instead of
forcing https. Force IPv4 in aiohttp to avoid IPv6 hangs on
KeenDNS. Sync canonical 24-router list with Russian names.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 00:52:11 +03:00
Андрей Бобырев
de99b60910 fix(keenetic): Web/AnyDesk links and import sync
Add web_url/anydesk to router records, host fallback for Web button
on offline cards, cache-bust app.js, and scripts to sync import list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 23:06:35 +03:00