diff --git a/vpn/templates/vpn/user_portal.html b/vpn/templates/vpn/user_portal.html index 8f4975a..fabb18e 100644 --- a/vpn/templates/vpn/user_portal.html +++ b/vpn/templates/vpn/user_portal.html @@ -482,8 +482,8 @@ One link for all your Xray protocols (VLESS, VMess, Trojan)

{% endif %} diff --git a/vpn/views.py b/vpn/views.py index a9c2571..07b440b 100644 --- a/vpn/views.py +++ b/vpn/views.py @@ -34,6 +34,9 @@ def userPortal(request, user_hash): recent_connections = 0 logger.warning(f"No cached statistics found for user {user.username}. Run statistics update task.") + # Determine protocol scheme + scheme = 'https' if request.is_secure() else 'http' + # Group links by server servers_data = {} total_links = 0 @@ -157,6 +160,7 @@ def userPortal(request, user_hash): 'recent_connections': recent_connections, 'external_address': EXTERNAL_ADDRESS, 'has_xray_servers': has_xray_servers, + 'force_scheme': scheme, # Override request.scheme in template } logger.debug(f"Context prepared with keys: {list(context.keys())}")