🎉 Improved API Response Validation & Documentation 🖥️📚

This commit is contained in:
2025-06-16 11:30:15 +02:00
parent 061bae3005
commit 6ee04b1d64
4 changed files with 1091 additions and 20 deletions

View File

@@ -647,6 +647,23 @@ def csrf_protect():
if request.path.startswith('/api/guest/'):
return # Kein CSRF für Guest-APIs
# Tapo-Hardware-Steuerung von CSRF befreien (Geräte verwenden kein CSRF)
if request.path.startswith('/tapo/'):
return # Kein CSRF für Tapo-Hardware-Steuerung
# Drucker-API-Endpunkte mit Tapo-Integration von CSRF befreien
tapo_api_paths = [
'/api/printers/control/', # Stromsteuerung über PyP100
'/api/printers/tapo/', # Alle Tapo-spezifischen APIs
'/api/printers/force-refresh', # Force-Refresh (verwendet Tapo-Status)
'/api/printers/status', # Status-API (verwendet Tapo-Status)
'/api/admin/printers/', # Admin-Printer-APIs (Toggle-Funktion)
]
for path in tapo_api_paths:
if request.path.startswith(path):
return # Kein CSRF für Tapo-Hardware-APIs
try:
from flask_wtf.csrf import generate_csrf
token = generate_csrf()