diff --git a/changelog.md b/changelog.md index 4a9fe2e..0017b5a 100644 --- a/changelog.md +++ b/changelog.md @@ -28,4 +28,7 @@ - Проверка доступности реализована через HTTP-запросы при каждом открытии главной страницы ## [improve] Асинхронный индикатор статуса сервисов -- Индикатор статуса сервисов теперь обновляется асинхронно через отдельный API-эндпоинт, не тормозит загрузку страницы \ No newline at end of file +- Индикатор статуса сервисов теперь обновляется асинхронно через отдельный API-эндпоинт, не тормозит загрузку страницы + +## [change] Переименование секции services в checkOnline +- Секция services в config.yaml переименована в checkOnline, код обновлён \ No newline at end of file diff --git a/config.yaml b/config.yaml index fe62cbf..684b0b3 100644 --- a/config.yaml +++ b/config.yaml @@ -180,14 +180,8 @@ weather: lon: 37.618423 cache_ttl: 60 -services: +checkOnline: - name: Uptime Kuma url: http://192.168.1.222:3001/ - name: PiHole X86 url: https://192.168.1.11/admin - - name: Router - url: http://192.168.1.1/ - - name: Portainer - url: https://portainer.ddl.su/ - - name: Grafana - url: http://192.168.1.143:3000/ \ No newline at end of file diff --git a/main.py b/main.py index 030c296..a218f9f 100644 --- a/main.py +++ b/main.py @@ -155,8 +155,8 @@ def api_weather_forecast(): @app.route('/api/services-status', methods=['GET']) def api_services_status(): config = load_config() - services = config.get('services', []) - status = check_services_status(services) if services else None + check_online = config.get('checkOnline', []) + status = check_services_status(check_online) if check_online else None return jsonify({'all_services_up': status}) # config = load_config() # Удаляем глобальную переменную @@ -176,7 +176,6 @@ def index(): current_time = now.strftime('%H:%M:%S') weather = get_weather() config = load_config() # Загружаем актуальный конфиг при каждом запросе - # Убираем all_services_up из рендера return render_template('index.html', applications=config['applications'], bookmarks=config['bookmarks'], now=now_str, current_time=current_time, weather=weather) if __name__ == '__main__':