добавил атостарт всех сайтов
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-05-16 12:41:54 +10:00
parent 656c8d9d9a
commit 770445feaa
4 changed files with 55 additions and 2 deletions

View File

@@ -409,6 +409,25 @@ def get_all_sources(category: str):
return {"error": str(e), "sources": []}
def get_true_sources():
"""Возвращает все записи из таблицы sourse. Сначала показываются записи со status=true"""
conn = get_connection()
try:
with conn.cursor(cursor_factory=RealDictCursor) as cur:
cur.execute("""
SELECT * FROM sourse
WHERE status = true
""")
rows = cur.fetchall()
sources = {}
for row in rows:
sources.update({row["url"]: row["promt"]})
return sources
except Exception as e:
print(f"Ошибка при получении источников: {e}")
return {"error": str(e), "sources": []}
def update_source_status(url: str, status: bool = True):
"""Обновляет статус источника по URL"""
conn = get_connection()