diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 00000000..1b155532 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python + +ENV VER=${VER:-master} \ + REPO=https://github.com/twhtanghk/noVNC \ + APP=/usr/src/app + +RUN apt-get update \ +&& apt-get install -y git net-tools \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* \ +&& pip install numpy \ +&& git clone -b $VER $REPO $APP + +WORKDIR $APP + +EXPOSE 6080 diff --git a/README.md b/README.md index 70a819a9..4cbedef2 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,10 @@ WebSockets to TCP socket proxy. There is a python proxy included ### Quick Start +* download docker-compose.yml and customize server:port parameter + +* docker-compose -f docker-compose.yml up + * Use the launch script to start a mini-webserver and the WebSockets proxy (websockify). The `--vnc` option is used to specify the location of a running VNC server: diff --git a/core/rfb.js b/core/rfb.js index ece0f008..ae4d13d2 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -392,7 +392,10 @@ RFB.prototype = { uri = this._encrypt ? 'wss' : 'ws'; } - uri += '://' + this._rfb_host + ':' + this._rfb_port + '/' + this._rfb_path; + var relpath = location.pathname.split('/'); + relpath[relpath.length - 1] = ""; + relpath = relpath.join("/"); + uri += '://' + this._rfb_host + ':' + this._rfb_port + relpath + this._rfb_path; Log.Info("connecting to " + uri); try { diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9aca6a4b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '2' +services: + novnc: + image: twhtanghk/novnc + ports: + - 6080 + env_file: + - ../.env + command: /usr/src/app/utils/launch.sh --vnc server:port