Skip to content

Commit

Permalink
Revert "Add a jupyter server extension to render desktop/"
Browse files Browse the repository at this point in the history
Removes the server extension, so the HTML for the interface
*is* served by websockify itself. This is a fix for
yuvipanda#10
This reverts commit 18d7fb7.
  • Loading branch information
yuvipanda committed Nov 20, 2019
1 parent 18d7fb7 commit b6dee24
Show file tree
Hide file tree
Showing 245 changed files with 14 additions and 62 deletions.
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
graft jupyter_desktop_server/share
graft jupyter_desktop_server/etc
graft jupyter_desktop_server/templates
graft jupyter_desktop/share
25 changes: 7 additions & 18 deletions jupyter_desktop_server/__init__.py → jupyter_desktop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import os
import shlex
import tempfile
from notebook.utils import url_path_join as ujoin
from tornado.web import StaticFileHandler
from .handlers import DesktopHandler


HERE = os.path.dirname(os.path.abspath(__file__))

def setup_vnc():
def setup_desktop():
# make a secure temporary directory for sockets
# This is only readable, writeable & searchable by our uid
sockets_dir = tempfile.mkdtemp()
sockets_path = os.path.join(sockets_dir, 'vnc-socket')

vnc_command = [
vnc_command = ' '.join((shlex.quote(p) for p in [
os.path.join(HERE, 'share/tigervnc/bin/vncserver'),
'-verbose',
'-xstartup', os.path.join(HERE, 'share/xstartup'),
Expand All @@ -23,7 +20,7 @@ def setup_vnc():
'-rfbunixpath', sockets_path,
'-fg',
':1',
]
]))
return {
'command': [
'websockify', '-v',
Expand All @@ -32,18 +29,10 @@ def setup_vnc():
'5901',
'--unix-target', sockets_path,
'--',
] + vnc_command,
'/bin/sh', '-c',
f'cd {os.getcwd()} && {vnc_command}'
],
'port': 5901,
'timeout': 30,
'mappath': {'/': '/vnc_lite.html'},
}


def load_jupyter_server_extension(nbapp):
# Set up handlers picked up via config
base_url = nbapp.web_app.settings['base_url']

web_path = os.path.join(HERE, 'share/web')
nbapp.web_app.add_handlers('.*', [
(ujoin(base_url, 'desktop-server/static/(.*)'), StaticFileHandler, {'path': web_path}),
(ujoin(base_url, 'desktop'), DesktopHandler)
])
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</style>

<!-- Promise polyfill for IE11 -->
<script src="{{novnc_base_url}}vendor/promise.js"></script>
<script src="vendor/promise.js"></script>

<!-- ES2015/ES6 modules polyfill -->
<script type="module">
Expand All @@ -70,7 +70,7 @@
window.addEventListener("load", function() {
if (window._noVNC_has_module_support) return;
const loader = document.createElement("script");
loader.src = "{{novnc_base_url}}vendor/browser-es-module-loader/dist/" +
loader.src = "vendor/browser-es-module-loader/dist/" +
"browser-es-module-loader.js";
document.head.appendChild(loader);
});
Expand All @@ -79,7 +79,7 @@
<!-- actual script modules -->
<script type="module" crossorigin="use-credentials">
// RFB holds the API to connect and communicate with a VNC server
import RFB from '../desktop-server/static/noVNC-1.1.0/core/rfb.js';
import RFB from './core/rfb.js';

let rfb;
let desktopName;
Expand Down Expand Up @@ -155,7 +155,7 @@
let port = readQueryVariable('port', window.location.port);
const password = readQueryVariable('password', '');
// MODIFICATION FROM vnc_lite.html
const path = readQueryVariable('path', "{{base_url}}vnc/");
const path = readQueryVariable('path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify');

// | | | | | |
// | | | Connect | | |
Expand All @@ -174,8 +174,7 @@
if(port) {
url += ':' + port;
}
// MODIFICATION FROM vnc_lite
url += path;
url += '/' + path;

// Creating a new RFB object will start a new connection
rfb = new RFB(document.getElementById('screen'), url,
Expand Down
File renamed without changes.

This file was deleted.

24 changes: 0 additions & 24 deletions jupyter_desktop_server/handlers.py

This file was deleted.

5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
version='0.1.2',
entry_points={
'jupyter_serverproxy_servers': [
'vnc = jupyter_desktop_server:setup_vnc',
'desktop = jupyter_desktop:setup_desktop',
]
},
data_files=[
('etc/jupyter/jupyter_notebook_config.d', ['jupyter_desktop_server/etc/jupyter-desktop-server-serverextension.json']),
],
install_requires=['jupyter-server-proxy>=1.2.0'],
include_package_data=True,
zip_safe=False
Expand Down

0 comments on commit b6dee24

Please sign in to comment.