diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 618d68b06..4522bc363 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -372,22 +372,38 @@ var kimchi = { }).done(function(data, textStatus, xhr) { url = 'https://' + location.hostname + ':' + proxy_port; url += server_root; - url += "/plugins/kimchi/spice_auto.html"; - /* - * When using server_root we need pass the value with port - * argument to be used correctly by spice_auto.html scripts - */ - url += "?port=" + proxy_port + server_root; - url += "&listen=" + location.hostname; - /* - * From python documentation base64.urlsafe_b64encode(s) - * substitutes - instead of + and _ instead of / in the - * standard Base64 alphabet, BUT the result can still - * contain = which is not safe in a URL query component. - * So remove it when needed as base64 can work well without it. - * */ - url += "&token=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, ""); - url += '&encrypt=1'; + + let spice_html5 = true; + if(spice_html5) + { + url += "/plugins/kimchi/spice_auto.html"; + /* + * When using server_root we need pass the value with port + * argument to be used correctly by spice_auto.html scripts + */ + url += "?port=" + proxy_port + server_root; + url += "&listen=" + location.hostname; + /* + * From python documentation base64.urlsafe_b64encode(s) + * substitutes - instead of + and _ instead of / in the + * standard Base64 alphabet, BUT the result can still + * contain = which is not safe in a URL query component. + * So remove it when needed as base64 can work well without it. + * */ + url += "&token=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, ""); + url += '&encrypt=1'; + } + else + { + /* + * Slightly different api for spice-web-client + */ + url += "/plugins/kimchi/spice-web-client/index.html"; + url += "?port=" + proxy_port + server_root; + url += "&host=" + location.hostname; + url += "&vmInfoToken=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, ""); + url += '&protocol=wss'; + } window.open(url); }); }, diff --git a/ui/spice-web-client/lib/utils.js b/ui/spice-web-client/lib/utils.js index 1b7bda7a3..8b123c2ed 100644 --- a/ui/spice-web-client/lib/utils.js +++ b/ui/spice-web-client/lib/utils.js @@ -290,7 +290,7 @@ wdi.Utils = { * If not, an URL with destInfoToken is generated, host and port are resolved by backend service. */ if ( ! destHost || ! destPort ) { - url = protocol + '://' + host + ':' + port + '/websockify/destInfoToken/' + destInfoToken + '/type/' + type; + url = protocol + '://' + host + ':' + port + '/websockify?token=' + destInfoToken; } else { url = protocol + '://' + host + ':' + port + '/websockify/host/' + destHost + '/port/' + destPort + '/type/' + type; }