From 41ccd110bad580f9e39b5f44ad9ea4b5aa451df2 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Fri, 14 Nov 2025 14:00:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D0=B9=20=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20API=20=D0=92=D0=9E=D0=9B=D0=9A=20=D0=B8=20=D1=81=D0=BE?= =?UTF-8?q?=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D1=83=D1=8E?= =?UTF-8?q?=D1=89=D0=B5=D0=B9=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D1=80=D0=BE=D0=BD=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_edit.py | 21 ++++++ templates/index.html | 36 ++++++++++ volk_load.py | 160 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 volk_load.py diff --git a/db_edit.py b/db_edit.py index 2922f1b..521ef5e 100644 --- a/db_edit.py +++ b/db_edit.py @@ -24,6 +24,7 @@ from tg_publish import publish_to_tg_all, publish_to_tg from db_update_shortname import ai_shortname_all, generate_ai_shortname from evtg_publish import tg_post_event_by_id, tg_post_all_events from zk_load import load_json_all +from volk_load import load_categories # Загружаем настройки из .env load_dotenv() @@ -1064,6 +1065,26 @@ def api_publish_all_events(): log_event(error_msg) return jsonify({'success': False, 'error': error_msg}), 500 +@bp.route('/api/load_categories', methods=['POST']) +@login_required +def api_load_categories(): + try: + # Проверка режима работы + workmode = os.getenv('WORKMODE', 'ZILANT') + if workmode != 'VOLK': + error_msg = "Загрузка категорий доступна только в режиме VOLK" + log_event(error_msg) + return jsonify({'success': False, 'error': error_msg}), 403 + + log_event("Запуск загрузки категорий...") + load_categories() + log_event("Загрузка категорий выполнена успешно") + return jsonify({'success': True}) + except Exception as e: + error_msg = f"Ошибка при загрузке категорий: {str(e)}" + log_event(error_msg) + return jsonify({'success': False, 'error': error_msg}), 500 + @bp.route('/api/publish_event/', methods=['POST']) @login_required def api_publish_event(event_id): diff --git a/templates/index.html b/templates/index.html index e951de0..ef7ba43 100644 --- a/templates/index.html +++ b/templates/index.html @@ -566,6 +566,11 @@ + {% if g.workmode == 'VOLK' %} + + {% endif %}