The spice_auto.html file allows websockify path to be set via a
query parameter, but the standard spice.html does not provide
any mechanism for this. Add another form input field to allow
it to be set, defaulting to /websockify

Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
---
 spice.html | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/spice.html b/spice.html
index d4c9962..e341f13 100644
--- a/spice.html
+++ b/spice.html
@@ -74,8 +74,13 @@
 
                 host = document.getElementById("host").value;
                 port = document.getElementById("port").value;
+                token = document.getElementById("token").value;
                 password = document.getElementById("password").value;
+                path = document.getElementById("path").value;
 
+                if (window.location.protocol == 'https:') {
+                    scheme = "wss://";
+                }
 
                 if ((!host) || (!port)) {
                     console.log("must set host and port");
@@ -86,7 +91,7 @@
                     sc.stop();
                 }
 
-                uri = scheme + host + ":" + port;
+                uri = scheme + host + ":" + port + "/" + path + "?token=" + 
token;
 
                 document.getElementById('connectButton').innerHTML = "Stop";
                 document.getElementById('connectButton').onclick = disconnect;
@@ -165,7 +170,9 @@
             <span class="logo">SPICE</span>
             <label for="host">Host:</label> <input type='text' id='host' 
value='localhost'> <!-- localhost -->
             <label for="port">Port:</label> <input type='text' id='port' 
value='5959'>
+            <label for="token">Token:</label> <input type='password' 
id='token' value=''>
             <label for="password">Password:</label> <input type='password' 
id='password' value=''>
+            <label for="password">Path:</label> <input type='text' id='path' 
value='websockify'>
             <button id="connectButton" onclick="connect();">Start</button>
         </div>
 
-- 
2.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to