From 5f5fe8e2f1eaf0172808a0f52abb576ec2baab8a Mon Sep 17 00:00:00 2001 From: Vladislav Zaynchkovsky Date: Tue, 5 Jun 2018 14:55:49 +0300 Subject: [PATCH] use socket relative to page path --- .gitignore | 1 + app/ui.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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 d587cfc6..70131788 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(/\/[\w\.]+$/, '/websockify'); + UI.initSetting('path', socketUrl || '/websockify'); UI.initSetting('repeaterID', ''); UI.initSetting('reconnect', false); UI.initSetting('reconnect_delay', 5000); @@ -1012,7 +1014,7 @@ const UI = { if(port) { url += ':' + port; } - url += '/' + path; + url += path; UI.rfb = new RFB(document.getElementById('noVNC_container'), url, { shared: UI.getSetting('shared'),