Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: small readability and consistency details #104

Merged
merged 4 commits into from
Mar 30, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions jupyter_remote_desktop_proxy/setup_websockify.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def setup_websockify():
is_tigervnc = "tigervnc" in vncserver_file.read().casefold()

if is_tigervnc:
websockify_args = ['--unix-target', sockets_path]
vnc_args = [vncserver, '-rfbunixpath', sockets_path]
socket_args = ['--unix-target', sockets_path]
else:
vnc_args = [vncserver, '-rfbport', '{port}']
socket_args = []
websockify_args = []
vnc_args = [vncserver, '-localhost', '-rfbport', '{port}']
Comment on lines -40 to +41
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About passing -localhost to turbovnc

This won't change anything, its just about making both VNC servers startup as localhost and not just TigerVNC for consistency.

TigerVNC listens to localhost by default, and TurboVNC doesn't. Let's make them do the same.

When websockify starts either TigerVNC or TurboVNC, it will listen only to localhost anyhow - so this doesn't change anything really but could reduce the complexity a bit when debugging these things, as I've done at length now.


if not os.path.exists(os.path.expanduser('~/.vnc/xstartup')):
vnc_args.extend(['-xstartup', os.path.join(HERE, 'share/xstartup')])
Expand All @@ -47,23 +47,22 @@ def setup_websockify():
vnc_args
+ [
'-verbose',
'-fg',
'-geometry',
'1680x1050',
'-SecurityTypes',
'None',
'-fg',
]
)

return {
'command': [
'websockify',
'-v',
'--heartbeat',
'30',
'--verbose',
'--heartbeat=30',
'{port}',
]
+ socket_args
+ websockify_args
+ ['--', '/bin/sh', '-c', f'cd {os.getcwd()} && {vnc_command}'],
'timeout': 30,
'new_browser_window': True,
Expand Down