From b566493e5aa1700db3ce5a8f82b0bbdb7b52c5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Fri, 5 Sep 2025 09:22:37 +0200 Subject: [PATCH] dodatkowe poprawki i funkcje --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index d32a61a..6fae5d8 100644 --- a/app.py +++ b/app.py @@ -143,7 +143,7 @@ else: API_TOKEN = "superSecretTokenABC123" logger.info("API_TOKEN ustawiony na wartość domyślną: superSecretTokenABC123") -def require_auth(): +def requireAuth(): """Wymusza autoryzację przy pomocy nagłówka Authorization, który powinien zawierać API_TOKEN.""" token = request.headers.get("Authorization") @@ -152,7 +152,7 @@ def require_auth(): logger.warning("Nieprawidłowy token w nagłówku Authorization. Oczekiwano innego ciągu znaków.") abort(401, description="Unauthorized") -def validate_hosts_syntax(hosts_content): +def validateHostsSyntax(hosts_content): import ipaddress seen = {} lines = hosts_content.splitlines() @@ -252,7 +252,7 @@ def root_index(): @app.route('/hosts', methods=['GET']) def get_hosts(): - require_auth() + requireAuth() metrics["hosts_get"] += 1 try: with open('/etc/hosts', 'r') as f: