Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
app/pve.js | 418 +++++++++++++++++++++++++++++++++++++++++++++++++++++
- app/ui.js | 75 ++++++++--
+ app/ui.js | 66 +++++++--
vnc.html | 10 +-
- 3 files changed, 487 insertions(+), 16 deletions(-)
+ 3 files changed, 480 insertions(+), 14 deletions(-)
create mode 100644 app/pve.js
diff --git a/app/pve.js b/app/pve.js
+ },
+};
diff --git a/app/ui.js b/app/ui.js
-index c70743d..cae2b57 100644
+index cb6a9fd..6b4442f 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -16,6 +16,7 @@ import keysyms from "../core/input/keysymdef.js";
UI.initSettings();
// Translate the DOM
-@@ -94,6 +97,9 @@ const UI = {
+@@ -100,6 +103,9 @@ const UI = {
UI.addConnectionControlHandlers();
UI.addClipboardHandlers();
UI.addSettingsHandlers();
document.getElementById("noVNC_status")
.addEventListener('click', UI.hideStatus);
-@@ -102,19 +108,15 @@ const UI = {
+@@ -108,19 +114,15 @@ const UI = {
UI.openControlbar();
return Promise.resolve(UI.rfb);
},
-@@ -158,11 +160,12 @@ const UI = {
+@@ -164,11 +166,12 @@ const UI = {
/* Populate the controls if defaults are provided in the URL */
UI.initSetting('host', window.location.hostname);
UI.initSetting('port', port);
UI.initSetting('shared', true);
UI.initSetting('view_only', false);
UI.initSetting('show_dot', false);
-@@ -341,6 +344,7 @@ const UI = {
+@@ -347,6 +350,7 @@ const UI = {
UI.addSettingChangeHandler('resize');
UI.addSettingChangeHandler('resize', UI.applyResizeMode);
UI.addSettingChangeHandler('resize', UI.updateViewClip);
UI.addSettingChangeHandler('quality');
UI.addSettingChangeHandler('quality', UI.updateQuality);
UI.addSettingChangeHandler('compression');
-@@ -395,6 +399,9 @@ const UI = {
+@@ -401,6 +405,9 @@ const UI = {
document.documentElement.classList.add("noVNC_connecting");
break;
case 'connected':
document.documentElement.classList.add("noVNC_connected");
break;
case 'disconnecting':
-@@ -402,6 +409,11 @@ const UI = {
+@@ -408,6 +415,11 @@ const UI = {
document.documentElement.classList.add("noVNC_disconnecting");
break;
case 'disconnected':
break;
case 'reconnecting':
transitionElem.textContent = _("Reconnecting...");
-@@ -820,6 +832,7 @@ const UI = {
+@@ -821,6 +833,7 @@ const UI = {
UI.closePowerPanel();
UI.closeClipboardPanel();
UI.closeExtraKeys();
},
/* ------^-------
-@@ -997,6 +1010,12 @@ const UI = {
+@@ -998,6 +1011,12 @@ const UI = {
UI.reconnectPassword = password;
}
if (password === null) {
password = undefined;
}
-@@ -1621,12 +1640,42 @@ const UI = {
+@@ -1622,9 +1641,36 @@ const UI = {
/* ------^-------
* /EXTRA KEYS
* ==============
updateViewOnly() {
if (!UI.rfb) return;
UI.rfb.viewOnly = UI.getSetting('view_only');
-+ if (!UI.PVE) return;
-+
-+ let kvm = UI.PVE.consoletype === 'kvm';
-
- // Hide input related buttons in view only mode
- if (UI.rfb.viewOnly) {
-@@ -1641,8 +1690,10 @@ const UI = {
- .classList.remove('noVNC_hidden');
- document.getElementById('noVNC_toggle_extra_keys_button')
- .classList.remove('noVNC_hidden');
-- document.getElementById('noVNC_clipboard_button')
-- .classList.remove('noVNC_hidden');
-+ if (!kvm) {
-+ document.getElementById('noVNC_clipboard_button')
-+ .classList.remove('noVNC_hidden');
-+ }
- }
- },
-
diff --git a/vnc.html b/vnc.html
-index 32f356f..5ec354a 100644
+index 8d4b497..7ce9ba7 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -171,7 +171,7 @@
+@@ -163,7 +163,7 @@
<li class="noVNC_heading">
<img alt="" src="app/images/settings.svg"> Settings
</li>
<label><input id="noVNC_setting_shared" type="checkbox"> Shared Mode</label>
</li>
<li>
-@@ -181,16 +181,18 @@
+@@ -173,16 +173,18 @@
<li>
<label><input id="noVNC_setting_view_clip" type="checkbox"> Clip to Window</label>
</li>
2 files changed, 21 insertions(+)
diff --git a/app/ui.js b/app/ui.js
-index cae2b57..fdae7a2 100644
+index 6b4442f..11fad2d 100644
--- a/app/ui.js
+++ b/app/ui.js
-@@ -1054,6 +1054,7 @@ const UI = {
+@@ -1055,6 +1055,7 @@ const UI = {
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
UI.rfb.addEventListener("bell", UI.bell);
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
UI.rfb.clipViewport = UI.getSetting('view_clip');
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
-@@ -1665,6 +1666,16 @@ const UI = {
+@@ -1666,6 +1667,16 @@ const UI = {
document.getElementById('pve_commands_button').classList.remove("noVNC_selected");
},
* /PVE
* ==============
diff --git a/core/rfb.js b/core/rfb.js
-index f35d503..7ea2004 100644
+index ea3bf58..90ca28b 100644
--- a/core/rfb.js
+++ b/core/rfb.js
-@@ -2492,6 +2492,16 @@ export default class RFB extends EventTargetMixin {
+@@ -2499,6 +2499,16 @@ export default class RFB extends EventTargetMixin {
this._updateClip();
this._updateScale();
1 file changed, 11 insertions(+)
diff --git a/app/ui.js b/app/ui.js
-index fdae7a2..7237d00 100644
+index 11fad2d..b40d1f8 100644
--- a/app/ui.js
+++ b/app/ui.js
-@@ -1239,6 +1239,13 @@ const UI = {
+@@ -1240,6 +1240,13 @@ const UI = {
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
} else {
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
-@@ -1249,7 +1256,11 @@ const UI = {
+@@ -1250,7 +1257,11 @@ const UI = {
} else if (document.body.msRequestFullscreen) {
document.body.msRequestFullscreen();
}
+ background: #5BA8DF;
+}
diff --git a/vnc.html b/vnc.html
-index 5ec354a..a49e3a2 100644
+index 7ce9ba7..61d0fdd 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -52,7 +52,8 @@
+@@ -48,7 +48,8 @@
<link rel="apple-touch-icon" sizes="152x152" type="image/png" href="app/images/icons/novnc-152x152.png">
<!-- Stylesheets -->
+ <link rel="stylesheet" href="app/styles/base.css" />
+ <link rel="stylesheet" href="/novnc/app/styles/pve.css" />
- <!-- this is included as a normal file in order to catch script-loading errors as well -->
- <script src="app/error-handler.js"></script>
+ <!-- Images that will later appear via CSS -->
+ <link rel="preload" as="image" href="app/images/info.svg">
1 file changed, 3 insertions(+), 29 deletions(-)
diff --git a/vnc.html b/vnc.html
-index a49e3a2..12db665 100644
+index 61d0fdd..216b33f 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -21,36 +21,10 @@
- Remove this if you use the .htaccess -->
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+@@ -17,36 +17,10 @@
+
+ <meta charset="utf-8">
- <!-- Icons (see app/images/icons/Makefile for what the sizes are for) -->
- <link rel="icon" sizes="16x16" type="image/png" href="app/images/icons/novnc-16x16.png">
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
app/ui.js | 4 ++--
- vnc.html | 50 +++++++++++++++++++++++++-------------------------
- 2 files changed, 27 insertions(+), 27 deletions(-)
+ vnc.html | 52 ++++++++++++++++++++++++++--------------------------
+ 2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/app/ui.js b/app/ui.js
-index 7237d00..17e86a7 100644
+index b40d1f8..f7b7dc4 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -64,7 +64,7 @@ const UI = {
// Translate the DOM
l10n.translateDOM();
-- WebUtil.fetchJSON('./package.json')
-+ WebUtil.fetchJSON('/novnc/package.json')
- .then((packageInfo) => {
- Array.from(document.getElementsByClassName('noVNC_version')).forEach(el => el.innerText = packageInfo.version);
- })
-@@ -1772,7 +1772,7 @@ l10n.setup(LINGUAS);
+- fetch('./package.json')
++ fetch('/novnc/package.json')
+ .then((response) => {
+ if (!response.ok) {
+ throw Error("" + response.status + " " + response.statusText);
+@@ -1768,7 +1768,7 @@ l10n.setup(LINGUAS);
if (l10n.language === "en" || l10n.dictionary !== undefined) {
UI.prime();
} else {
-- WebUtil.fetchJSON('app/locale/' + l10n.language + '.json')
-+ WebUtil.fetchJSON('/novnc/app/locale/' + l10n.language + '.json')
- .then((translations) => { l10n.dictionary = translations; })
- .catch(err => Log.Error("Failed to load translations: " + err))
- .then(UI.prime);
+- fetch('app/locale/' + l10n.language + '.json')
++ fetch('/novnc/app/locale/' + l10n.language + '.json')
+ .then((response) => {
+ if (!response.ok) {
+ throw Error("" + response.status + " " + response.statusText);
diff --git a/vnc.html b/vnc.html
-index 12db665..396ded8 100644
+index 216b33f..8ca4ea4 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -26,19 +26,19 @@
+@@ -22,16 +22,16 @@
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<!-- Stylesheets -->
+ <link rel="stylesheet" href="/novnc/app/styles/base.css" />
<link rel="stylesheet" href="/novnc/app/styles/pve.css" />
- <!-- this is included as a normal file in order to catch script-loading errors as well -->
-- <script src="app/error-handler.js"></script>
-+ <script src="/novnc/app/error-handler.js"></script>
+ <!-- Images that will later appear via CSS -->
+- <link rel="preload" as="image" href="app/images/info.svg">
+- <link rel="preload" as="image" href="app/images/error.svg">
+- <link rel="preload" as="image" href="app/images/warning.svg">
++ <link rel="preload" as="image" href="/novnc/app/images/info.svg">
++ <link rel="preload" as="image" href="/novnc/app/images/error.svg">
++ <link rel="preload" as="image" href="/novnc/app/images/warning.svg">
- <!-- begin scripts -->
- <!-- promise polyfills promises for IE11 -->
-- <script src="vendor/promise.js"></script>
-+ <script src="/novnc/vendor/promise.js"></script>
- <!-- ES2015/ES6 modules polyfill -->
-- <script nomodule src="vendor/browser-es-module-loader/dist/browser-es-module-loader.js"></script>
-+ <script nomodule src="/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js"></script>
- <!-- actual script modules -->
+- <script src="app/error-handler.js"></script>
- <script type="module" crossorigin="anonymous" src="app/ui.js"></script>
++ <script src="/novnc/app/error-handler.js"></script>
+ <script type="module" crossorigin="anonymous" src="/novnc/app/ui.js"></script>
- <!-- end scripts -->
</head>
-@@ -63,51 +63,51 @@
+ <body>
+@@ -55,51 +55,51 @@
<h1 class="noVNC_logo" translate="no"><span>no</span><br>VNC</h1>
<!-- Drag/Pan the viewport -->
</div>
<input type="button" id="noVNC_shutdown_button" value="Shutdown">
<input type="button" id="noVNC_reboot_button" value="Reboot">
-@@ -116,13 +116,13 @@
+@@ -108,13 +108,13 @@
</div>
<!-- Clipboard -->
</div>
<textarea id="noVNC_clipboard_text" rows=5></textarea>
<br>
-@@ -132,19 +132,19 @@
+@@ -124,19 +124,19 @@
</div>
<!-- Toggle fullscreen -->
</li>
<li style="display:none;">
<label><input id="noVNC_setting_shared" type="checkbox"> Shared Mode</label>
-@@ -235,7 +235,7 @@
+@@ -227,7 +227,7 @@
</div>
<!-- Connection Controls -->
id="noVNC_disconnect_button" class="noVNC_button"
title="Disconnect">
-@@ -254,7 +254,7 @@
+@@ -246,7 +246,7 @@
<div id="noVNC_connect_dlg">
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
<div id="noVNC_connect_button"><div>
</div></div>
</div>
</div>
-@@ -298,8 +298,8 @@
+@@ -290,8 +290,8 @@
</div>
<audio id="noVNC_bell">
1 file changed, 21 insertions(+)
diff --git a/vnc.html b/vnc.html
-index 396ded8..a0802e0 100644
+index 8ca4ea4..01f71e1 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -234,6 +234,27 @@
+@@ -226,6 +226,27 @@
</div>
</div>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
- vnc.html | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
+ vnc.html | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/vnc.html b/vnc.html
-index a0802e0..5f09cd2 100644
+index 01f71e1..dc4cc23 100644
--- a/vnc.html
+++ b/vnc.html
@@ -13,7 +13,7 @@
+ <title>[% nodename %] - Proxmox Console</title>
<meta charset="utf-8">
-
-@@ -30,7 +30,13 @@
- <link rel="stylesheet" href="/novnc/app/styles/pve.css" />
- <!-- this is included as a normal file in order to catch script-loading errors as well -->
-- <script src="/novnc/app/error-handler.js"></script>
-+ <script type="text/javascript" src="/novnc/app/error-handler.js"></script>
+@@ -31,6 +31,12 @@
+ <link rel="preload" as="image" href="/novnc/app/images/warning.svg">
+
+ <script src="/novnc/app/error-handler.js"></script>
+ <script type="text/javascript">
+ if (typeof(PVE) === 'undefined') PVE = {};
+ PVE.UserName = '[% username %]';
+ PVE.CSRFPreventionToken = '[% token %]';
+ INCLUDE_URI='/novnc/include';
+ </script>
+ <script type="module" crossorigin="anonymous" src="/novnc/app/ui.js"></script>
+ </head>
- <!-- begin scripts -->
- <!-- promise polyfills promises for IE11 -->
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
- vnc.html | 7 +------
- 1 file changed, 1 insertion(+), 6 deletions(-)
+ vnc.html | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vnc.html b/vnc.html
-index 5f09cd2..9f594e2 100644
+index dc4cc23..21b3844 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -39,12 +39,7 @@
+@@ -37,7 +37,7 @@
+ PVE.CSRFPreventionToken = '[% token %]';
+ INCLUDE_URI='/novnc/include';
</script>
-
- <!-- begin scripts -->
-- <!-- promise polyfills promises for IE11 -->
-- <script src="/novnc/vendor/promise.js"></script>
-- <!-- ES2015/ES6 modules polyfill -->
-- <script nomodule src="/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js"></script>
-- <!-- actual script modules -->
- <script type="module" crossorigin="anonymous" src="/novnc/app/ui.js"></script>
+ <script crossorigin=anonymous" src="/novnc/app.js"></script>
- <!-- end scripts -->
</head>
+ <body>
4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/app/ui.js b/app/ui.js
-index 17e86a7..ded4bf6 100644
+index f7b7dc4..37a0279 100644
--- a/app/ui.js
+++ b/app/ui.js
-@@ -166,6 +166,7 @@ const UI = {
+@@ -172,6 +172,7 @@ const UI = {
UI.initSetting('quality', 6);
UI.initSetting('compression', 2);
UI.initSetting('autoresize', true);
UI.initSetting('shared', true);
UI.initSetting('view_only', false);
UI.initSetting('show_dot', false);
-@@ -356,6 +357,8 @@ const UI = {
+@@ -362,6 +363,8 @@ const UI = {
UI.addSettingChangeHandler('view_only', UI.updateViewOnly);
UI.addSettingChangeHandler('show_dot');
UI.addSettingChangeHandler('show_dot', UI.updateShowDotCursor);
UI.addSettingChangeHandler('host');
UI.addSettingChangeHandler('port');
UI.addSettingChangeHandler('path');
-@@ -1056,6 +1059,7 @@ const UI = {
+@@ -1057,6 +1060,7 @@ const UI = {
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
UI.rfb.addEventListener("fbresize", UI.updateSessionSize);
UI.rfb.clipViewport = UI.getSetting('view_clip');
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
UI.rfb.qualityLevel = parseInt(UI.getSetting('quality'));
-@@ -1692,6 +1696,12 @@ const UI = {
+@@ -1693,6 +1697,12 @@ const UI = {
* ==============
* MISC
* ------v------*/
if (!UI.rfb) return;
UI.rfb.viewOnly = UI.getSetting('view_only');
diff --git a/core/rfb.js b/core/rfb.js
-index 7ea2004..85c7836 100644
+index 90ca28b..ec75610 100644
--- a/core/rfb.js
+++ b/core/rfb.js
-@@ -296,6 +296,7 @@ export default class RFB extends EventTargetMixin {
+@@ -256,6 +256,7 @@ export default class RFB extends EventTargetMixin {
this._clipViewport = false;
this._scaleViewport = false;
this._resizeSession = false;
this._showDotCursor = false;
if (options.showDotCursor !== undefined) {
-@@ -356,6 +357,15 @@ export default class RFB extends EventTargetMixin {
+@@ -316,6 +317,15 @@ export default class RFB extends EventTargetMixin {
}
}
set showDotCursor(show) {
this._showDotCursor = show;
diff --git a/core/util/cursor.js b/core/util/cursor.js
-index 4db1dab..e5b1768 100644
+index 12bcced..ce7340e 100644
--- a/core/util/cursor.js
+++ b/core/util/cursor.js
@@ -12,6 +12,8 @@ export default class Cursor {
this._canvas = document.createElement('canvas');
if (useFallback) {
-@@ -110,7 +112,7 @@ export default class Cursor {
+@@ -100,7 +102,7 @@ export default class Cursor {
}
clear() {
this._canvas.width = 0;
this._canvas.height = 0;
this._position.x = this._position.x + this._hotSpot.x;
-@@ -140,6 +142,11 @@ export default class Cursor {
+@@ -130,6 +132,11 @@ export default class Cursor {
this._updateVisibility(target);
}
_handleMouseOver(event) {
// This event could be because we're entering the target, or
// moving around amongst its sub elements. Let the move handler
-@@ -192,6 +199,11 @@ export default class Cursor {
+@@ -182,6 +189,11 @@ export default class Cursor {
}
}
_showCursor() {
if (this._canvas.style.visibility === 'hidden') {
this._canvas.style.visibility = '';
-@@ -250,4 +262,5 @@ export default class Cursor {
+@@ -240,4 +252,5 @@ export default class Cursor {
return document.captureElement &&
document.documentElement.contains(document.captureElement);
}
+
}
diff --git a/vnc.html b/vnc.html
-index 9f594e2..bf1fde5 100644
+index 21b3844..3e63087 100644
--- a/vnc.html
+++ b/vnc.html
-@@ -157,6 +157,9 @@
+@@ -154,6 +154,9 @@
<li>
<label><input id="noVNC_setting_view_clip" type="checkbox"> Clip to Window</label>
</li>
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/rfb.js b/core/rfb.js
-index 85c7836..f049246 100644
+index ec75610..96617b9 100644
--- a/core/rfb.js
+++ b/core/rfb.js
-@@ -87,7 +87,8 @@ export default class RFB extends EventTargetMixin {
+@@ -91,7 +91,8 @@ export default class RFB extends EventTargetMixin {
this._rfbCredentials = options.credentials || {};
this._shared = 'shared' in options ? !!options.shared : true;
this._repeaterID = options.repeaterID || '';
// Internal state
this._rfbConnectionState = '';
diff --git a/docs/API.md b/docs/API.md
-index d78360a..d55a234 100644
+index aa5aea7..623d685 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -195,8 +195,7 @@ connection to a specified VNC server.
title = 'System upgrade on node ' + this.nodename;
break;
case 'cmd':
-
-Subproject commit 9142f8f0f7b4a53447f5cfec3a797cbf0d6204a9
+Subproject commit 463c39e4af98ec4106b87bbea17e1605aa4c6180