diff --git a/tasks/views_debug.py b/tasks/views_debug.py index be9ff61..c9a5dbc 100644 --- a/tasks/views_debug.py +++ b/tasks/views_debug.py @@ -1,20 +1,40 @@ """Debug views for troubleshooting mobile app.""" -from django.http import JsonResponse +from django.http import JsonResponse, HttpResponse from django.views.decorators.csrf import csrf_exempt +from django.views.decorators.http import require_http_methods @csrf_exempt +@require_http_methods(["GET", "POST"]) 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), - }) + # Simple HTML response that's easy to see in iframe + html = f""" + + + + Debug Info + + + +

Mobile App Debug Info

+

User-Agent:
{user_agent}

+

Contains 'wv': {'wv' in user_agent.lower()}

+

Contains 'CapacitorHttp': {'CapacitorHttp' in user_agent}

+

Is Mobile App Detected: + + {('wv' in user_agent.lower() or 'CapacitorHttp' in user_agent)} + +

+ + + """ + + return HttpResponse(html)