tg-сессия в комбайне + панель: ключи/сессия в шапке + фикс пустого radar_sources
- omni/config.py: tg_cfg() читает data/tg.json (вне git), env приоритетнее
- omni/tgsess.py: enabled()/fetch() подтягивают креды из config
- tools/tg_pick.py: перебор пула сессий, проверка is_user_authorized, личные аккаунты исключены
- omni claw pump: 2 канала -> 27 постов через сессию (проверено)
- omni/serve.py: /api/stats += keys{totals}, tg{enabled}
- web/index.html: строка статуса в шапке (ключей / сервисов / TG сессия)
- omni/cli.py radar --apply: пишет полный набор, а не только новые (повторный прогон обнулял файл)
- omni/cli.py radar --import-posts: --since-days + скип известных url до simhash
This commit is contained in:
@@ -23,6 +23,11 @@ SERVICE_RE = re.compile(
|
||||
|
||||
|
||||
def enabled():
|
||||
try:
|
||||
from . import config
|
||||
config.tg_cfg()
|
||||
except Exception:
|
||||
pass
|
||||
return bool(os.environ.get("OMNI_TG_SESSION") and os.environ.get("OMNI_TG_API_ID")
|
||||
and os.environ.get("OMNI_TG_API_HASH"))
|
||||
|
||||
@@ -75,6 +80,11 @@ def fetch(handles, limit=None):
|
||||
"""Список словарей {handle, title, id, posts[]} по каналам. Пусто, если нет env."""
|
||||
if not enabled():
|
||||
return []
|
||||
try:
|
||||
from . import config
|
||||
config.tg_cfg()
|
||||
except Exception:
|
||||
pass
|
||||
session = os.environ["OMNI_TG_SESSION"]
|
||||
api_id = int(os.environ["OMNI_TG_API_ID"])
|
||||
api_hash = os.environ["OMNI_TG_API_HASH"]
|
||||
|
||||
Reference in New Issue
Block a user