mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-05-01 11:56:21 +00:00
Update notification service
This commit is contained in:
@@ -55,9 +55,9 @@ class HealthPersistence:
|
|||||||
|
|
||||||
def _get_conn(self) -> sqlite3.Connection:
|
def _get_conn(self) -> sqlite3.Connection:
|
||||||
"""Get a SQLite connection with timeout and WAL mode for safe concurrency."""
|
"""Get a SQLite connection with timeout and WAL mode for safe concurrency."""
|
||||||
conn = sqlite3.connect(str(self.db_path), timeout=10)
|
conn = sqlite3.connect(str(self.db_path), timeout=30)
|
||||||
conn.execute('PRAGMA journal_mode=WAL')
|
conn.execute('PRAGMA journal_mode=WAL')
|
||||||
conn.execute('PRAGMA busy_timeout=5000')
|
conn.execute('PRAGMA busy_timeout=10000')
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
@@ -1327,7 +1327,7 @@ class HealthPersistence:
|
|||||||
|
|
||||||
# ────────────────────────────────────────────────────────────────
|
# ────────────────────────────────────────────────────────────────
|
||||||
# Disk Observations API
|
# Disk Observations API
|
||||||
# ──────────────────────<EFBFBD><EFBFBD><EFBFBD>─────────────────────────────────────────
|
# ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
def register_disk(self, device_name: str, serial: Optional[str] = None,
|
def register_disk(self, device_name: str, serial: Optional[str] = None,
|
||||||
model: Optional[str] = None, size_bytes: Optional[int] = None):
|
model: Optional[str] = None, size_bytes: Optional[int] = None):
|
||||||
@@ -1340,6 +1340,7 @@ class HealthPersistence:
|
|||||||
under 'ata8' and we now know the real block device is 'sdh' with
|
under 'ata8' and we now know the real block device is 'sdh' with
|
||||||
serial 'WX72...', update the old entry so observations are linked.
|
serial 'WX72...', update the old entry so observations are linked.
|
||||||
"""
|
"""
|
||||||
|
with self._db_lock:
|
||||||
now = datetime.now().isoformat()
|
now = datetime.now().isoformat()
|
||||||
try:
|
try:
|
||||||
conn = self._get_conn()
|
conn = self._get_conn()
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ class TelegramChannel(NotificationChannel):
|
|||||||
.replace('>', '>'))
|
.replace('>', '>'))
|
||||||
|
|
||||||
|
|
||||||
# ─── Gotify ──────────────────────────────────────────────────────
|
# ─── Gotify ───────────────────────────────────<EFBFBD><EFBFBD>──────────────────
|
||||||
|
|
||||||
class GotifyChannel(NotificationChannel):
|
class GotifyChannel(NotificationChannel):
|
||||||
"""Gotify push notification channel with priority mapping."""
|
"""Gotify push notification channel with priority mapping."""
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ def capture_journal_context(keywords: list, lines: int = 30,
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# ─── Journal Watcher (Real-time) ─────────────────────────────────
|
# ─── Journal Watcher (Real-time) ───────────────<EFBFBD><EFBFBD>─────────────────
|
||||||
|
|
||||||
class JournalWatcher:
|
class JournalWatcher:
|
||||||
"""Watches journald in real-time for critical system events.
|
"""Watches journald in real-time for critical system events.
|
||||||
|
|||||||
@@ -1615,6 +1615,7 @@ class NotificationManager:
|
|||||||
'ai_openai_base_url': self._config.get('ai_openai_base_url', ''),
|
'ai_openai_base_url': self._config.get('ai_openai_base_url', ''),
|
||||||
'ai_prompt_mode': self._config.get('ai_prompt_mode', 'default'),
|
'ai_prompt_mode': self._config.get('ai_prompt_mode', 'default'),
|
||||||
'ai_custom_prompt': self._config.get('ai_custom_prompt', ''),
|
'ai_custom_prompt': self._config.get('ai_custom_prompt', ''),
|
||||||
|
'ai_allow_suggestions': self._config.get('ai_allow_suggestions', 'false') == 'true',
|
||||||
'ai_detail_levels': ai_detail_levels,
|
'ai_detail_levels': ai_detail_levels,
|
||||||
'hostname': self._config.get('hostname', ''),
|
'hostname': self._config.get('hostname', ''),
|
||||||
'webhook_secret': self._config.get('webhook_secret', ''),
|
'webhook_secret': self._config.get('webhook_secret', ''),
|
||||||
|
|||||||
Reference in New Issue
Block a user