Add debug endpoint to check mobile app User-Agent

This commit is contained in:
Keith Smith
2025-12-26 22:13:07 -07:00
parent 31a0c3c8c5
commit 41abdf4074
2 changed files with 24 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
"""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),
})