Fixed sub links generation
All checks were successful
Docker hub build / docker (push) Successful in 6m12s

This commit is contained in:
AB from home.homenet
2025-08-05 01:50:11 +03:00
parent 1f7953a74c
commit 56b0b160e3
2 changed files with 6 additions and 2 deletions

View File

@@ -482,8 +482,8 @@
One link for all your Xray protocols (VLESS, VMess, Trojan) One link for all your Xray protocols (VLESS, VMess, Trojan)
</p> </p>
<div class="link-url" style="margin-bottom: 0;"> <div class="link-url" style="margin-bottom: 0;">
{% url 'xray_subscription' user_links.0.link as xray_url %}{{ request.scheme }}://{{ request.get_host }}{{ xray_url }} {% url 'xray_subscription' user_links.0.link as xray_url %}{{ force_scheme|default:request.scheme }}://{{ request.get_host }}{{ xray_url }}
<button class="copy-btn" onclick="copyToClipboard('{{ request.scheme }}://{{ request.get_host }}{{ xray_url }}')">Copy</button> <button class="copy-btn" onclick="copyToClipboard('{{ force_scheme|default:request.scheme }}://{{ request.get_host }}{{ xray_url }}')">Copy</button>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@@ -34,6 +34,9 @@ def userPortal(request, user_hash):
recent_connections = 0 recent_connections = 0
logger.warning(f"No cached statistics found for user {user.username}. Run statistics update task.") 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 # Group links by server
servers_data = {} servers_data = {}
total_links = 0 total_links = 0
@@ -157,6 +160,7 @@ def userPortal(request, user_hash):
'recent_connections': recent_connections, 'recent_connections': recent_connections,
'external_address': EXTERNAL_ADDRESS, 'external_address': EXTERNAL_ADDRESS,
'has_xray_servers': has_xray_servers, 'has_xray_servers': has_xray_servers,
'force_scheme': scheme, # Override request.scheme in template
} }
logger.debug(f"Context prepared with keys: {list(context.keys())}") logger.debug(f"Context prepared with keys: {list(context.keys())}")