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):
--- /dev/null
+<%page expression_filter="h" />
+<%inherit file="skeleton.mako" />
+
+<%def name="title()">
+Console to ${machine.name}
+</%def>
+
+<style type='text/css'>body { max-width: none }</style>
+% if not on:
+<p> Your machine appears to be off.</p>
+% elif not has_vnc:
+<p> Your machine appears to not be accepting VNC connections. Perhaps you have a ParaVM machine?</p>
+% endif
+
+<p>See <a href="help?subject=Console" target="_blank">tips</a> about framebuffer and other issues.</p>
+
+<script type="text/javascript" src="static/novnc-1.0.js"></script>
+
+<div id="novnc">
+</div>
+<script type="text/javascript">
+ let rfb = new novnc.default(document.getElementById("novnc"), "wss://${hostname}:${config.vnc.novnc_port}/vnc?host=${vnc_host};vmname=${machine.name};token=${authtoken}");
+</script>