Commit 7585d01 for novnc.com

commit 7585d0149de7ef9f38b817eb926c391c1751981b
Author: Lufei <lufei@uniontech.com>
Date:   Tue Sep 1 15:50:33 2026 +0800

    feat: keep vnc_lite.html align with vnc.html in URL handling

    Use same logic for generating websocket URL in `vnc_lite.html` with
    `vnc.html`, to ensure custom subpath works for `vnc_lite.html` entry
    as well.

    .e.g novnc serve behind nginx reverse proxy like:

    ```
    location ^~ /novnc/ {
        proxy_pass http://127.0.0.1:8888/;
        ...
    ```

    To keep lite, hash fragment, encrypt, .etc not included.

    Signed-off-by: Lufei <lufei@uniontech.com>

diff --git a/vnc_lite.html b/vnc_lite.html
index 79d4814..96ee5ac 100644
--- a/vnc_lite.html
+++ b/vnc_lite.html
@@ -126,10 +126,10 @@
         document.getElementById('sendCtrlAltDelButton')
             .onclick = sendCtrlAltDel;

-        // Read parameters specified in the URL query string
-        // By default, use the host and port of server that served this file
-        const host = readQueryVariable('host', window.location.hostname);
-        let port = readQueryVariable('port', window.location.port);
+        // Use same logic as vnc.html, but to keep lite, without hash fragment,
+        // encrypt flag, .etc
+        const host = readQueryVariable('host', '');
+        const port = readQueryVariable('port', 0);
         const password = readQueryVariable('password');
         const path = readQueryVariable('path', 'websockify');

@@ -140,20 +140,26 @@
         status("Connecting");

         // Build the websocket URL used to connect
+        const protocol = (window.location.protocol === "https:")
+            ? 'wss:' : 'ws:';
         let url;
-        if (window.location.protocol === "https:") {
-            url = 'wss';
+
+        if (host) {
+            url = new URL("https://" + host);
+
+            url.protocol = protocol;
+            if (port) {
+                url.port = port;
+            }
+
+            url = new URL("./" + path, url);
         } else {
-            url = 'ws';
-        }
-        url += '://' + host;
-        if(port) {
-            url += ':' + port;
+            url = new URL(path, location.href);
+            url.protocol = protocol;
         }
-        url += '/' + path;

         // Creating a new RFB object will start a new connection
-        rfb = new RFB(document.getElementById('screen'), url,
+        rfb = new RFB(document.getElementById('screen'), url.href,
                       { credentials: { password: password } });

         // Add listeners to important events from the RFB module