From: Quentin Smith Date: Fri, 15 Jun 2018 03:18:47 +0000 (-0400) Subject: Handler to serve NoVNC page X-Git-Tag: 0.1.57~8 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/99ec806bd6aba6eb652093a9a5903103b9387cbe Handler to serve NoVNC page --- diff --git a/code/main.py b/code/main.py index a8926f2..dec53d6 100755 --- a/code/main.py +++ b/code/main.py @@ -372,6 +372,31 @@ console will suffer artifacts. return d @cherrypy.expose + @cherrypy.tools.mako(filename="/novnc.mako") + def novnc(self, machine_id): + """NoVNC page functionality. + + You need to set config.vnc.novnc_port and run the NoVNC proxy on + the web server. + """ + machine = validation.Validate(cherrypy.request.login, + cherrypy.request.state, + machine_id=machine_id).machine + token = controls.vnctoken(machine) + host = controls.listHost(machine) + + status = controls.statusInfo(machine) + has_vnc = hasVnc(status) + + d = dict(on=status, + has_vnc=has_vnc, + machine=machine, + hostname=cherrypy.request.local.name, + vnc_host=host, + authtoken=token) + return d + + @cherrypy.expose @cherrypy.tools.mako(filename="/command.mako") @cherrypy.tools.require_POST() def command(self, command_name, machine_id, **kwargs): diff --git a/code/templates/novnc.mako b/code/templates/novnc.mako new file mode 100644 index 0000000..b0e3bf8 --- /dev/null +++ b/code/templates/novnc.mako @@ -0,0 +1,23 @@ +<%page expression_filter="h" /> +<%inherit file="skeleton.mako" /> + +<%def name="title()"> +Console to ${machine.name} + + + +% if not on: +

Your machine appears to be off.

+% elif not has_vnc: +

Your machine appears to not be accepting VNC connections. Perhaps you have a ParaVM machine?

+% endif + +

See tips about framebuffer and other issues.

+ + + +
+
+