Files
KeepItGoingServer/tasks/views_debug.py
T

21 lines
647 B
Python

"""Debug views for troubleshooting mobile app."""
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def debug_user_agent(request):
"""Return the User-Agent header for debugging mobile app."""
user_agent = request.META.get('HTTP_USER_AGENT', 'No User-Agent')
return JsonResponse({
'user_agent': user_agent,
'is_mobile_app_detected': (
'CapacitorHttp' in user_agent or
'com.firebugit.keepitgoing' in user_agent or
('KeepItGoing' in user_agent and 'Mobile' in user_agent)
),
'headers': dict(request.META),
})