1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-10-21 18:40:06 +00:00

fix(console): fix novncd startup in container and prevent double slashes in websocket url

This commit is contained in:
catborise 2026-09-25 23:11:52 +03:00
parent f061189716
commit d9112b797f
7 changed files with 64 additions and 15 deletions

View file

@ -143,6 +143,7 @@ class CompatibilityMixIn(object):
# NoVNC uses it's own convention that forward token
# from the request to a cookie header, we should check
# also for this behavior
token = None
hcookie = self.headers.get("cookie")
if hcookie:
@ -159,6 +160,22 @@ class CompatibilityMixIn(object):
if "token" in cookie:
token = cookie["token"].value
# Fallback to query parameter if token not found in cookie
if not token and hasattr(self, "path"):
from urllib.parse import parse_qs, urlparse
try:
parsed_url = urlparse(self.path)
query_params = parse_qs(parsed_url.query)
if "token" in query_params:
token = query_params["token"][0]
except Exception:
pass
if not token:
self.msg("No console token provided in cookie or query parameters")
return
(
connhost,
connport,