imap_stream (Фаза 1): IDLE-цикл с реконнектом + SQLite mailbox.db; фикс токена TG (vesti/.env всегда); фильтр актуальности urgent (>=3 дн пропуск); HERMES_REAL_HOME в imap_client

This commit is contained in:
2026-09-15 18:34:37 +00:00
parent defcf53d75
commit 5a81c86599
3 changed files with 692 additions and 3 deletions
+6 -1
View File
@@ -127,11 +127,16 @@ def _load_credentials():
Возвращает dict(host, port, login, password).
(Вынесено из _himalaya_imap_credentials() в mail_archive.py, чтобы иметь
единый источник кред и не дублировать парсинг конфига.)
HOME: в сессии Hermes HOME может быть /opt/hermes/.hermes/home, а конфиг
himalaya лежит в реальном HOME пользователя (/home/estorozhenko).
Учитываем HERMES_REAL_HOME (как mail_archive._himalaya_cmd()).
"""
import tomllib
from pathlib import Path
cfg_path = Path.home() / ".config" / "himalaya" / "config.toml"
home = os.environ.get("HERMES_REAL_HOME") or str(Path.home())
cfg_path = Path(home) / ".config" / "himalaya" / "config.toml"
with open(cfg_path, "rb") as f:
cfg = tomllib.load(f)
accounts = cfg.get("accounts", {})