[pve-devel] [PATCH novnc] generate index.html.tpl from vnc.html

Dominik Csapak d.csapak at proxmox.com
Tue Mar 7 11:18:19 CET 2017


we do not want to have the html for novnc in the pve-manager package,
so we have it in the novnc-pve package as a template, which we will
load using Template::Toolkit

the changes are copied from NoVncIndex.pm from pve-manager/PVE/

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 Makefile                               |   1 +
 debian/install                         |   1 +
 debian/patches/customize-html-tpl.diff | 207 +++++++++++++++++++++++++++++++++
 debian/patches/series                  |   1 +
 4 files changed, 210 insertions(+)
 create mode 100644 debian/patches/customize-html-tpl.diff

diff --git a/Makefile b/Makefile
index b6e1777..9ddde44 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ ${DEB}: ${TARSRC}
 	tar xf ${NOVNCSRC}
 	cp -a debian ${NOVNCDIR}/debian
 	cp ${NOVNCDIR}/include/ui.js ${NOVNCDIR}/pveui.js
+	cp ${NOVNCDIR}/vnc.html ${NOVNCDIR}/index.html.tpl
 	# fix file permissions
 	chmod 0644 ${NOVNCDIR}/include/jsunzip.js
 	echo "git clone git://git.proxmox.com/git/novnc-pve.git\\ngit checkout ${GITVERSION}" > ${NOVNCDIR}/debian/SOURCE
diff --git a/debian/install b/debian/install
index 2594cec..e272398 100644
--- a/debian/install
+++ b/debian/install
@@ -20,3 +20,4 @@ include/Orbitron700.ttf	/usr/share/novnc-pve/include
 include/Orbitron700.woff /usr/share/novnc-pve/include
 include/keysym.js	/usr/share/novnc-pve/include
 include/inflator.js    /usr/share/novnc-pve/include
+index.html.tpl		/usr/share/novnc-pve
diff --git a/debian/patches/customize-html-tpl.diff b/debian/patches/customize-html-tpl.diff
new file mode 100644
index 0000000..46e38d3
--- /dev/null
+++ b/debian/patches/customize-html-tpl.diff
@@ -0,0 +1,207 @@
+--- a/index.html.tpl
++++ b/index.html.tpl
+@@ -1,18 +1,7 @@
+ <!DOCTYPE html>
+ <html>
+ <head>
+-
+-    <!--
+-    noVNC example: simple example using default UI
+-    Copyright (C) 2012 Joel Martin
+-    Copyright (C) 2013 Samuel Mannehed for Cendio AB
+-    noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
+-    This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
+-
+-    Connect parameters are provided in query string:
+-        http://example.com/?host=HOST&port=PORT&encrypt=1&true_color=1
+-    -->
+-    <title>noVNC</title>
++    <title>[% nodename %] - Proxmox Console</title>
+ 
+     <meta charset="utf-8">
+ 
+@@ -22,46 +11,39 @@
+ 
+     <!-- Apple iOS Safari settings -->
+     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
+-    <meta name="apple-mobile-web-app-capable" content="yes" />
+-    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+-    <!-- App Start Icon  -->
+-    <link rel="apple-touch-startup-image" href="images/screen_320x460.png" />
+-    <!-- For iOS devices set the icon to use if user bookmarks app on their homescreen -->
+-    <link rel="apple-touch-icon" href="images/screen_57x57.png">
+-    <!--
+-    <link rel="apple-touch-icon-precomposed" href="images/screen_57x57.png" />
+-    -->
+-
+-
+     <!-- Stylesheets -->
+-    <link rel="stylesheet" href="include/base.css" />
+-    <link rel="alternate stylesheet" href="include/black.css" TITLE="Black" />
+-    <link rel="alternate stylesheet" href="include/blue.css" TITLE="Blue" />
+-
+-    <!--
+-    <script type='text/javascript'
+-        src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+-    -->
++    <link rel="stylesheet" href="/novnc/include/base.css" />
+ 
++    [% IF langfile %]
++    <script type='text/javascript' src='/pve2/locale/pve-lang-[% lang %].js'></script>
++    [% ELSE %]
++    <script type="text/javascript">function gettext(buf) { return buf; }</script>
++    [% END %]
++    <script type="text/javascript">
++if (typeof(PVE) === 'undefined') PVE = {};
++PVE.UserName = '[% username %]';
++PVE.CSRFPreventionToken = '[% token %]';
++INCLUDE_URI='/novnc/include/';
++    </script>
+ </head>
+ 
+ <body>
+     <div id="noVNC-control-bar" class="noVNC_status_normal">
+         <!--noVNC Mobile Device only Buttons-->
+         <div class="noVNC-buttons-left">
+-            <input type="image" alt="viewport drag" src="images/drag.png"
++            <input type="image" alt="viewport drag" src="/novnc/images/drag.png"
+                 id="noVNC_view_drag_button" class="noVNC_status_button"
+                 title="Move/Drag Viewport">
+             <div id="noVNC_mobile_buttons">
+-                <input type="image" alt="No mousebutton" src="images/mouse_none.png"
++                <input type="image" alt="No mousebutton" src="/novnc/images/mouse_none.png"
+                     id="noVNC_mouse_button0" class="noVNC_status_button">
+-                <input type="image" alt="Left mousebutton" src="images/mouse_left.png"
++                <input type="image" alt="Left mousebutton" src="/novnc/images/mouse_left.png"
+                     id="noVNC_mouse_button1" class="noVNC_status_button">
+-                <input type="image" alt="Middle mousebutton" src="images/mouse_middle.png"
++                <input type="image" alt="Middle mousebutton" src="/novnc/images/mouse_middle.png"
+                     id="noVNC_mouse_button2" class="noVNC_status_button">
+-                <input type="image" alt="Right mousebutton" src="images/mouse_right.png"
++                <input type="image" alt="Right mousebutton" src="/novnc/images/mouse_right.png"
+                     id="noVNC_mouse_button4" class="noVNC_status_button">
+-                <input type="image" alt="Keyboard" src="images/keyboard.png"
++                <input type="image" alt="Keyboard" src="/novnc/images/keyboard.png"
+                     id="showKeyboard" class="noVNC_status_button"
+                     value="Keyboard" title="Show Keyboard"/>
+                 <!-- Note that Google Chrome on Android doesn't respect any of these,
+@@ -72,16 +54,18 @@
+                     autocorrect="off" autocomplete="off" spellcheck="false"
+                     mozactionhint="Enter"></textarea>
+                 <div id="noVNC_extra_keys">
+-                    <input type="image" alt="Extra keys" src="images/showextrakeys.png"
++                    <input type="image" alt="Extra keys" src="/novnc/images/showextrakeys.png"
+                         id="showExtraKeysButton" class="noVNC_status_button">
+-                    <input type="image" alt="Ctrl" src="images/ctrl.png"
++                    <input type="image" alt="Ctrl" src="/novnc/images/ctrl.png"
+                         id="toggleCtrlButton" class="noVNC_status_button">
+-                    <input type="image" alt="Alt" src="images/alt.png"
++                    <input type="image" alt="Alt" src="/novnc/images/alt.png"
+                         id="toggleAltButton" class="noVNC_status_button">
+-                    <input type="image" alt="Tab" src="images/tab.png"
++                    <input type="image" alt="Tab" src="/novnc/images/tab.png"
+                         id="sendTabButton" class="noVNC_status_button">
+-                    <input type="image" alt="Esc" src="images/esc.png"
++                    <input type="image" alt="Esc" src="/novnc/images/esc.png"
+                         id="sendEscButton" class="noVNC_status_button">
++		    <input type="image" alt="Ctrl+Alt+Del" src="/novnc/images/ctrlaltdel.png"
++			id="sendCtrlAltDelButton" class="noVNC_status_button">
+                 </div>
+             </div>
+         </div>
+@@ -90,43 +74,21 @@
+ 
+         <!--noVNC Buttons-->
+         <div class="noVNC-buttons-right">
+-            <input type="image" alt="Ctrl+Alt+Del" src="images/ctrlaltdel.png"
+-                id="sendCtrlAltDelButton" class="noVNC_status_button"
+-                title="Send Ctrl-Alt-Del" />
+-            <input type="image" alt="Shutdown/Reboot" src="images/power.png"
+-                id="xvpButton" class="noVNC_status_button"
+-                title="Shutdown/Reboot..." />
+-            <input type="image" alt="Clipboard" src="images/clipboard.png"
++	    <input type="image" alt="Send keys" src="/novnc/images/showextrakeys.png"
++		id="showSendKeysButton" class="noVNC_status_button"
++		title="Send keys" />
++            <input type="image" alt="Clipboard" src="/novnc/images/clipboard.png"
+                 id="clipboardButton" class="noVNC_status_button"
+                 title="Clipboard" />
+-            <input type="image" alt="Fullscreen" src="images/fullscreen.png"
++            <input type="image" alt="Fullscreen" src="/novnc/images/fullscreen.png"
+                 id="fullscreenButton" class="noVNC_status_button"
+                 title="Fullscreen" />
+-            <input type="image" alt="Settings" src="images/settings.png"
+-                id="settingsButton" class="noVNC_status_button"
+-                title="Settings" />
+-            <input type="image" alt="Connect" src="images/connect.png"
+-                id="connectButton" class="noVNC_status_button"
+-                title="Connect" />
+-            <input type="image" alt="Disconnect" src="images/disconnect.png"
+-                id="disconnectButton" class="noVNC_status_button"
+-                title="Disconnect" />
++	    <input type="image" alt="Commands" src="/novnc/images/power.png"
++		id="pveCommandsButton" class="noVNC_status_button"
++		title="Commands" />
+         </div>
+ 
+-        <!-- Description Panel -->
+-        <!-- Shown by default when hosted at for kanaka.github.com -->
+         <div id="noVNC_description" class="">
+-            noVNC is a browser based VNC client implemented using HTML5 Canvas
+-            and WebSockets. You will either need a VNC server with WebSockets
+-            support (such as <a href="http://libvncserver.sourceforge.net/">libvncserver</a>)
+-            or you will need to use
+-            <a href="https://github.com/kanaka/websockify">websockify</a>
+-            to bridge between your browser and VNC server. See the noVNC
+-            <a href="https://github.com/kanaka/noVNC">README</a>
+-            and <a href="http://kanaka.github.com/noVNC">website</a>
+-            for more information.
+-            <br />
+-            <input id="descriptionButton" type="button" value="Close">
+         </div>
+ 
+         <!-- Popup Status -->
+@@ -142,14 +104,11 @@
+                 value="Clear">
+         </div>
+ 
+-        <!-- XVP Shutdown/Reboot Panel -->
+-        <div id="noVNC_xvp" class="triangle-right top">
+-            <span id="noVNC_xvp_menu">
+-                <input type="button" id="xvpShutdownButton" value="Shutdown" />
+-                <input type="button" id="xvpRebootButton" value="Reboot" />
+-                <input type="button" id="xvpResetButton" value="Reset" />
+-            </span>
+-        </div>
++	<!-- PVE command Panel -->
++	<div id="noVNC_pve_commands" class="triangle-right top">
++	    <span id="noVNC_pve_command_menu">
++	    </span>
++	</div>
+ 
+         <!-- Settings Panel -->
+         <div id="noVNC_settings" class="triangle-right top">
+@@ -191,6 +150,12 @@
+             </span>
+         </div>
+ 
++	<!-- PVE Send Key Panel -->
++	<div id="noVNC_send_keys" class="triangle-right top">
++	    <span id="noVNC_send_keys_panel">
++	    </span>
++	</div>
++
+         <!-- Connection Panel -->
+         <div id="noVNC_controls" class="triangle-right top">
+             <ul>
+@@ -215,8 +180,8 @@
+         </div>
+ 
+     </div>
+-    <script src="include/util.js"></script>
+-    <script src="include/ui.js"></script>
++    <script src="/novnc/include/util.js"></script>
++    <script src="/novnc/include/pveui.js"></script>
+ 
+  </body>
+ </html>
diff --git a/debian/patches/series b/debian/patches/series
index c12bbac..ad0f372 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+customize-html-tpl.diff
 pveui.patch
 fix-base-css.patch
 fix-ie11-resize.patch
-- 
2.1.4





More information about the pve-devel mailing list