diff --git a/.gitignore b/.gitignore index c178dbab..7bc521aa 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ recordings *.swp *~ noVNC-*.tgz +.idea/ \ No newline at end of file diff --git a/app/ui.js b/app/ui.js index f792d01b..be19a0bd 100644 --- a/app/ui.js +++ b/app/ui.js @@ -161,7 +161,9 @@ const UI = { UI.initSetting('resize', 'off'); UI.initSetting('shared', true); UI.initSetting('view_only', false); - UI.initSetting('path', 'websockify'); + + let socketUrl = (window.location.pathname || '/').replace(/\/([^/]+)?$/, '/websockify'); + UI.initSetting('path', socketUrl || '/websockify'); UI.initSetting('repeaterID', ''); UI.initSetting('reconnect', false); UI.initSetting('reconnect_delay', 5000); @@ -1019,7 +1021,7 @@ const UI = { if(port) { url += ':' + port; } - url += '/' + path; + url += path; UI.rfb = new RFB(document.getElementById('noVNC_container'), url, { shared: UI.getSetting('shared'),