Switch to upstream novnc

Use vnc_light.html
This commit is contained in:
Simon Li 2019-09-29 21:18:13 +01:00
parent 69aca1fa4d
commit 56e2f614ae
3 changed files with 18 additions and 36 deletions

View File

@ -8,27 +8,30 @@ RUN apt-get update -y -q && \
tigervnc-standalone-server \
vim
# Desktop environment
# Desktop environment, keep in sync with jupyter_notebook_config.py
# ENV DESKTOP_PACKAGE lxde
ENV DESKTOP_PACKAGE xfce4
RUN apt-get install -y -q ${DESKTOP_PACKAGE}
# Novnc: just want web files, we'll install our own newer websockify
RUN apt-get download -q novnc && \
dpkg --force-all -i novnc*.deb && \
rm novnc*.deb
# Patch novnc to automatically connect
# Download missing fonts
ADD websocket-path-ui-js.patch /usr/share/novnc/include
RUN cd /usr/share/novnc/include/ && \
patch -p0 < websocket-path-ui-js.patch && \
curl -sSfLO https://raw.githubusercontent.com/novnc/noVNC/v1.1.0/app/styles/Orbitron700.ttf && \
curl -sSfLO https://raw.githubusercontent.com/novnc/noVNC/v1.1.0/app/styles/Orbitron700.woff
RUN cd /opt && \
curl -sSfL https://github.com/novnc/noVNC/archive/v1.1.0.tar.gz | tar -zxf -
# Patch novnc to use correct path to websockify (defaults to /)
# Note if you use vnc.html you will need to patch ui.js to use the correct path
# and also to override localstorage which may store an incorrect path from a
# different session
# Also resize server instead of scaling client
RUN sed -i.bak \
-e "s%\('path', 'websockify'\)%'path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify'); console.log('websockify path:' + path%" \
-re "s%rfb.scaleViewport = .+%rfb.resizeSession = readQueryVariable('resize', true);%" \
/opt/noVNC-1.1.0/vnc_lite.html
USER jovyan
# Custom jupyter-server-proxy to load vnc.html instead of /
# Custom jupyter-server-proxy to load vnc_lite.html instead of /
RUN /opt/conda/bin/pip install https://github.com/manics/jupyter-server-proxy/archive/indexpage.zip
RUN conda install -y -q -c manics/label/testing websockify
RUN conda install -y -q -c manics websockify=0.9.0
ADD jupyter_notebook_config.py /home/jovyan/.jupyter/jupyter_notebook_config.py
# There may be a discrepency between the interface vncserver listens on

View File

@ -10,10 +10,9 @@ else:
c.ServerProxy.servers = {
'desktop': {
'command': [
# '/usr/local/bin/websockify',
'/opt/conda/bin/websockify',
'-v',
'--web', '/usr/share/novnc',
'--web', '/opt/noVNC-1.1.0',
'5901',
'--',
'vncserver',
@ -27,6 +26,6 @@ c.ServerProxy.servers = {
'absolute_url': False,
'port': 5901,
'timeout': 30,
'indexpage': 'vnc.html?autoconnect=true',
'indexpage': 'vnc_lite.html',
}
}

View File

@ -1,20 +0,0 @@
--- ui.js.bak 2019-09-26 16:55:26.816459927 +0000
+++ ui.js 2019-09-26 16:57:06.149994873 +0000
@@ -82,7 +82,7 @@
UI.initSetting('shared', true);
UI.initSetting('view_only', false);
UI.initSetting('connectTimeout', 2);
- UI.initSetting('path', 'websockify');
+ console.log('1', UI.getSetting('path')); console.log(); UI.initSetting('path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify'); console.log('2', UI.getSetting('path'));
UI.initSetting('repeaterID', '');
UI.rfb = RFB({'target': $D('noVNC_canvas'),
@@ -90,7 +90,7 @@
'onClipboard': UI.clipReceive,
'onDesktopName': UI.updateDocumentTitle});
- autoconnect = WebUtil.getQueryVar('autoconnect', false);
+ autoconnect = WebUtil.getQueryVar('autoconnect', true);
if (autoconnect === 'true' || autoconnect == '1') {
autoconnect = true;
UI.connect();