Internal
Public Access
Add debug endpoint to check mobile app User-Agent
This commit is contained in:
@@ -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),
|
||||
})
|
||||
Reference in New Issue
Block a user