Chore: Remove unnecessary constants

This commit is contained in:
2026-05-25 19:00:47 +05:45
parent a71c74f133
commit 71379950bc
11 changed files with 56 additions and 53 deletions
+3 -2
View File
@@ -6,6 +6,7 @@ import jwt
import base64
import json
from datetime import datetime, timedelta
from runtime_urls import VNC_BASE_URL, VNC_PROXY_HOST, VNC_PROXY_PORT, VNC_SECRET_KEY
def generate_vnc_url(virtual_machine_id: str, secret_key: str) -> str:
"""
@@ -31,7 +32,7 @@ def generate_vnc_url(virtual_machine_id: str, secret_key: str) -> str:
token_bytes = json.dumps(outer_payload).encode("utf-8")
token_b64 = base64.urlsafe_b64encode(token_bytes).decode("utf-8").rstrip("=")
return f"https://vnc.xcloudify.tech/vnc.html?autoconnect=true&host=127.0.0.1&port=6002&path=vnc?token={token_b64}"
return f"{VNC_BASE_URL}?autoconnect=true&host={VNC_PROXY_HOST}&port={VNC_PROXY_PORT}&path=vnc?token={token_b64}"
def render_list():
@@ -244,7 +245,7 @@ def render_list():
with st.popover("Actions", use_container_width=True):
if VirtualMachine['status'] == "running":
vnc_url = generate_vnc_url(VirtualMachine['id'], "your-very-secret-key") # replace with secure source
vnc_url = generate_vnc_url(VirtualMachine['id'], VNC_SECRET_KEY)
st.page_link(vnc_url,label="VNC")
# if st.button("Open Console", key=f"console_{VirtualMachine['id']}", use_container_width=True):
# js = f"window.open('{vnc_url}', '_blank')"