Commit Graph

27 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
Андрей Бобырев
d950684d95 fix(dashboard): bump app.js cache bust for keenetic edit form
Browser was serving cached app.js from ?v=20260522a with the old KeenDNS-only button.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 01:49:21 +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
Андрей Бобырев
8beccae2b5 fix(keenetic): sustain 5min before router offline alert
Phantom OFFLINE/online Telegram spam from brief poll failures.
Wait 5 min sustained offline, re-verify auth before alerting,
30 min cooldown between repeat alerts, single recovery message.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 01:39:12 +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
Андрей Бобырев
c64b455f9a fix(keenetic): keep auth session for RCI requests
Resetting the session after auth dropped cookies and broke metrics
collection with "No data from router" despite successful login.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 03:31:48 +03:00
Андрей Бобырев
306e687988 fix(keenetic): reset session after auth probe, retry 503
Probing used short timeouts on the session reused for RCI calls.
Recreate the session after auth and treat 503 as transient.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 03:22:25 +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
Андрей Бобырев
2da649d1ae fix(keenetic): open KeenDNS edit instead of detail modal
Card-level onclick fired even when KeenDNS was clicked. Use delegated
handlers so the edit form toggles reliably and card clicks skip buttons.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 02:38:09 +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
Андрей Бобырев
1c4f97124a feat: keenetic integration, VPN alerts, docs
Wire keenetic monitor loop and router into main app. Add deduplicated
Telegram alerts for router offline, internet, CPU/RAM, and VPN down.
Update README with KeenDNS edit, import format, troubleshooting.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 01:55:03 +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
Андрей Бобырев
cc01667879 feat: add Synology NAS, Home Assistant monitoring, multi-channel notifications
New tabs:
- Synology NAS: CPU, RAM, temp, volumes, VMs, Docker containers
- Home Assistant: sensors, automations, persons, climate, battery, doors

New features:
- Personalized PC agent download with custom name
- Notification settings: per-category Telegram/Email/WhatsApp toggles
- Email via SMTP, WhatsApp via CallMeBot API
- Test notification buttons for each channel
- Unified notifier replaces direct Telegram calls in alerter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 13:59:57 +03:00
Андрей Бобырев
bab8fc33cc fix: mount /static/downloads before /static to avoid prefix conflict
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 13:27:54 +03:00
Андрей Бобырев
399e9ab2fb feat: add PC monitoring tab with Windows agent
- New /api/pc endpoints (heartbeat, list, delete)
- Dashboard tabs: Серверы / ПК with auto-refresh
- PowerShell agent: CPU, RAM, Disk, Network, GPU, Top processes
- One-command Windows installer with Scheduled Task
- PC setup instructions modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 13:25:14 +03:00
Андрей Бобырев
f9f9195e14 fix: Telegram Mini App auth via initData (no web login needed)
- Validate Telegram WebApp initData using HMAC-SHA256
- Dual auth: cookie (web panel) OR X-Telegram-Init-Data header
- Mini App sends initData with every API request
- Retry button on auth failure instead of dead end

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 13:00:47 +03:00
Андрей Бобырев
f5726561ea feat: add author footer to all pages (GitHub, Boosty, Support, @Iot_andrey)
- Footer on dashboard, login, Telegram Mini App
- Author section in README
- Consistent styling across light/dark themes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 12:55:45 +03:00
Андрей Бобырев
68b4521ae9 feat: enable Telegram WebApp button via HTTPS (nip.io + Let's Encrypt)
- WebApp inline button uses https://IP.nip.io/telegram-app
- Bot menu button 'VPS Panel' set via setChatMenuButton API
- nginx reverse proxy with valid SSL cert on port 443
- Fallback to regular URL button if WebApp fails

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 12:46:58 +03:00
Андрей Бобырев
fab7ed7912 fix: xterm.js CDN → jsdelivr, port 8000 → 7272, custom port in installer
- Switch xterm.js from cdnjs (404) to jsdelivr (working)
- Add xterm-addon-fit for auto-resize terminal
- Change default port from 8000 to 7272 everywhere
- Install script: --port flag for custom port selection
- sed-based port injection into systemd service at install time

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 12:38:01 +03:00
Андрей Бобырев
dbe2faf7dc feat: redesign Telegram Mini App in keenetichome style
- Sectioned card layout: СЕРВЕРЫ, ДЕЙСТВИЯ, УВЕДОМЛЕНИЯ, СИСТЕМА
- Expandable server cards with metrics detail + reboot/delete
- Mute/unmute alerts (2h, 8h) with API support
- Green/red pulsing status dots, colored badges
- Toast notifications, loading spinner
- Overview API endpoint for Mini App data
- Mute integration with alerter system

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 12:32:59 +03:00
Андрей Бобырев
4846742c60 feat: add light/dark theme, RU/EN i18n, instructions page, green/red monitoring
- Light and dark theme toggle with localStorage persistence
- Russian and English language support (full i18n)
- Instructions & cheat sheet modal with install/SSH/API/commands
- Green pulsing dot for online, red for offline servers
- Color-coded metrics: green (ok), yellow (warn >70%), red (crit >90%)
- Top bar on server cards: green=online, red=offline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 05:55:16 +03:00
Андрей Бобырев
468d0bd028 fix: use regular URL button for Telegram (HTTP not supported for WebApp)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 05:50:14 +03:00
Андрей Бобырев
e6e88314d5 feat: initial VPS monitoring platform
- FastAPI backend with auth, server CRUD, metrics collection
- Web dashboard with dark theme, server cards, SSH terminal (xterm.js)
- Telegram bot with inline keyboards, server management, reboot
- Telegram Mini App for mobile monitoring
- Background monitoring via asyncssh (CPU, RAM, Disk, Network, Uptime)
- Alert system with configurable thresholds
- WebSocket SSH terminal in browser
- One-command install script
- Systemd service configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 05:47:28 +03:00