debug: log mobile cookies to /tmp/pwa_debug.log
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-03-18 10:16:16 +01:00
parent ec51db9de4
commit 164b9c925e

View File

@ -101,6 +101,20 @@ def get_or_create_analytics_session():
# PWA detection from cookie (set by JS in standalone mode)
pwa_cookie = request.cookies.get('pwa_mode') == '1'
pwa_display = request.cookies.get('pwa_display', '')
# DEBUG: log all cookies for mobile sessions to /tmp/pwa_debug.log
if user_session.device_type == 'mobile':
try:
with open('/tmp/pwa_debug.log', 'a') as _f:
import json as _json
_f.write(_json.dumps({
'session_id': user_session.id,
'path': request.path,
'pwa_mode': request.cookies.get('pwa_mode'),
'pwa_display': request.cookies.get('pwa_display'),
'all_cookies': list(request.cookies.keys()),
}) + '\n')
except Exception:
pass
if not user_session.is_pwa and pwa_cookie:
user_session.is_pwa = True
db.commit()