diff --git a/debian/patches/0001-add-pve-specific-js-code.patch b/debian/patches/0001-add-pve-specific-js-code.patch index f4f5067..bae6bf6 100644 --- a/debian/patches/0001-add-pve-specific-js-code.patch +++ b/debian/patches/0001-add-pve-specific-js-code.patch @@ -1,7 +1,7 @@ -From ad6975daaeee0798955f1d8b36d567975f4cbae5 Mon Sep 17 00:00:00 2001 +From e9e4fe2eab135507fd6574b2f12ddc5c9d0a532b Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 13 Dec 2016 16:11:35 +0100 -Subject: [PATCH 1/9] add pve specific js code +Subject: [PATCH 01/10] add pve specific js code this adds a es6 module 'PVEUI' which we use for defining the pve related methods (API2Request, etc.) @@ -11,17 +11,17 @@ autoresizing, commandstoggle, etc. Signed-off-by: Dominik Csapak --- - app/pve.js | 417 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - app/ui.js | 95 ++++++++++---- - 2 files changed, 488 insertions(+), 24 deletions(-) + app/pve.js | 414 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + app/ui.js | 75 ++++++++--- + 2 files changed, 475 insertions(+), 14 deletions(-) create mode 100644 app/pve.js diff --git a/app/pve.js b/app/pve.js new file mode 100644 -index 0000000..668835a +index 0000000..37858f5 --- /dev/null +++ b/app/pve.js -@@ -0,0 +1,417 @@ +@@ -0,0 +1,414 @@ +/* + * PVE Utility functions for noVNC + * Copyright (C) 2017 Proxmox GmbH @@ -76,6 +76,13 @@ index 0000000..668835a + break; + } + ++ if (this.resize == 'scale' && ++ (this.consoletype === 'lxc' || this.consoletype === 'shell')) { ++ var size = this.getFBSize(); ++ params.width = size.width; ++ params.height = size.height; ++ } ++ + this.baseUrl = baseUrl; + this.url = url; + this.params = params; @@ -341,10 +348,6 @@ index 0000000..668835a + el.classList.add('noVNC_hidden'); + } + }); -+ -+ //edge/ie11 quirk -+ var canvas = document.getElementById('noVNC_canvas'); -+ canvas.onclick = canvas.focus; + }, + + getFBSize: function() { @@ -393,7 +396,6 @@ index 0000000..668835a + + updateFBSize: function(rfb, width, height, clip) { + var me = this; -+ console.log(arguments); + try { + // Note: window size must be even number for firefox + me.lastFBWidth = Math.floor((width + 1)/2)*2; @@ -420,11 +422,6 @@ index 0000000..668835a + //console.log("try resize by " + offsetw + " " + offseth); + try { + window.resizeBy(offsetw, offseth); -+ // wait a little an then fix the scrollbars -+ // on chrome -+ setTimeout(function() { -+ me.UI.fixScrollbars(); -+ }, 100); + } catch (e) { + console.log('resizing did not work', e); + } @@ -440,135 +437,126 @@ index 0000000..668835a + }, +}; diff --git a/app/ui.js b/app/ui.js -index 73ad2b4..def0eda 100644 +index 2218d24..143cb60 100644 --- a/app/ui.js +++ b/app/ui.js -@@ -20,6 +20,7 @@ import keysyms from "../core/input/keysymdef.js"; +@@ -18,6 +18,7 @@ import Keyboard from "../core/input/keyboard.js"; import RFB from "../core/rfb.js"; import Display from "../core/display.js"; import * as WebUtil from "./webutil.js"; +import PVEUI from "./pve.js"; - const UI = { + var UI = { -@@ -63,6 +64,7 @@ const UI = { +@@ -59,6 +60,7 @@ var UI = { // Render default UI and initialize settings menu start: function(callback) { -+ UI.PVE = new PVEUI(UI); ++ UI.PVE = new PVEUI(UI); // Setup global variables first UI.isSafari = (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1); -@@ -95,6 +97,9 @@ const UI = { +@@ -90,6 +92,9 @@ var UI = { UI.addConnectionControlHandlers(); UI.addClipboardHandlers(); UI.addSettingsHandlers(); + -+ // add pve specific event handlers -+ UI.PVE.addPVEHandlers(); ++ // add pve specific event handlers ++ UI.PVE.addPVEHandlers(); document.getElementById("noVNC_status") .addEventListener('click', UI.hideStatus); -@@ -103,11 +108,6 @@ const UI = { +@@ -98,23 +103,19 @@ var UI = { UI.openControlbar(); -- // Show the connect panel on first load unless autoconnecting -- if (!autoconnect) { -- UI.openConnectPanel(); -- } -- - UI.updateViewClip(); ++ UI.updateViewClip(); ++ + UI.updateVisualState('init'); - UI.updateVisualState(); -@@ -115,17 +115,13 @@ const UI = { - document.getElementById('noVNC_setting_host').focus(); document.documentElement.classList.remove("noVNC_loading"); - var autoconnect = WebUtil.getConfigVar('autoconnect', false); - if (autoconnect === 'true' || autoconnect == '1') { - autoconnect = true; -- UI.connect(); ++ UI.PVE.pveStart(function() { + UI.connect(); - } else { - autoconnect = false; +- // Show the connect panel on first load unless autoconnecting +- UI.openConnectPanel(); - } -+ UI.PVE.pveStart(function() { -+ UI.connect(); - if (typeof callback === "function") { - callback(UI.rfb); - } -+ if (typeof callback === "function") { -+ callback(UI.rfb); -+ } -+ }); ++ if (typeof callback === "function") { ++ callback(UI.rfb); ++ } ++ }); }, initFullscreen: function() { -@@ -170,10 +166,14 @@ const UI = { +@@ -159,9 +160,13 @@ var UI = { /* Populate the controls if defaults are provided in the URL */ UI.initSetting('host', window.location.hostname); UI.initSetting('port', port); - UI.initSetting('encrypt', (window.location.protocol === "https:")); + UI.initSetting('encrypt', true); - UI.initSetting('cursor', !isTouchDevice); - UI.initSetting('clip', false); + UI.initSetting('view_clip', false); - UI.initSetting('resize', 'off'); -+ // we need updateSetting because -+ // otherwise we load from browser storage -+ // we want to overwrite the resize mode from url -+ var resize = WebUtil.getQueryVar('resize'); -+ UI.updateSetting('resize', resize); ++ // we need updateSetting because ++ // otherwise we load from browser storage ++ // we want to overwrite the resize mode from url ++ var resize = WebUtil.getQueryVar('resize'); ++ UI.updateSetting('resize', resize); UI.initSetting('shared', true); UI.initSetting('view_only', false); UI.initSetting('path', 'websockify'); -@@ -434,6 +434,7 @@ const UI = { +@@ -393,6 +398,9 @@ var UI = { + document.documentElement.classList.add("noVNC_connecting"); + break; case 'connected': - UI.connected = true; - UI.inhibit_reconnect = false; -+ UI.pveAllowMigratedTest = true; ++ UI.connected = true; ++ UI.inhibit_reconnect = false; ++ UI.pveAllowMigratedTest = true; document.documentElement.classList.add("noVNC_connected"); - if (rfb && rfb.get_encrypt()) { - msg = _("Connected (encrypted) to ") + UI.desktopName; -@@ -449,6 +450,10 @@ const UI = { + break; + case 'disconnecting': +@@ -400,6 +408,11 @@ var UI = { + document.documentElement.classList.add("noVNC_disconnecting"); break; case 'disconnected': - UI.showStatus(_("Disconnected")); -+ if (UI.pveAllowMigratedTest === true) { -+ UI.pveAllowMigratedTest = false; -+ UI.PVE.pve_detect_migrated_vm(); -+ } ++ UI.showStatus(_("Disconnected")); ++ if (UI.pveAllowMigratedTest === true) { ++ UI.pveAllowMigratedTest = false; ++ UI.PVE.pve_detect_migrated_vm(); ++ } break; - default: - msg = "Invalid UI state"; -@@ -861,6 +866,7 @@ const UI = { - UI.closeXvpPanel(); + case 'reconnecting': + transition_elem.textContent = _("Reconnecting..."); +@@ -813,6 +826,7 @@ var UI = { + UI.closePowerPanel(); UI.closeClipboardPanel(); UI.closeExtraKeys(); -+ UI.closePVECommandPanel(); ++ UI.closePVECommandPanel(); }, /* ------^------- -@@ -1033,9 +1039,15 @@ const UI = { - password = WebUtil.getConfigVar('password'); +@@ -988,6 +1002,12 @@ var UI = { + UI.reconnect_password = password; } -- if (password === null) { -- password = undefined; -- } -+ var password = document.getElementById('noVNC_password_input').value; ++ var password = document.getElementById('noVNC_password_input').value; + -+ if (!password) { -+ password = WebUtil.getConfigVar('password'); -+ } ++ if (!password) { ++ password = WebUtil.getConfigVar('password'); ++ } + -+ if (password === null) { -+ password = undefined; -+ } - - if ((!host) || (!port)) { - var msg = _("Must set host and port"); -@@ -1608,9 +1620,36 @@ const UI = { + if (password === null) { + password = undefined; + } +@@ -1567,9 +1587,36 @@ var UI = { /* ------^------- * /EXTRA KEYS * ============== @@ -577,63 +565,35 @@ index 73ad2b4..def0eda 100644 * ------v------*/ + togglePVECommandPanel: function() { -+ if (document.getElementById('pve_commands').classList.contains("noVNC_open")) { -+ UI.closePVECommandPanel(); -+ } else { -+ UI.openPVECommandPanel(); -+ } ++ if (document.getElementById('pve_commands').classList.contains("noVNC_open")) { ++ UI.closePVECommandPanel(); ++ } else { ++ UI.openPVECommandPanel(); ++ } + }, + + openPVECommandPanel: function() { -+ var me = this; -+ UI.closeAllPanels(); -+ UI.openControlbar(); ++ var me = this; ++ UI.closeAllPanels(); ++ UI.openControlbar(); + -+ document.getElementById('pve_commands').classList.add("noVNC_open"); -+ document.getElementById('pve_commands_button').classList.add("noVNC_selected"); ++ document.getElementById('pve_commands').classList.add("noVNC_open"); ++ document.getElementById('pve_commands_button').classList.add("noVNC_selected"); + }, + + closePVECommandPanel: function() { -+ document.getElementById('pve_commands').classList.remove("noVNC_open"); -+ document.getElementById('pve_commands_button').classList.remove("noVNC_selected"); ++ document.getElementById('pve_commands').classList.remove("noVNC_open"); ++ document.getElementById('pve_commands_button').classList.remove("noVNC_selected"); + }, + +/* ------^------- -+ * /PVE ++ * /PVE + * ============== + * MISC + * ------v------*/ setMouseButton: function(num) { - var view_only = UI.rfb.get_view_only(); + var view_only = UI.rfb.viewOnly; if (UI.rfb && !view_only) { -@@ -1658,8 +1697,16 @@ const UI = { - }, - - updateSessionSize: function(rfb, width, height) { -- UI.updateViewClip(); -- UI.fixScrollbars(); -+ var resize = UI.getSetting('resize'); -+ -+ if (resize == 'null') { -+ var clip = UI.getSetting('clip'); -+ UI.PVE.updateFBSize(rfb, width, height, clip); -+ } -+ -+ UI.applyResizeMode(); -+ UI.updateViewClip(); -+ UI.updateViewDrag(); - }, - - fixScrollbars: function() { -@@ -1704,7 +1751,7 @@ const UI = { - }, - - /* ------^------- -- * /MISC -+ * /MISC - * ============== - */ - }; -- 2.11.0 diff --git a/debian/patches/0002-add-custom-fbresize-event-on-rfb.patch b/debian/patches/0002-add-custom-fbresize-event-on-rfb.patch new file mode 100644 index 0000000..86ef08e --- /dev/null +++ b/debian/patches/0002-add-custom-fbresize-event-on-rfb.patch @@ -0,0 +1,72 @@ +From 5a456e52e6a1c9cb283187505bc09289a9fb3334 Mon Sep 17 00:00:00 2001 +From: Dominik Csapak +Date: Wed, 9 May 2018 10:47:53 +0200 +Subject: [PATCH 02/10] add custom fbresize event on rfb + +this can be use to react to changes of the resolution, like resizing the +window + +Signed-off-by: Dominik Csapak +--- + app/ui.js | 16 ++++++++++++++++ + core/rfb.js | 10 ++++++++++ + 2 files changed, 26 insertions(+) + +diff --git a/app/ui.js b/app/ui.js +index 143cb60..b01fd5d 100644 +--- a/app/ui.js ++++ b/app/ui.js +@@ -1047,6 +1047,7 @@ var UI = { + UI.rfb.addEventListener("clipboard", UI.clipboardReceive); + UI.rfb.addEventListener("bell", UI.bell); + 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'; +@@ -1612,6 +1613,21 @@ var UI = { + document.getElementById('pve_commands_button').classList.remove("noVNC_selected"); + }, + ++ updateSessionSize: function(e) { ++ var rfb = e.detail.rfb; ++ var width = e.detail.width; ++ var height = e.detail.height; ++ var resize = UI.getSetting('resize'); ++ ++ if (resize == 'null') { ++ var clip = UI.getSetting('view_clip'); ++ UI.PVE.updateFBSize(rfb, width, height, clip); ++ } ++ ++ UI.applyResizeMode(); ++ UI.updateViewClip(); ++ }, ++ + /* ------^------- + * /PVE + * ============== +diff --git a/core/rfb.js b/core/rfb.js +index 7c4e0c9..6a1ff85 100644 +--- a/core/rfb.js ++++ b/core/rfb.js +@@ -1588,6 +1588,16 @@ RFB.prototype = { + this._updateClip(); + this._updateScale(); + ++ // fbresize event ++ var event = new CustomEvent("fbresize", { ++ detail: { ++ rfb: this, ++ width: width, ++ height: height } ++ } ++ ); ++ this.dispatchEvent(event); ++ + this._timing.fbu_rt_start = (new Date()).getTime(); + this._updateContinuousUpdates(); + }, +-- +2.11.0 + diff --git a/debian/patches/0002-change-scaling-when-toggling-fullscreen.patch b/debian/patches/0003-change-scaling-when-toggling-fullscreen.patch similarity index 55% rename from debian/patches/0002-change-scaling-when-toggling-fullscreen.patch rename to debian/patches/0003-change-scaling-when-toggling-fullscreen.patch index 5bf888b..dec2248 100644 --- a/debian/patches/0002-change-scaling-when-toggling-fullscreen.patch +++ b/debian/patches/0003-change-scaling-when-toggling-fullscreen.patch @@ -1,45 +1,44 @@ -From c1073cb0f19ebd64f6ee4b221b5aa06a2f8e5c99 Mon Sep 17 00:00:00 2001 +From 6abc6b0b278717584ff2452cbe8d1f448398a406 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 11 May 2017 10:34:10 +0200 -Subject: [PATCH 2/9] change scaling when toggling fullscreen +Subject: [PATCH 03/10] change scaling when toggling fullscreen when activating fullscreen, we change the scaling to 'scale', and changing it back when leaving fullscreen Signed-off-by: Dominik Csapak --- - app/ui.js | 11 +++++++++++ - 1 file changed, 11 insertions(+) + app/ui.js | 9 +++++++++ + 1 file changed, 9 insertions(+) diff --git a/app/ui.js b/app/ui.js -index def0eda..d4b0291 100644 +index b01fd5d..d35be49 100644 --- a/app/ui.js +++ b/app/ui.js -@@ -1174,6 +1174,15 @@ const UI = { +@@ -1210,6 +1210,12 @@ var UI = { } else if (document.msExitFullscreen) { document.msExitFullscreen(); } + -+ // when changing from fullscreen to window, -+ // re enable auto resize -+ if (WebUtil.getQueryVar('resize') === null) { -+ UI.updateSetting('resize', null); -+ setTimeout(function() { -+ UI.fixScrollbars(); -+ }, 100); -+ } ++ // when changing from fullscreen to window, ++ // re enable auto resize ++ if (WebUtil.getQueryVar('resize') === null) { ++ UI.updateSetting('resize', null); ++ } } else { if (document.documentElement.requestFullscreen) { document.documentElement.requestFullscreen(); -@@ -1184,6 +1193,8 @@ const UI = { +@@ -1220,7 +1226,10 @@ var UI = { } else if (document.body.msRequestFullscreen) { document.body.msRequestFullscreen(); } -+ // we want scaling in fullscreen mode -+ UI.updateSetting('resize', 'scale'); ++ // we want scaling in fullscreen mode ++ UI.updateSetting('resize', 'scale'); } ++ UI.applyResizeMode(); UI.enableDisableViewClip(); UI.updateFullscreenButton(); + }, -- 2.11.0 diff --git a/debian/patches/0003-add-pve-style.patch b/debian/patches/0004-add-pve-style.patch similarity index 77% rename from debian/patches/0003-add-pve-style.patch rename to debian/patches/0004-add-pve-style.patch index 394f8dd..a5f2050 100644 --- a/debian/patches/0003-add-pve-style.patch +++ b/debian/patches/0004-add-pve-style.patch @@ -1,7 +1,7 @@ -From 1cdfeafd561bfe4d9acb7ef8a838d82c64f9c1e5 Mon Sep 17 00:00:00 2001 +From 5d8fb2485e4863d561481ea7d51e36f8e0be1d2b Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 13 Dec 2016 16:03:41 +0100 -Subject: [PATCH 3/9] add pve style +Subject: [PATCH 04/10] add pve style this adds the custom pve style (based on black.css) @@ -10,17 +10,17 @@ and fix the z-index of the connect overlay Signed-off-by: Dominik Csapak --- - app/styles/pve.css | 37 +++++++++++++++++++++++++++++++++++++ + app/styles/pve.css | 42 ++++++++++++++++++++++++++++++++++++++++++ vnc.html | 1 + - 2 files changed, 38 insertions(+) + 2 files changed, 43 insertions(+) create mode 100644 app/styles/pve.css diff --git a/app/styles/pve.css b/app/styles/pve.css new file mode 100644 -index 0000000..35002fe +index 0000000..eaeb5cb --- /dev/null +++ b/app/styles/pve.css -@@ -0,0 +1,37 @@ +@@ -0,0 +1,42 @@ +/* + * noVNC black CSS + * Copyright (C) 2012 Joel Martin @@ -58,11 +58,16 @@ index 0000000..35002fe +#noVNC_connect_button { + display: none; +} ++ ++:root:not(.noVNC_touch) .noVNC_button.noVNC_selected:hover { ++ border-color: rgba(0, 0, 0, 0.4); ++ background: #5BA8DF; ++} diff --git a/vnc.html b/vnc.html -index 6cb4be4..98a9952 100644 +index 701714c..63d7181 100644 --- a/vnc.html +++ b/vnc.html -@@ -53,6 +53,7 @@ +@@ -55,6 +55,7 @@ diff --git a/debian/patches/0004-remove-vnc-logos.patch b/debian/patches/0005-remove-vnc-logos.patch similarity index 90% rename from debian/patches/0004-remove-vnc-logos.patch rename to debian/patches/0005-remove-vnc-logos.patch index 2577119..9a0cc43 100644 --- a/debian/patches/0004-remove-vnc-logos.patch +++ b/debian/patches/0005-remove-vnc-logos.patch @@ -1,20 +1,20 @@ -From a28b283a224990e1b46f304d9a2067afa7633d63 Mon Sep 17 00:00:00 2001 +From 761e67e803bfcf196cc2229ec451adaee0beb61a Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 20 Jan 2017 10:35:05 +0100 -Subject: [PATCH 4/9] remove vnc logos +Subject: [PATCH 05/10] remove vnc logos to show the pve icon instead Signed-off-by: Dominik Csapak --- - vnc.html | 24 ------------------------ - 1 file changed, 24 deletions(-) + vnc.html | 26 -------------------------- + 1 file changed, 26 deletions(-) diff --git a/vnc.html b/vnc.html -index 98a9952..cd8e594 100644 +index 63d7181..60727e4 100644 --- a/vnc.html +++ b/vnc.html -@@ -23,34 +23,10 @@ +@@ -23,36 +23,10 @@ Remove this if you use the .htaccess --> @@ -32,7 +32,9 @@ index 98a9952..cd8e594 100644 - - - +- - - - diff --git a/debian/patches/0005-change-src-directory-for-images-js-files.patch b/debian/patches/0006-change-src-directory-for-images-js-files.patch similarity index 92% rename from debian/patches/0005-change-src-directory-for-images-js-files.patch rename to debian/patches/0006-change-src-directory-for-images-js-files.patch index 43847c8..60f6ab6 100644 --- a/debian/patches/0005-change-src-directory-for-images-js-files.patch +++ b/debian/patches/0006-change-src-directory-for-images-js-files.patch @@ -1,7 +1,7 @@ -From 0b7322fc05361366fc4e24e6d5b9d8e2254ace40 Mon Sep 17 00:00:00 2001 +From 87486c038db7ddb212f995c70edf13dc1e8783cd Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 17 Jan 2017 17:24:03 +0100 -Subject: [PATCH 5/9] change src directory for images/js files +Subject: [PATCH 06/10] change src directory for images/js files since they will be in /novnc/ also change the directory in the build script @@ -14,11 +14,11 @@ Signed-off-by: Dominik Csapak 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/app/ui.js b/app/ui.js -index d4b0291..d32c789 100644 +index d35be49..d64389d 100644 --- a/app/ui.js +++ b/app/ui.js -@@ -1771,7 +1771,7 @@ const UI = { - var LINGUAS = ["de", "el", "nl", "sv"]; +@@ -1725,7 +1725,7 @@ var UI = { + var LINGUAS = ["de", "el", "es", "nl", "pl", "sv", "tr", "zh"]; l10n.setup(LINGUAS); if (l10n.language !== "en" && l10n.dictionary === undefined) { - WebUtil.fetchJSON('app/locale/' + l10n.language + '.json', function (translations) { @@ -40,7 +40,7 @@ index 990fb4d..0f44e1c 100644 noCopyOverride: () => {}, }, diff --git a/vnc.html b/vnc.html -index cd8e594..23fc0e4 100644 +index 60727e4..fa66d6f 100644 --- a/vnc.html +++ b/vnc.html @@ -28,7 +28,7 @@ @@ -76,8 +76,8 @@ index cd8e594..23fc0e4 100644 }); -- -+ +- ++ @@ -146,19 +146,19 @@ index cd8e594..23fc0e4 100644 @@ -130,13 +130,13 @@ - + -
-
+
- Power + Power
- - + + @@ -145,13 +145,13 @@
@@ -198,7 +198,7 @@ index cd8e594..23fc0e4 100644
  • -@@ -249,7 +249,7 @@ +@@ -244,7 +244,7 @@
  • @@ -207,7 +207,7 @@ index cd8e594..23fc0e4 100644 id="noVNC_disconnect_button" class="noVNC_button" title="Disconnect" /> -@@ -266,7 +266,7 @@ +@@ -263,7 +263,7 @@
    @@ -216,7 +216,7 @@ index cd8e594..23fc0e4 100644
    -@@ -314,8 +314,8 @@ +@@ -304,8 +304,8 @@