From 381e86fcdc2f4baf687353f2933c1026ce6829ec Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Thu, 22 Apr 2021 17:32:40 +0200 Subject: [PATCH] F #5055: Refactor Remote Consoles (#1132) --- install.sh | 6 + .../server/routes/websockets/vmrc/index.js | 6 +- src/sunstone/bin/novnc-server | 5 +- src/sunstone/models/sunstone_guac.rb | 110 +--- src/sunstone/models/sunstone_remotes.rb | 123 +++++ src/sunstone/models/sunstone_vmrc.rb | 98 +--- src/sunstone/models/sunstone_vnc.rb | 277 ++++------ src/sunstone/public/Gruntfile.js | 5 + .../vmrc/dialogId.js => console/guacamole.js} | 21 +- src/sunstone/public/app/console/spice.js | 65 +-- src/sunstone/public/app/console/vmrc.js | 104 ++-- src/sunstone/public/app/console/vnc.js | 68 +-- src/sunstone/public/app/tabs/provision-tab.js | 2 - .../public/app/tabs/provision-tab/vms/list.js | 15 +- src/sunstone/public/app/tabs/vms-tab.js | 5 - .../public/app/tabs/vms-tab/actions.js | 123 +++-- .../public/app/tabs/vms-tab/buttons.js | 1 + .../public/app/tabs/vms-tab/dialogs/guac.js | 89 ---- .../app/tabs/vms-tab/dialogs/guac/dialogId.js | 19 - .../app/tabs/vms-tab/dialogs/guac/html.hbs | 63 --- .../public/app/tabs/vms-tab/dialogs/spice.js | 90 ---- .../tabs/vms-tab/dialogs/spice/dialogId.js | 19 - .../app/tabs/vms-tab/dialogs/spice/html.hbs | 42 -- .../public/app/tabs/vms-tab/dialogs/vmrc.js | 94 ---- .../app/tabs/vms-tab/dialogs/vmrc/html.hbs | 42 -- .../public/app/tabs/vms-tab/dialogs/vnc.js | 95 ---- .../app/tabs/vms-tab/dialogs/vnc/dialogId.js | 19 - .../app/tabs/vms-tab/dialogs/vnc/html.hbs | 45 -- .../public/app/utils/guacamole/controller.js | 8 +- .../app/utils/guacamole/directives/guacOsk.js | 2 +- .../public/app/utils/info-connection/utils.js | 4 + .../public/app/utils/remote-actions.js | 16 +- src/sunstone/public/app/utils/spice.js | 106 ---- src/sunstone/public/app/utils/vmrc.js | 153 ------ src/sunstone/public/app/utils/vnc.js | 136 ----- src/sunstone/public/css/guac-custom.css | 327 ++++++++++++ src/sunstone/public/css/novnc-custom.css | 23 + src/sunstone/public/css/spice-custom.css | 26 + src/sunstone/public/css/vmrc-custom.css | 503 ++++++++++++++++++ .../images/remote_console/guacamole.png | Bin 0 -> 2087 bytes .../public/images/remote_console/noVNC.png | Bin 0 -> 1407 bytes .../public/images/remote_console/spice.png | Bin 0 -> 2338 bytes .../public/images/remote_console/vmrc.png | Bin 0 -> 2057 bytes src/sunstone/public/scss/_layout.scss | 259 --------- src/sunstone/sunstone-server.rb | 16 +- src/sunstone/views/guac.erb | 119 +++++ src/sunstone/views/vmrc.erb | 57 +- src/sunstone/views/vnc.erb | 11 +- 48 files changed, 1508 insertions(+), 1909 deletions(-) create mode 100644 src/sunstone/models/sunstone_remotes.rb rename src/sunstone/public/app/{tabs/vms-tab/dialogs/vmrc/dialogId.js => console/guacamole.js} (66%) delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/guac.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/guac/dialogId.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/guac/html.hbs delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/spice.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/spice/dialogId.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/spice/html.hbs delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/html.hbs delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/vnc.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/dialogId.js delete mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs delete mode 100644 src/sunstone/public/app/utils/spice.js delete mode 100644 src/sunstone/public/app/utils/vmrc.js delete mode 100644 src/sunstone/public/app/utils/vnc.js create mode 100644 src/sunstone/public/css/guac-custom.css create mode 100644 src/sunstone/public/css/vmrc-custom.css create mode 100644 src/sunstone/public/images/remote_console/guacamole.png create mode 100644 src/sunstone/public/images/remote_console/noVNC.png create mode 100644 src/sunstone/public/images/remote_console/spice.png create mode 100644 src/sunstone/public/images/remote_console/vmrc.png create mode 100644 src/sunstone/views/guac.erb diff --git a/install.sh b/install.sh index a70468097d..91f099d2ad 100755 --- a/install.sh +++ b/install.sh @@ -2520,6 +2520,7 @@ SUNSTONE_MODELS_FILES="src/sunstone/models/OpenNebulaJSON.rb \ src/sunstone/models/SunstoneServer.rb \ src/sunstone/models/SunstoneViews.rb \ src/sunstone/models/sunstone_vm_helper.rb \ + src/sunstone/models/sunstone_remotes.rb \ src/sunstone/models/sunstone_vnc.rb \ src/sunstone/models/sunstone_guac.rb \ src/sunstone/models/sunstone_vmrc.rb \ @@ -2554,6 +2555,7 @@ SUNSTONE_VIEWS_FILES="src/sunstone/views/index.erb \ src/sunstone/views/vnc.erb \ src/sunstone/views/vmrc.erb \ src/sunstone/views/spice.erb \ + src/sunstone/views/guac.erb \ src/sunstone/views/_login_standard.erb \ src/sunstone/views/_login_x509.erb" @@ -2567,6 +2569,8 @@ SUNSTONE_PUBLIC_JS_CONSOLE_FILES="src/sunstone/public/dist/console/vnc.js \ src/sunstone/public/dist/console/vnc.js.map \ src/sunstone/public/dist/console/spice.js \ src/sunstone/public/dist/console/spice.js.map \ + src/sunstone/public/dist/console/guacamole.js \ + src/sunstone/public/dist/console/guacamole.js.map \ src/sunstone/public/dist/console/vmrc.js \ src/sunstone/public/dist/console/vmrc.js.map" @@ -2579,7 +2583,9 @@ SUNSTONE_ROUTES_FILES="src/sunstone/routes/oneflow.rb \ SUNSTONE_PUBLIC_CSS_FILES="src/sunstone/public/css/app.min.css \ src/sunstone/public/css/opensans/opensans.woff \ + src/sunstone/public/css/vmrc-custom.css \ src/sunstone/public/css/novnc-custom.css \ + src/sunstone/public/css/guac-custom.css \ src/sunstone/public/css/spice-custom.css" SUNSTONE_PUBLIC_FONT_AWSOME="src/sunstone/public/bower_components/fontawesome/web-fonts-with-css/webfonts/fa-brands-400.eot \ diff --git a/src/fireedge/src/server/routes/websockets/vmrc/index.js b/src/fireedge/src/server/routes/websockets/vmrc/index.js index 34372e71ed..aed2683e01 100644 --- a/src/fireedge/src/server/routes/websockets/vmrc/index.js +++ b/src/fireedge/src/server/routes/websockets/vmrc/index.js @@ -43,10 +43,12 @@ const vmrcProxy = createProxyMiddleware(endpointVmrc, { // eslint-disable-next-line consistent-return router: req => { if (req && req.url) { - const ticket = req.url.split('/')[3] || '' + // Needs to be reviewed require('path') + const ticket = req.url.split('/')[3] + const filterTicket = ticket.split('?')[0] try { const esxi = readFileSync( - `${global.VMRC_TOKENS || ''}/${ticket}` + `${global.VMRC_TOKENS || ''}/${filterTicket}` ).toString() return esxi } catch (error) { diff --git a/src/sunstone/bin/novnc-server b/src/sunstone/bin/novnc-server index bd35f3a64e..e5df0a4855 100755 --- a/src/sunstone/bin/novnc-server +++ b/src/sunstone/bin/novnc-server @@ -76,9 +76,9 @@ if ARGV[0] when :start vnc.start when :stop - vnc.stop(true) + vnc.stop when :restart - vnc.stop(true) + vnc.stop sleep 1 vnc.start when :status @@ -92,4 +92,3 @@ if ARGV[0] else exit(-1) end - diff --git a/src/sunstone/models/sunstone_guac.rb b/src/sunstone/models/sunstone_guac.rb index 63e4895a9e..2758bbd047 100644 --- a/src/sunstone/models/sunstone_guac.rb +++ b/src/sunstone/models/sunstone_guac.rb @@ -23,6 +23,7 @@ require 'json' require 'opennebula' require 'base64' require 'openssl' +require 'sunstone_remotes' if !ONE_LOCATION VAR_LOCATION = '/var/lib/one/' @@ -32,93 +33,18 @@ end FIREEDGE_KEY = VAR_LOCATION + '/.one/fireedge_key' -GUAC_STATES = [ - # 0, # LCM_INIT - # 1, # PROLOG - # 2, # BOOT - '3', # RUNNING - '4', # MIGRATE - # 5, # SAVE_STOP - # 6, # SAVE_SUSPEND - # 7, # SAVE_MIGRATE - # 8, # PROLOG_MIGRATE - # 9, # PROLOG_RESUME - # 10, # EPILOG_STOP - # 11, # EPILOG - '12', # SHUTDOWN - '13', # CANCEL - # 14, # FAILURE - # 15, # CLEANUP_RESUBMIT - '16', # UNKNOWN - '17', # HOTPLUG - '18', # SHUTDOWN_POWEROFF - # 19, # BOOT_UNKNOWN - # 20, # BOOT_POWEROFF - # 21, # BOOT_SUSPENDED - # 22, # BOOT_STOPPED - # 23, # CLEANUP_DELETE - '24', # HOTPLUG_SNAPSHOT - '25', # HOTPLUG_NIC - '26', # HOTPLUG_SAVEAS - '27', # HOTPLUG_SAVEAS_POWEROFF - '28', # HOTPLUG_SAVEAS_SUSPENDED - '29', # SHUTDOWN_UNDEPLOY - # 30, # EPILOG_UNDEPLOY - # 31, # PROLOG_UNDEPLOY - # 32, # BOOT_UNDEPLOY - # 33, # HOTPLUG_PROLOG_POWEROFF - # 34, # HOTPLUG_EPILOG_POWEROFF - # 35, # BOOT_MIGRATE - # 36, # BOOT_FAILURE - # 37, # BOOT_MIGRATE_FAILURE - # 38, # PROLOG_MIGRATE_FAILURE - # 39, # PROLOG_FAILURE - # 40, # EPILOG_FAILURE - # 41, # EPILOG_STOP_FAILURE - # 42, # EPILOG_UNDEPLOY_FAILURE - # 43, # PROLOG_MIGRATE_POWEROFF - # 44, # PROLOG_MIGRATE_POWEROFF_FAILURE - # 45, # PROLOG_MIGRATE_SUSPEND - # 46, # PROLOG_MIGRATE_SUSPEND_FAILURE - # 47, # BOOT_UNDEPLOY_FAILURE - # 48, # BOOT_STOPPED_FAILURE - # 49, # PROLOG_RESUME_FAILURE - # 50, # PROLOG_UNDEPLOY_FAILURE - # 51, # DISK_SNAPSHOT_POWEROFF - # 52, # DISK_SNAPSHOT_REVERT_POWEROFF - # 53, # DISK_SNAPSHOT_DELETE_POWEROFF - # 54, # DISK_SNAPSHOT_SUSPENDED - # 55, # DISK_SNAPSHOT_REVERT_SUSPENDED - # 56, # DISK_SNAPSHOT_DELETE_SUSPENDED - '57', # DISK_SNAPSHOT - '58', # DISK_SNAPSHOT_REVERT - # 59, # DISK_SNAPSHOT_DELETE - # 60, # PROLOG_MIGRATE_UNKNOWN - # 61, # PROLOG_MIGRATE_UNKNOWN_FAILURE - '62' # DISK_RESIZE - # 63, # DISK_RESIZE_POWEROFF - # 64, # DISK_RESIZE_UNDEPLOYED - # 65, #HOTPLUG_NIC_POWEROFF - # 66, # HOTPLUG_RESIZE - # 67, # HOTPLUG_SAVEAS_UNDEPLOYED - # 68, # HOTPLUG_SAVEAS_STOPPED -] - # Class for Guacamole connection configuration -class SunstoneGuac +class SunstoneGuac < SunstoneRemoteConnections attr_reader :proxy_port def initialize(logger, options = {}) - opts={ :json_errors => true }.merge(options) - - @options = opts - @logger = logger + super end def proxy(vm_resource, type_connection = 'vnc') # Check configurations and VM attributes - if !GUAC_STATES.include?(vm_resource['LCM_STATE']) + if !allowed_console_states.include?(vm_resource['LCM_STATE']) error_message = "Wrong state (#{vm_resource['LCM_STATE']}) to open a Guacamole session" return error(400, error_message) @@ -175,13 +101,6 @@ class SunstoneGuac private - def error(code, msg) - @logger.error(msg) - return [code, msg] unless @options[:json_error] - - [code, OpenNebula::Error.new(msg).to_json] - end - def get_config_vnc(vm_resource) # If it is a vCenter VM if vm_resource['USER_TEMPLATE/HYPERVISOR'] == 'vcenter' @@ -194,7 +113,8 @@ class SunstoneGuac return error(400, error_message) end else - hostname = vm_resource['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME'] + hostname = + vm_resource['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME'] end { @@ -211,10 +131,11 @@ class SunstoneGuac end def get_config_rdp(vm_resource) - hostname = vm_resource["TEMPLATE/NIC[RDP='YES'][1]/EXTERNAL_IP"] || - vm_resource["TEMPLATE/NIC[RDP='YES'][1]/IP"] || - vm_resource["TEMPLATE/NIC_ALIAS[RDP='YES'][1]/EXTERNAL_IP"] || - vm_resource["TEMPLATE/NIC_ALIAS[RDP='YES'][1]/IP"] + hostname = + vm_resource["TEMPLATE/NIC[RDP='YES'][1]/EXTERNAL_IP"] || + vm_resource["TEMPLATE/NIC[RDP='YES'][1]/IP"] || + vm_resource["TEMPLATE/NIC_ALIAS[RDP='YES'][1]/EXTERNAL_IP"] || + vm_resource["TEMPLATE/NIC_ALIAS[RDP='YES'][1]/IP"] if hostname.nil? error_message = 'Wrong configuration. Cannot find a NIC with RDP' @@ -237,10 +158,11 @@ class SunstoneGuac end def get_config_ssh(vm_resource) - hostname = vm_resource["TEMPLATE/NIC[SSH='YES'][1]/EXTERNAL_IP"] || - vm_resource["TEMPLATE/NIC[SSH='YES'][1]/IP"] || - vm_resource["TEMPLATE/NIC_ALIAS[SSH='YES'][1]/EXTERNAL_IP"] || - vm_resource["TEMPLATE/NIC_ALIAS[SSH='YES'][1]/IP"] + hostname = + vm_resource["TEMPLATE/NIC[SSH='YES'][1]/EXTERNAL_IP"] || + vm_resource["TEMPLATE/NIC[SSH='YES'][1]/IP"] || + vm_resource["TEMPLATE/NIC_ALIAS[SSH='YES'][1]/EXTERNAL_IP"] || + vm_resource["TEMPLATE/NIC_ALIAS[SSH='YES'][1]/IP"] if hostname.nil? error_message = 'Wrong configuration. Cannot find a NIC with SSH' diff --git a/src/sunstone/models/sunstone_remotes.rb b/src/sunstone/models/sunstone_remotes.rb new file mode 100644 index 0000000000..f18fb5d207 --- /dev/null +++ b/src/sunstone/models/sunstone_remotes.rb @@ -0,0 +1,123 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'rubygems' +require 'json' +require 'opennebula' + +# The following states are the ones where +# the remote connections are allowed. +ALLOWED_CONSOLE_STATES = [ + # '0', # LCM_INIT + # '1', # PROLOG + # '2', # BOOT + '3', # RUNNING + '4', # MIGRATE + # '5', # SAVE_STOP + # '6', # SAVE_SUSPEND + # '7', # SAVE_MIGRATE + # '8', # PROLOG_MIGRATE + # '9', # PROLOG_RESUME + # '10', # EPILOG_STOP + # '11', # EPILOG + '12', # SHUTDOWN + '13', # CANCEL + # '14', # FAILURE + # '15', # CLEANUP_RESUBMIT + '16', # UNKNOWN + '17', # HOTPLUG + '18', # SHUTDOWN_POWEROFF + # '19', # BOOT_UNKNOWN + # '20', # BOOT_POWEROFF + # '21', # BOOT_SUSPENDED + # '22', # BOOT_STOPPED + # '23', # CLEANUP_DELETE + '24', # HOTPLUG_SNAPSHOT + '25', # HOTPLUG_NIC + '26', # HOTPLUG_SAVEAS + '27', # HOTPLUG_SAVEAS_POWEROFF + '28', # HOTPLUG_SAVEAS_SUSPENDED + '29', # SHUTDOWN_UNDEPLOY + # '30', # EPILOG_UNDEPLOY + # '31', # PROLOG_UNDEPLOY + # '32', # BOOT_UNDEPLOY + # '33', # HOTPLUG_PROLOG_POWEROFF + # '34', # HOTPLUG_EPILOG_POWEROFF + # '35', # BOOT_MIGRATE + # '36', # BOOT_FAILURE + # '37', # BOOT_MIGRATE_FAILURE + # '38', # PROLOG_MIGRATE_FAILURE + # '39', # PROLOG_FAILURE + # '40', # EPILOG_FAILURE + # '41', # EPILOG_STOP_FAILURE + # '42', # EPILOG_UNDEPLOY_FAILURE + # '43', # PROLOG_MIGRATE_POWEROFF + # '44', # PROLOG_MIGRATE_POWEROFF_FAILURE + # '45', # PROLOG_MIGRATE_SUSPEND + # '46', # PROLOG_MIGRATE_SUSPEND_FAILURE + # '47', # BOOT_UNDEPLOY_FAILURE + # '48', # BOOT_STOPPED_FAILURE + # '49', # PROLOG_RESUME_FAILURE + # '50', # PROLOG_UNDEPLOY_FAILURE + # '51', # DISK_SNAPSHOT_POWEROFF + # '52', # DISK_SNAPSHOT_REVERT_POWEROFF + # '53', # DISK_SNAPSHOT_DELETE_POWEROFF + # '54', # DISK_SNAPSHOT_SUSPENDED + # '55', # DISK_SNAPSHOT_REVERT_SUSPENDED + # '56', # DISK_SNAPSHOT_DELETE_SUSPENDED + '57', # DISK_SNAPSHOT + '58', # DISK_SNAPSHOT_REVERT + # '59', # DISK_SNAPSHOT_DELETE + # '60', # PROLOG_MIGRATE_UNKNOWN + # '61', # PROLOG_MIGRATE_UNKNOWN_FAILURE + '62' # DISK_RESIZE + # '63', # DISK_RESIZE_POWEROFF + # '64', # DISK_RESIZE_UNDEPLOYED + # '65', # HOTPLUG_NIC_POWEROFF + # '66', # HOTPLUG_RESIZE + # '67', # HOTPLUG_SAVEAS_UNDEPLOYED + # '68', # HOTPLUG_SAVEAS_STOPPED +] + +# This class provides an abstracion with the common code +# inside the remote connections classes. +class SunstoneRemoteConnections + + attr_accessor :options, :logger + + def initialize(logger, options = {}) + opts = { + :json_errors => true + }.merge(options) + + @options = opts + @logger = logger + end + + def allowed_console_states + ALLOWED_CONSOLE_STATES + end + + protected + + def error(code, msg) + @logger.error(msg) + return [code, msg] unless @options[:json_error] + + [code, OpenNebula::Error.new(msg).to_json] + end + +end diff --git a/src/sunstone/models/sunstone_vmrc.rb b/src/sunstone/models/sunstone_vmrc.rb index 21ee237a80..928632821b 100644 --- a/src/sunstone/models/sunstone_vmrc.rb +++ b/src/sunstone/models/sunstone_vmrc.rb @@ -25,6 +25,7 @@ require 'base64' require 'openssl' require 'vcenter_driver' require 'fileutils' +require 'sunstone_remotes' if !ONE_LOCATION VMRC_TICKETS = '/var/lib/one/sunstone_vmrc_tokens/' @@ -34,93 +35,18 @@ end FileUtils.mkdir_p VMRC_TICKETS -VMRC_STATES = [ - # 0, # LCM_INIT - # 1, # PROLOG - # 2, # BOOT - '3', # RUNNING - '4', # MIGRATE - # 5, # SAVE_STOP - # 6, # SAVE_SUSPEND - # 7, # SAVE_MIGRATE - # 8, # PROLOG_MIGRATE - # 9, # PROLOG_RESUME - # 10, # EPILOG_STOP - # 11, # EPILOG - '12', # SHUTDOWN - '13', # CANCEL - # 14, # FAILURE - # 15, # CLEANUP_RESUBMIT - '16', # UNKNOWN - '17', # HOTPLUG - '18', # SHUTDOWN_POWEROFF - # 19, # BOOT_UNKNOWN - # 20, # BOOT_POWEROFF - # 21, # BOOT_SUSPENDED - # 22, # BOOT_STOPPED - # 23, # CLEANUP_DELETE - '24', # HOTPLUG_SNAPSHOT - '25', # HOTPLUG_NIC - '26', # HOTPLUG_SAVEAS - '27', # HOTPLUG_SAVEAS_POWEROFF - '28', # HOTPLUG_SAVEAS_SUSPENDED - '29', # SHUTDOWN_UNDEPLOY - # 30, # EPILOG_UNDEPLOY - # 31, # PROLOG_UNDEPLOY - # 32, # BOOT_UNDEPLOY - # 33, # HOTPLUG_PROLOG_POWEROFF - # 34, # HOTPLUG_EPILOG_POWEROFF - # 35, # BOOT_MIGRATE - # 36, # BOOT_FAILURE - # 37, # BOOT_MIGRATE_FAILURE - # 38, # PROLOG_MIGRATE_FAILURE - # 39, # PROLOG_FAILURE - # 40, # EPILOG_FAILURE - # 41, # EPILOG_STOP_FAILURE - # 42, # EPILOG_UNDEPLOY_FAILURE - # 43, # PROLOG_MIGRATE_POWEROFF - # 44, # PROLOG_MIGRATE_POWEROFF_FAILURE - # 45, # PROLOG_MIGRATE_SUSPEND - # 46, # PROLOG_MIGRATE_SUSPEND_FAILURE - # 47, # BOOT_UNDEPLOY_FAILURE - # 48, # BOOT_STOPPED_FAILURE - # 49, # PROLOG_RESUME_FAILURE - # 50, # PROLOG_UNDEPLOY_FAILURE - # 51, # DISK_SNAPSHOT_POWEROFF - # 52, # DISK_SNAPSHOT_REVERT_POWEROFF - # 53, # DISK_SNAPSHOT_DELETE_POWEROFF - # 54, # DISK_SNAPSHOT_SUSPENDED - # 55, # DISK_SNAPSHOT_REVERT_SUSPENDED - # 56, # DISK_SNAPSHOT_DELETE_SUSPENDED - '57', # DISK_SNAPSHOT - '58', # DISK_SNAPSHOT_REVERT - # 59, # DISK_SNAPSHOT_DELETE - # 60, # PROLOG_MIGRATE_UNKNOWN - # 61, # PROLOG_MIGRATE_UNKNOWN_FAILURE - '62' # DISK_RESIZE - # 63, # DISK_RESIZE_POWEROFF - # 64, # DISK_RESIZE_UNDEPLOYED - # 65, # HOTPLUG_NIC_POWEROFF - # 66, # HOTPLUG_RESIZE - # 67, # HOTPLUG_SAVEAS_UNDEPLOYED - # 68, # HOTPLUG_SAVEAS_STOPPED -] - # Class for necessary VMRC ticket creation -class SunstoneVMRC +class SunstoneVMRC < SunstoneRemoteConnections attr_reader :proxy_port def initialize(logger, options = {}) - opts={ :json_errors => true }.merge(options) - - @options = opts - @logger = logger + super end def proxy(vm_resource, client = nil) # Check configurations and VM attributes - unless VMRC_STATES.include?(vm_resource['LCM_STATE']) + unless allowed_console_states.include?(vm_resource['LCM_STATE']) error_message = "Wrong state (#{vm_resource['LCM_STATE']}) to open a VMRC session" return error(400, error_message) @@ -158,7 +84,11 @@ class SunstoneVMRC :ticket => parameters[:ticket] } - file = File.open(VMRC_TICKETS + VCenterDriver::FileHelper.sanitize(data[:ticket]), 'w') + file = File.open( + VMRC_TICKETS + + VCenterDriver::FileHelper.sanitize(data[:ticket]), + 'w' + ) file.write('https://' + data[:host] + ':' + data[:port].to_s) file.close @@ -168,14 +98,4 @@ class SunstoneVMRC [200, { :data => data, :info => encode_info }.to_json] end - private - - def error(code, msg) - if @options[:json_errors] - [code, OpenNebula::Error.new(msg).to_json] - else - [code, msg] - end - end - end diff --git a/src/sunstone/models/sunstone_vnc.rb b/src/sunstone/models/sunstone_vnc.rb index d53451da00..39267e434b 100644 --- a/src/sunstone/models/sunstone_vnc.rb +++ b/src/sunstone/models/sunstone_vnc.rb @@ -14,106 +14,40 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -# -# This class provides support for launching and stopping a websockify proxy -# - require 'rubygems' require 'json' require 'opennebula' - +require 'sunstone_remotes' if !ONE_LOCATION - NOVNC_LOCK_FILE = "/var/lock/one/.novnc.lock" + NOVNC_LOCK_FILE = '/var/lock/one/.novnc.lock' else - NOVNC_LOCK_FILE= ONE_LOCATION + "/var/.novnc.lock" + NOVNC_LOCK_FILE= ONE_LOCATION + '/var/.novnc.lock' end TOKEN_EXPIRE_SECONDS = 4 -VNC_STATES = [ - #0, #LCM_INIT - #1, #PROLOG - #2, #BOOT - "3", #RUNNING - "4", #MIGRATE - #5, #SAVE_STOP - #6, #SAVE_SUSPEND - #7, #SAVE_MIGRATE - #8, #PROLOG_MIGRATE - #9, #PROLOG_RESUME - #10, #EPILOG_STOP - #11, #EPILOG - "12", #SHUTDOWN - "13", #CANCEL - #14, #FAILURE - #15, #CLEANUP_RESUBMIT - "16", #UNKNOWN - "17", #HOTPLUG - "18", #SHUTDOWN_POWEROFF - #19, #BOOT_UNKNOWN - #20, #BOOT_POWEROFF - #21, #BOOT_SUSPENDED - #22, #BOOT_STOPPED - #23, #CLEANUP_DELETE - "24", #HOTPLUG_SNAPSHOT - "25", #HOTPLUG_NIC - "26", #HOTPLUG_SAVEAS - "27", #HOTPLUG_SAVEAS_POWEROFF - "28", #HOTPLUG_SAVEAS_SUSPENDED - "29", #SHUTDOWN_UNDEPLOY - #30, #EPILOG_UNDEPLOY - #31, #PROLOG_UNDEPLOY - #32, #BOOT_UNDEPLOY - #33, #HOTPLUG_PROLOG_POWEROFF - #34, #HOTPLUG_EPILOG_POWEROFF - #35, #BOOT_MIGRATE - #36, #BOOT_FAILURE - #37, #BOOT_MIGRATE_FAILURE - #38, #PROLOG_MIGRATE_FAILURE - #39, #PROLOG_FAILURE - #40, #EPILOG_FAILURE - #41, #EPILOG_STOP_FAILURE - #42, #EPILOG_UNDEPLOY_FAILURE - #43, #PROLOG_MIGRATE_POWEROFF - #44, #PROLOG_MIGRATE_POWEROFF_FAILURE - #45, #PROLOG_MIGRATE_SUSPEND - #46, #PROLOG_MIGRATE_SUSPEND_FAILURE - #47, #BOOT_UNDEPLOY_FAILURE - #48, #BOOT_STOPPED_FAILURE - #49, #PROLOG_RESUME_FAILURE - #50, #PROLOG_UNDEPLOY_FAILURE - #51, #DISK_SNAPSHOT_POWEROFF - #52, #DISK_SNAPSHOT_REVERT_POWEROFF - #53, #DISK_SNAPSHOT_DELETE_POWEROFF - #54, #DISK_SNAPSHOT_SUSPENDED - #55, #DISK_SNAPSHOT_REVERT_SUSPENDED - #56, #DISK_SNAPSHOT_DELETE_SUSPENDED - "57", #DISK_SNAPSHOT - "58", #DISK_SNAPSHOT_REVERT - #59, #DISK_SNAPSHOT_DELETE - #60, #PROLOG_MIGRATE_UNKNOWN - #61, #PROLOG_MIGRATE_UNKNOWN_FAILURE - "62" #DISK_RESIZE - #63, #DISK_RESIZE_POWEROFF - #64 #DISK_RESIZE_UNDEPLOYED - #65 #HOTPLUG_NIC_POWEROFF - #66 #HOTPLUG_RESIZE - #67, #HOTPLUG_SAVEAS_UNDEPLOYED - #68, #HOTPLUG_SAVEAS_STOPPED -] - -class SunstoneVNC +# +# This class provides support for launching and stopping a websockify proxy +# +class SunstoneVNC < SunstoneRemoteConnections attr_reader :proxy_port def initialize(config, logger, options = {}) - opts={ :json_errors => true, - :token_folder_name => 'sunstone_vnc_tokens'}.merge(options) + super(logger, options) + # Add token folder to options + opts = { + :token_folder_name => 'sunstone_vnc_tokens' + }.merge(@options) + + @options = opts + + # Create configuration variables @pipe = nil @token_folder = File.join(VAR_LOCATION, opts[:token_folder_name]) - @proxy_path = File.join(SHARE_LOCATION, "websockify/run") + @proxy_path = File.join(SHARE_LOCATION, 'websockify/run') @proxy_port = config[:vnc_proxy_port] @proxy_ipv6 = config[:vnc_proxy_ipv6] @@ -122,20 +56,18 @@ class SunstoneVNC @lock_file = NOVNC_LOCK_FILE - if (@wss == "yes") || (@wss == "only") || (@wss == true) + if (@wss == 'yes') || (@wss == 'only') || (@wss == true) @enable_wss = true @cert = config[:vnc_proxy_cert] @key = config[:vnc_proxy_key] else @enable_wss = false end - @options = opts - @logger = logger end def start - if is_running? - message="VNC server already running" + if running? + message='VNC server already running' STDERR.puts message @logger.info message return false @@ -147,32 +79,32 @@ class SunstoneVNC if @enable_wss proxy_options << " --cert #{@cert}" - proxy_options << " --key #{@key}" if @key && @key.size > 0 - proxy_options << " --ssl-only" if @wss == "only" + proxy_options << " --key #{@key}" if @key && !@key.empty? + proxy_options << ' --ssl-only' if @wss == 'only' end if @proxy_ipv6 - proxy_options << " -6" + proxy_options << ' -6' end - python = 'python3' if system("python3 -c True") - python = 'python' if system("python -c True") + python = 'python3' if system('python3 -c True') + python = 'python' if system('python -c True') cmd ="#{python} #{@proxy_path} #{proxy_options} #{@proxy_port}" begin @logger.info { "Starting VNC proxy: #{cmd}" } pid=start_daemon(cmd, VNC_LOG) - rescue Exception => e + rescue StandardError => e @logger.error e.message return false end begin - File.open(@lock_file, "w") do |f| + File.open(@lock_file, 'w') do |f| f.write(pid.to_s) end - rescue Exception => e + rescue StandardError => e @logger.error e.message Process.kill('-KILL', pid) @@ -181,8 +113,8 @@ class SunstoneVNC sleep 1 - if !is_running? - message="Error starting VNC proxy" + if !running? + message='Error starting VNC proxy' STDERR.puts message @logger.error message File.delete(@lock_file) if File.exist?(@lock_file) @@ -190,24 +122,35 @@ class SunstoneVNC return false end - STDOUT.puts "VNC proxy started" + STDOUT.puts 'VNC proxy started' true end def proxy(vm_resource) # Check configurations and VM attributes - unless is_lockfile? - return error(400, "VNC Proxy is not running") + unless lockfile? + return error(400, 'VNC Proxy is not running') end - if !VNC_STATES.include?(vm_resource['LCM_STATE']) - return error(400,"Wrong state (#{vm_resource['LCM_STATE']}) to open a VNC session") + if !allowed_console_states.include?(vm_resource['LCM_STATE']) + return error( + 400, + "Wrong state (#{vm_resource['LCM_STATE']}) " \ + 'to open a VNC session' + ) end - if vm_resource['TEMPLATE/GRAPHICS/TYPE'].nil? || - !(["vnc", "spice"].include?(vm_resource['TEMPLATE/GRAPHICS/TYPE'].downcase)) - return error(400,"VM has no VNC configured") + if vm_resource['TEMPLATE/GRAPHICS/TYPE'].nil? + return error(400, 'VM has no VNC configured') + end + + include_vnc_or_spice = %w[vnc spice].include?( + vm_resource['TEMPLATE/GRAPHICS/TYPE'].downcase + ) + + if !include_vnc_or_spice + return error(400, 'VM has no VNC configured') end # Proxy data @@ -216,16 +159,21 @@ class SunstoneVNC vnc_pw = vm_resource['TEMPLATE/GRAPHICS/PASSWD'] # If it is a vCenter VM - if vm_resource['USER_TEMPLATE/HYPERVISOR'] == "vcenter" - if vm_resource['MONITORING/VCENTER_ESX_HOST'] - host = vm_resource['MONITORING/VCENTER_ESX_HOST'] - else - return error(400,"Could not determine the vCenter ESX host where the VM is running. Wait till the VCENTER_ESX_HOST attribute is retrieved once the host has been monitored") + if vm_resource['USER_TEMPLATE/HYPERVISOR'] == 'vcenter' + unless vm_resource['MONITORING/VCENTER_ESX_HOST'] + return error( + 400, + 'Could not determine the vCenter ESX host where ' \ + 'the VM is running. Wait till the VCENTER_ESX_HOST ' \ + 'attribute is retrieved once the host has been monitored' + ) end + + host = vm_resource['MONITORING/VCENTER_ESX_HOST'] end # Generate token random_str: host:port - random_str = rand(36**20).to_s(36) #random string a-z0-9 length 20 + random_str = rand(36**20).to_s(36) # Random string a-z0-9 length 20 token = "#{random_str}: #{host}:#{vnc_port}" token_file = 'one-'+vm_resource['ID'] @@ -234,53 +182,45 @@ class SunstoneVNC f = File.open(File.join(@token_folder, token_file), 'w') f.write(token) f.close - rescue Exception => e + rescue StandardError => e @logger.error e.message - return error(500, "Cannot create VNC proxy token") + return error(500, 'Cannot create VNC proxy token') end info = SunstoneVMHelper.get_remote_info(vm_resource) encode_info = Base64.encode64(info.to_json) - info = { + info = { :password => vnc_pw, :token => random_str, :info => encode_info } - return [200, info.to_json] + [200, info.to_json] end # Delete proxy token file def delete_token(filename) begin File.delete(File.join(@token_folder, filename)) - rescue => e + rescue StandardError => e @logger.error "Error deleting token file for VM #{vm_id}" @logger.error e.message end end - def stop(force=false) + def stop pid=get_pid if pid - @logger.info "Killing VNC proxy" + @logger.info 'Killing VNC proxy' - signal=(force ? '-KILL' : '-TERM') - Process.kill(signal ,pid) + Process.kill('-KILL', pid) sleep 1 - begin - Process.getpgid(pid) - - Process.kill('-KILL', pid) - rescue - end - - if is_running? - message="VNC server is still running" + if running? + message = 'VNC server is still running' STDERR.puts message @logger.error message return false @@ -288,9 +228,9 @@ class SunstoneVNC delete_token_dir - STDOUT.puts "VNC proxy stopped" + STDOUT.puts 'VNC proxy stopped' else - message="VNC server is not running" + message = 'VNC server is not running' @logger.info message STDERR.puts message end @@ -298,49 +238,41 @@ class SunstoneVNC end def status - if is_running? - STDOUT.puts "VNC is running" + if running? + STDOUT.puts 'VNC is running' true else - STDOUT.puts "VNC is NOT running" + STDOUT.puts 'VNC is NOT running' false end end private - def error(code, msg) - if @options[:json_errors] - return [code,OpenNebula::Error.new(msg).to_json] - else - return [code,msg] - end - end - def create_token_dir delete_token_dir begin - Dir.mkdir(@token_folder) if !File.exist?(@token_folder) - rescue Exception => e - @logger.error "Cannot create token folder" + Dir.mkdir(@token_folder) unless File.exist?(@token_folder) + rescue StandardError => e + @logger.error 'Cannot create token folder' @logger.error e.message end end def delete_token_dir - if File.exist?(@token_folder) - begin - Dir.glob("#{@token_folder}/*").each do |file| - File.delete(file) - end - rescue => e - @logger.error "Error deleting token folder" - @logger.error e.message + return unless File.exist?(@token_folder) + + begin + Dir.glob("#{@token_folder}/*").each do |file| + File.delete(file) end + rescue StandardError => e + @logger.error 'Error deleting token folder' + @logger.error e.message end end - def is_running? + def running? if File.exist?(@lock_file) pid=File.read(@lock_file).strip @@ -348,15 +280,15 @@ class SunstoneVNC return pid.to_i end - @logger.info "Deleting stale lock file" + @logger.info 'Deleting stale lock file' File.delete(@lock_file) end false end - alias_method :get_pid, :is_running? + alias get_pid running? - def is_lockfile? + def lockfile? dn = File.dirname(@lock_file) bn = File.basename(@lock_file) @@ -370,37 +302,20 @@ class SunstoneVNC end end -if RUBY_VERSION<'1.9' - def spawn(*args) - fork { - command=args[0..-2] - - # Close stdin and point out and err to log file - $stdout.reopen(VNC_LOG, "a") - $stderr.reopen(VNC_LOG, "a") - $stdin.close - - # Detach process from the parent - Process.setsid - - exec(*command) - } - end -end - def start_daemon(cmd, log) options={ :pgroup => true, :in => :close, - [:out, :err] => [log, "a"], - :close_others => true } + [:out, :err] => [log, 'a'], + :close_others => true + } - params=cmd.split(" ")+[options] - pid=spawn( *params ) + params=cmd.split(' ')+[options] + pid=spawn(*params) Process.detach(pid) pid end -end +end diff --git a/src/sunstone/public/Gruntfile.js b/src/sunstone/public/Gruntfile.js index f8b1e87d39..582e3ff6fd 100644 --- a/src/sunstone/public/Gruntfile.js +++ b/src/sunstone/public/Gruntfile.js @@ -93,6 +93,11 @@ module.exports = function(grunt) { name: "console/spice", include: ["almond"], insertRequire: ["console/spice"] + }, + { + name: "console/guacamole", + include: ["almond"], + insertRequire: ["console/guacamole"] } ] } diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/dialogId.js b/src/sunstone/public/app/console/guacamole.js similarity index 66% rename from src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/dialogId.js rename to src/sunstone/public/app/console/guacamole.js index c17458fcc5..84e21093bb 100644 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/dialogId.js +++ b/src/sunstone/public/app/console/guacamole.js @@ -15,5 +15,24 @@ /* -------------------------------------------------------------------------- */ define(function(require) { - return 'vmrcVMDialog'; + var GuacController = require('utils/guacamole/controller'); + + try { + var endpoint = new URL(window.location.href); + var encoded_socket = endpoint.searchParams.get("socket"); + var socket_string = atob(encoded_socket); + + var url = new URL(socket_string); + var params = url.searchParams; + var token = params.get("token"); + var info = params.get("info"); + + var controller = new GuacController(); + controller.setInformation(info); + controller.setConnection(token); + } catch (error) { + console.log(error); + $('#guacamole-state').empty().text('Failed'); + } + }); diff --git a/src/sunstone/public/app/console/spice.js b/src/sunstone/public/app/console/spice.js index 046169c50e..129b9a4382 100644 --- a/src/sunstone/public/app/console/spice.js +++ b/src/sunstone/public/app/console/spice.js @@ -29,70 +29,43 @@ define(function(require) { document.cookie = name + "=" + value + expires + "; path=/"; }; - function spice_query_var(name, defvalue) { - var match = RegExp('[?&]' + name + '=([^&]*)') - .exec(window.location.search); - return match ? - decodeURIComponent(match[1].replace(/\+/g, ' ')) - : defvalue; - } - function spice_error(e) { disconnect(); } function connect() { - var info = spice_query_var('info', undefined); + var endpoint = new URL(window.location.href); + var encoded_socket = endpoint.searchParams.get("socket"); + var socket_string = atob(encoded_socket); + + var socket_endpoint = new URL(socket_string); + var password = socket_endpoint.searchParams.get("password"); + var token = socket_endpoint.searchParams.get("token"); + var info = socket_endpoint.searchParams.get("info"); + var info_decode = UtilsConnection.decodeInfoConnection(info); UtilsConnection.printInfoConnection($('.SPICE_info'), info_decode) - if (info_decode && info_decode.name) { - document.title = info_decode.name - } - - // By default, use the host and port of server that served this file - var host = spice_query_var('host', window.location.hostname); - - // Note that using the web server port only makes sense - // if your web server has a reverse proxy to relay the WebSocket - // traffic to the correct destination port. - var default_port = window.location.port; - if (!default_port) { - if (window.location.protocol == 'http:') { - default_port = 80; - } else if (window.location.protocol == 'https:') { - default_port = 443; - } - } - - var scheme = "ws://" - if (window.location.protocol == 'https:') { - scheme = "wss://"; - } - // If a token variable is passed in, set the parameter in a cookie. // This is used by nova-spiceproxy. - var token = spice_query_var('token', null); if (token) { spice_set_cookie('token', token, 1) } - var password = spice_query_var('password', ''); - var port = spice_query_var('port', default_port); - - if ((!host) || (!port)) { - return; - } - if (sc) { sc.stop(); } - var uri = scheme + host + ":" + port + "?token=" + token; - try { - sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div", - message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected}); + sc = new SpiceMainConn({ + uri: socket_string, + screen_id: "spice-screen", + dump_id: "debug-div", + message_id: "message-div", + password: password, + onerror: spice_error, + onagent: agent_connected + }); } catch (e) { alert(e.toString()); @@ -101,7 +74,6 @@ define(function(require) { } function disconnect() { - console.log(">> disconnect"); if (sc) { sc.stop(); } @@ -111,7 +83,6 @@ define(function(require) { document.getElementById('spice-area').removeEventListener('dragover', handle_file_dragover, false); document.getElementById('spice-area').removeEventListener('drop', handle_file_drop, false); } - console.log("<< disconnect"); } function agent_connected(sc) { diff --git a/src/sunstone/public/app/console/vmrc.js b/src/sunstone/public/app/console/vmrc.js index 22011bc9c5..5639e7de57 100644 --- a/src/sunstone/public/app/console/vmrc.js +++ b/src/sunstone/public/app/console/vmrc.js @@ -26,16 +26,16 @@ define(function(require) { function setStatus(message="", status=""){ $(".VMRC_message").text(message); - $("#VMRC_status").text(status); + $("#VMRC_status_msg").text(status); } function connected(){ - setStatus(null, "VMRC " + _wmks.connectionState + " (" + _is_encrypted + ") to: " + _wmks.vm_name); + setStatus(null, "VMRC " + _wmks.connectionState); } function disconnectedFromServer(e){ if (e.detail.clean) { - setStatus(null, "VMRC " + _wmks.connectionState + " (" + _is_encrypted + ") to: " + _wmks.vm_name); + setStatus(null, "VMRC " + _wmks.connectionState); } else { setStatus("Something went wrong, connection is closed", "Failed"); } @@ -45,76 +45,44 @@ define(function(require) { if (_wmks) { _wmks.sendCAD(); } } - function updateState(state, msg) { - var s, sb, cad, level; - s = document.querySelector("#VMRC_status"); - sb = document.querySelector("#VMRC_status_bar"); - cad = document.querySelector("#sendCtrlAltDelButton"); - switch (state) { - case "failed": level = "error"; break; - case "fatal": level = "error"; break; - case "normal": level = "normal"; break; - case "disconnected": level = "normal"; break; - case "loaded": level = "normal"; break; - default: level = "warn"; break; - } + function enterFullScreen() { + if (_wmks) { _wmks.enterFullScreen(); } + } + + function selectLanguage() { + if(!_wmks) return; + var keyboardLayoutId = $('#selectLanguage').find(":selected").val(); + _wmks.setOption('keyboardLayoutId',keyboardLayoutId); + } - if (state === "normal") { - cad.disabled = false; - } else { - cad.disabled = true; - xvpInit(0); - } - - if (typeof(msg) !== "undefined") { - sb.setAttribute("class", "VMRC_status_" + level); - s.innerHTML = msg; - } + function keyboardSelector() { + $('#selectLanguage').toggle(); } - function getQueryVariable(variable) - { - var query = window.location.search.substring(1); - var vars = query.split("&"); - for (var i=0;i -
-
-
- - - - - - - - - - - -
-
-
-
-
-
-
-
-
- -
-
-
- -
-
- -
-
-
-
- diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/spice.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/spice.js deleted file mode 100644 index c68c03eb3c..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/spice.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - /* - DEPENDENCIES - */ - - var BaseDialog = require('utils/dialogs/dialog'); - var TemplateHTML = require('hbs!./spice/html'); - var Sunstone = require('sunstone'); - var Spice = require('utils/spice'); - - /* - CONSTANTS - */ - - var DIALOG_ID = require('./spice/dialogId'); - var TAB_ID = require('../tabId') - - /* - CONSTRUCTOR - */ - - function Dialog() { - this.dialogId = DIALOG_ID; - - BaseDialog.call(this); - }; - - Dialog.DIALOG_ID = DIALOG_ID; - Dialog.prototype = Object.create(BaseDialog.prototype); - Dialog.prototype.constructor = Dialog; - Dialog.prototype.html = _html; - Dialog.prototype.onShow = _onShow; - Dialog.prototype.onClose = _onClose; - Dialog.prototype.setup = _setup; - Dialog.prototype.setElement = _setElement; - - return Dialog; - - /* - FUNCTION DEFINITIONS - */ - - function _html() { - return TemplateHTML({ - 'dialogId': this.dialogId - }); - } - - function _setup(context) { - var that = this; - - $("#open_in_a_new_window_spice", context).on("click", function() { - var dialog = Sunstone.getDialog(DIALOG_ID); - dialog.hide(); - }); - - return false; - } - - function _onShow(context) { - Spice.spiceCallback(this.element); - return false; - } - - function _onClose(context) { - Spice.disconnect(); - Spice.unlock(); - return false; - } - - function _setElement(element) { - this.element = element - } -}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/spice/dialogId.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/spice/dialogId.js deleted file mode 100644 index 3effc68fd6..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/spice/dialogId.js +++ /dev/null @@ -1,19 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - return 'spiceVMDialog'; -}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/spice/html.hbs b/src/sunstone/public/app/tabs/vms-tab/dialogs/spice/html.hbs deleted file mode 100644 index 1b801300aa..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/spice/html.hbs +++ /dev/null @@ -1,42 +0,0 @@ -{{! -------------------------------------------------------------------------- }} -{{! Copyright 2002-2021, OpenNebula Project, OpenNebula Systems }} -{{! }} -{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }} -{{! not use this file except in compliance with the License. You may obtain }} -{{! a copy of the License at }} -{{! }} -{{! http://www.apache.org/licenses/LICENSE-2.0 }} -{{! }} -{{! Unless required by applicable law or agreed to in writing, software }} -{{! distributed under the License is distributed on an "AS IS" BASIS, }} -{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }} -{{! See the License for the specific language governing permissions and }} -{{! limitations under the License. }} -{{! -------------------------------------------------------------------------- }} - -
-
-
-

- {{tr "SPICE"}} - - - - - - -

-
-
-
-
-
-
-
-
-
-
- -
diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc.js deleted file mode 100644 index 573100ca40..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc.js +++ /dev/null @@ -1,94 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - /* - DEPENDENCIES - */ - - var BaseDialog = require('utils/dialogs/dialog'); - var Sunstone = require('sunstone'); - var TemplateHTML = require('hbs!./vmrc/html'); - var Vmrc = require('utils/vmrc'); - - /* - CONSTANTS - */ - - var DIALOG_ID = require('./vmrc/dialogId'); - - /* - CONSTRUCTOR - */ - - function Dialog() { - this.dialogId = DIALOG_ID; - - BaseDialog.call(this); - }; - - Dialog.DIALOG_ID = DIALOG_ID; - Dialog.prototype = Object.create(BaseDialog.prototype); - Dialog.prototype.constructor = Dialog; - Dialog.prototype.html = _html; - Dialog.prototype.onShow = _onShow; - Dialog.prototype.onClose = _onClose; - Dialog.prototype.setup = _setup; - Dialog.prototype.setElement = _setElement; - - return Dialog; - - /* - FUNCTION DEFINITIONS - */ - - function _html() { - return TemplateHTML({ - 'dialogId': this.dialogId - }); - } - - function _setup(context) { - $("#open_in_a_new_window", context).on("click", function() { - var dialog = Sunstone.getDialog(DIALOG_ID); - dialog.hide(); - }); - - $('#sendCtrlAltDelButton', context).click(function() { - Vmrc.sendCtrlAltDel(); - return false; - }); - - $(window).resize(Vmrc.updateScreen); - - return false; - } - - function _onShow(context) { - Vmrc.vmrcCallback(this.element); - return false; - } - - function _onClose(context) { - Vmrc.disconnect(); - Vmrc.unlock(); - return false; - } - - function _setElement(element) { - this.element = element - } -}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/html.hbs b/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/html.hbs deleted file mode 100644 index ff272b791f..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vmrc/html.hbs +++ /dev/null @@ -1,42 +0,0 @@ -{{! -------------------------------------------------------------------------- }} -{{! Copyright 2002-2021, OpenNebula Project, OpenNebula Systems }} -{{! }} -{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }} -{{! not use this file except in compliance with the License. You may obtain }} -{{! a copy of the License at }} -{{! }} -{{! http://www.apache.org/licenses/LICENSE-2.0 }} -{{! }} -{{! Unless required by applicable law or agreed to in writing, software }} -{{! distributed under the License is distributed on an "AS IS" BASIS, }} -{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }} -{{! See the License for the specific language governing permissions and }} -{{! limitations under the License. }} -{{! -------------------------------------------------------------------------- }} - -
-
-
-
- - - - - - - - -
-
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc.js deleted file mode 100644 index 363c773567..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc.js +++ /dev/null @@ -1,95 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - /* - DEPENDENCIES - */ - - var BaseDialog = require('utils/dialogs/dialog'); - var TemplateHTML = require('hbs!./vnc/html'); - var Sunstone = require('sunstone'); - var Vnc = require('utils/vnc'); - - /* - CONSTANTS - */ - - var DIALOG_ID = require('./vnc/dialogId'); - var TAB_ID = require('../tabId') - - /* - CONSTRUCTOR - */ - - function Dialog() { - this.dialogId = DIALOG_ID; - - BaseDialog.call(this); - }; - - Dialog.DIALOG_ID = DIALOG_ID; - Dialog.prototype = Object.create(BaseDialog.prototype); - Dialog.prototype.constructor = Dialog; - Dialog.prototype.html = _html; - Dialog.prototype.onShow = _onShow; - Dialog.prototype.onClose = _onClose; - Dialog.prototype.setup = _setup; - Dialog.prototype.setElement = _setElement; - - return Dialog; - - /* - FUNCTION DEFINITIONS - */ - - function _html() { - return TemplateHTML({ - 'dialogId': this.dialogId - }); - } - - function _setup(context) { - var that = this; - - $("#open_in_a_new_window", context).on("click", function() { - var dialog = Sunstone.getDialog(DIALOG_ID); - dialog.hide(); - }); - - $('#sendCtrlAltDelButton', context).click(function() { - Vnc.sendCtrlAltDel(); - return false; - }); - - return false; - } - - function _onShow(context) { - Vnc.vncCallback(this.element); - return false; - } - - function _onClose(context) { - Vnc.disconnect(); - Vnc.unlock(); - return false; - } - - function _setElement(element) { - this.element = element - } -}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/dialogId.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/dialogId.js deleted file mode 100644 index 95ad1091d4..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/dialogId.js +++ /dev/null @@ -1,19 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - return 'vncVMDialog'; -}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs b/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs deleted file mode 100644 index 5de6da3d84..0000000000 --- a/src/sunstone/public/app/tabs/vms-tab/dialogs/vnc/html.hbs +++ /dev/null @@ -1,45 +0,0 @@ -{{! -------------------------------------------------------------------------- }} -{{! Copyright 2002-2021, OpenNebula Project, OpenNebula Systems }} -{{! }} -{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }} -{{! not use this file except in compliance with the License. You may obtain }} -{{! a copy of the License at }} -{{! }} -{{! http://www.apache.org/licenses/LICENSE-2.0 }} -{{! }} -{{! Unless required by applicable law or agreed to in writing, software }} -{{! distributed under the License is distributed on an "AS IS" BASIS, }} -{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }} -{{! See the License for the specific language governing permissions and }} -{{! limitations under the License. }} -{{! -------------------------------------------------------------------------- }} - -
-
-
-
- - - - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/sunstone/public/app/utils/guacamole/controller.js b/src/sunstone/public/app/utils/guacamole/controller.js index 0cc69bfd72..53b4d008c7 100644 --- a/src/sunstone/public/app/utils/guacamole/controller.js +++ b/src/sunstone/public/app/utils/guacamole/controller.js @@ -38,10 +38,10 @@ define(function(require) { closeOskButton: document.getElementById('osk-close'), /* Buttons */ - sendCtrlAltDelButton: document.getElementById('sendCtrlAltDelButton_gclient'), - mouseButton: document.getElementById('mouseButton_gclient'), - screenshotButton: document.getElementById('takeScreenshot_gclient'), - oskButton: document.getElementById('oskButton_gclient'), + sendCtrlAltDelButton: document.getElementById('sendCtrlAltDelButton'), + mouseButton: document.getElementById('mouseButton'), + screenshotButton: document.getElementById('takeScreenshot'), + oskButton: document.getElementById('oskButton'), }; var throttleResizeFunction = Utils.throttle(containerResized, 250); diff --git a/src/sunstone/public/app/utils/guacamole/directives/guacOsk.js b/src/sunstone/public/app/utils/guacamole/directives/guacOsk.js index 17d9814dab..ece5a457db 100644 --- a/src/sunstone/public/app/utils/guacamole/directives/guacOsk.js +++ b/src/sunstone/public/app/utils/guacamole/directives/guacOsk.js @@ -26,7 +26,7 @@ define(function(require) { loadLayouts(); changeLayout(DEFAULT_LAYOUT); - $('#osk-container').draggable(); + // $('#osk-container').draggable(); function loadLayouts() { $('#osk-qwerty').empty(); diff --git a/src/sunstone/public/app/utils/info-connection/utils.js b/src/sunstone/public/app/utils/info-connection/utils.js index 434f7fcc2d..a965f3e355 100644 --- a/src/sunstone/public/app/utils/info-connection/utils.js +++ b/src/sunstone/public/app/utils/info-connection/utils.js @@ -27,6 +27,10 @@ define(function(require) { context.empty() info && context.append(TemplateInfo(info)) UtilsFoundation.update(context); + + if (info && info.name) { + document.title = info.name; + } } function decodeInfoConnection(info_encode) { diff --git a/src/sunstone/public/app/utils/remote-actions.js b/src/sunstone/public/app/utils/remote-actions.js index 90cf754468..17533c1562 100644 --- a/src/sunstone/public/app/utils/remote-actions.js +++ b/src/sunstone/public/app/utils/remote-actions.js @@ -19,27 +19,15 @@ define(function(require) { Sunstone = require('sunstone'), Config = require("sunstone-config"), OpenNebulaVM = require("opennebula/vm"), - Vnc = require('utils/vnc'), - Spice = require('utils/spice'), FireedgeValidator = require('utils/fireedge-validator'), Notifier = require('utils/notifier'); function _callSpice(data) { - if (!Spice.lockStatus() && data.hasOwnProperty('id')) { - Spice.lock(); - Sunstone.runAction('VM.startspice_action', String(data.id)); - } else { - Notifier.notifyError(Locale.tr('SPICE Connection in progress')); - } + if (data.hasOwnProperty('id')) Sunstone.runAction('VM.startspice_action', String(data.id)); } function _callVNC(data) { - if (!Vnc.lockStatus() && data.hasOwnProperty('id')) { - Vnc.lock(); - Sunstone.runAction('VM.startvnc_action', String(data.id)); - } else { - Notifier.notifyError(Locale.tr('VNC Connection in progress')); - } + if (data.hasOwnProperty('id')) Sunstone.runAction('VM.startvnc_action', String(data.id)); } function _callSaveRDP(data) { diff --git a/src/sunstone/public/app/utils/spice.js b/src/sunstone/public/app/utils/spice.js deleted file mode 100644 index 29f53fba9d..0000000000 --- a/src/sunstone/public/app/utils/spice.js +++ /dev/null @@ -1,106 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - require('spice-main'); - - var Config = require('sunstone-config'); - var UtilsConnection = require("utils/info-connection/utils"); - - var _lock = false; - var _sc; - - return { - 'lockStatus': lockStatus, - 'lock': lock, - 'unlock': unlock, - 'spiceCallback': spiceCallback, - 'disconnect': disconnect - } - - function lockStatus() { - return _lock; - } - - function lock() { - _lock = true; - } - - function unlock() { - _lock = false; - } - - function spice_error() { - disconnect(); - } - - function disconnect() { - try { - if (_sc) { - _sc.stop(); - } - } catch (e) {} - } - - function agent_connected(sc) { - window.addEventListener('resize', handle_resize); - window.spice_connection = this; - - resize_helper(this); - } - - function spiceCallback(response) { - var scheme = "ws://"; - if (Config.vncWSS == "yes") { - scheme = "wss://"; - } - - var host = window.location.hostname; - var port = Config.vncProxyPort; - var password = response["password"]; - var token = response["token"]; - - var info = response.info; - var info_decode = UtilsConnection.decodeInfoConnection(info); - UtilsConnection.printInfoConnection($('.SPICE_info'), info_decode) - - if ((!host) || (!port)) { - return; - } - - disconnect() - - uri = scheme + host + ":" + port + "?token=" + token; - - try { - _sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div", - message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected}); - } - catch (e) { - disconnect() - } - - var url = "spice?"; - url += "host=" + host; - url += "&port=" + port; - url += "&token=" + token; - url += "&password=" + password; - url += "&encrypt=" + config['user_config']['vnc_wss']; - url += "&info=" + info; - - $("#open_in_a_new_window_spice").attr('href', url); - } -}); diff --git a/src/sunstone/public/app/utils/vmrc.js b/src/sunstone/public/app/utils/vmrc.js deleted file mode 100644 index 2e08c00697..0000000000 --- a/src/sunstone/public/app/utils/vmrc.js +++ /dev/null @@ -1,153 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function (require) { - var WMKS = require("wmks"); - var Config = require("sunstone-config"); - var UtilsConnection = require("utils/info-connection/utils"); - - var _lock = false; - var _wmks; - var _is_encrypted = ""; - var vm_name = "" - - return { - "lockStatus": lockStatus, - "lock": lock, - "unlock": unlock, - "vmrcCallback": vmrcCallback, - "disconnect": disconnect, - "sendCtrlAltDel": sendCtrlAltDel, - "updateScreen": updateScreen - }; - - function lockStatus() { - return _lock; - } - - function lock() { - _lock = true; - } - - function unlock() { - _lock = false; - } - - function setStatus(message = "", status = "") { - $(".VMRC_message").text(message); - $("#VMRC_status").text(status); - } - - function connected() { - setStatus(null, "VMRC " + _wmks.connectionState + " (" + _is_encrypted + ") to: " + vm_name); - } - - function disconnectedFromServer(e) { - if (e.detail.clean) { - setStatus(null, "VMRC " + _wmks.connectionState + " (" + _is_encrypted + ") to: " + vm_name); - } else { - setStatus("Something went wrong, connection is closed", "Failed"); - } - } - - function render(ticket, host_vmrc, port_vmrc, response){ - var hostname = window.location.hostname; - var port = window.location.port; - var protocol = window.location.protocol; - var fireedge_endpoint = Config.publicFireedgeEndpoint.split("//")[1]; - var fireedge_host = fireedge_endpoint.split(":")[0]; - var fireedge_port = fireedge_endpoint.split(":")[1]; - - var info = response.info; - var info_decode = UtilsConnection.decodeInfoConnection(info); - UtilsConnection.printInfoConnection($('.VMRC_info'), info_decode); - - // set vm name on title - vm_name = (info_decode && info_decode.name) ? info_decode.name : ""; - - const queryString = window.location.search; - const urlParams = new URLSearchParams(queryString); - - // Content of response.data - var ticket = ticket || urlParams.get('ticket'); - var host_vmrc = host_vmrc || urlParams.get('host'); - var port_vmrc = port_vmrc || urlParams.get('port'); - - var URL = ""; - if (protocol === "https:") { - URL = "wss"; - _is_encrypted ="encrypted"; - } else { - URL = "ws"; - _is_encrypted ="unencrypted"; - } - - URL += "://" + fireedge_endpoint + "/"; - - var regex = new RegExp("^(ws|wss):\\/\\/[\\w\\D]*?\\/", "gi"); - var link = URL.replace(regex, protocol + "//" + hostname + ":" + port + "fireedge/vmrc?"); - - URL += "fireedge/vmrc/" + ticket; - link += "host=" + fireedge_host; - link += "&port=" + fireedge_port; - link += "&ticket=" + ticket; - link += "&info=" + info; - - try { - _wmks = WMKS.createWMKS('wmksContainer', {}) - .register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, - function (_, data) { - if (data.state === WMKS.CONST.ConnectionState.CONNECTED) { - console.log("connection state change: connected"); - } - } - ); - - _wmks.eventHandlers["connectionstatechange"].push(connected); - _wmks.eventHandlers["disconnect"] = disconnectedFromServer; - - _wmks.connect(URL); - - $("#VMRC_buttons #open_in_a_new_window").attr("href",link); - - } catch (err) { - setStatus("Something went wrong, connection is closed", "Failed"); - } - } - - function vmrcCallback(response) { - if (response.data) { - render( - response.data.ticket, - response.data.host, - response.data.port, - response - ); - } - } - - function disconnect() { - if (_wmks) { _wmks.disconnect(); } - } - - function sendCtrlAltDel() { - if (_wmks) { _wmks.sendCAD(); } - } - - function updateScreen() { - _wmks.updateScreen(); - } -}); diff --git a/src/sunstone/public/app/utils/vnc.js b/src/sunstone/public/app/utils/vnc.js deleted file mode 100644 index 2269adc27a..0000000000 --- a/src/sunstone/public/app/utils/vnc.js +++ /dev/null @@ -1,136 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -define(function(require) { - var Config = require("sunstone-config"); - var UtilsConnection = require("utils/info-connection/utils"); - - var RFB = require("vnc-rfb").default; - var _lock = false; - var _rfb; - var _message = ""; - var _status = "Loading"; - var _is_encrypted = ""; - - return { - "lockStatus": lockStatus, - "lock": lock, - "unlock": unlock, - "vncCallback": vncCallback, - "disconnect": disconnect, - "sendCtrlAltDel": sendCtrlAltDel - }; - - function lockStatus() { - return _lock; - } - - function lock() { - _lock = true; - } - - function unlock() { - _lock = false; - } - - function setStatus(message="", status=""){ - _message = message; - _status = status; - $(".NOVNC_message").text(_message); - $("#VNC_status").text(_status); - } - - function connected(){ - setStatus(null, "VNC " + _rfb._rfb_connection_state + " (" + _is_encrypted + ") to: " + _rfb._fb_name); - } - - function disconnectedFromServer(e){ - if (e.detail.clean) { - setStatus(null, "VNC " + _rfb._rfb_connection_state + " (" + _is_encrypted + ") to: " + _rfb._fb_name); - } else { - setStatus("Something went wrong, connection is closed", "Failed"); - } - } - - function desktopNameChange(e) { - if (e.detail.name) { - setStatus(null, "VNC " + _rfb._rfb_connection_state + " (" + _is_encrypted + ") to: " + e.detail.name); - } - } - - function credentialsRequired(e) { - setStatus("Something went wrong, more credentials must be given to continue", "Failed"); - } - - function vncCallback(response) { - var URL = ""; - var proxy_port = Config.vncProxyPort; - - var pw = response.password; - var token = response.token; - - var info_decode = UtilsConnection.decodeInfoConnection(response.info); - UtilsConnection.printInfoConnection($('.NOVNC_info'), info_decode); - - var proxy_host = window.location.hostname; - var protocol = window.location.protocol; - var hostname = window.location.hostname; - var port = window.location.port; - - var rfbConfig = pw ? { "credentials": { "password": pw } } : {}; - - if (protocol === "https:") { - URL = "wss"; - _is_encrypted ="encrypted"; - } else { - URL = "ws"; - _is_encrypted ="unencrypted"; - } - URL += "://" + hostname; - URL += ":" + proxy_port; - URL += "?host=" + proxy_host; - URL += "&port=" + proxy_port; - URL += "&token=" + token; - URL += "&encrypt=" + Config.vncWSS; - URL += "&info=" + response.info; - - if (!Config.requestVNCPassword) { - URL += "&password=" + pw; - } - var re = new RegExp("^(ws|wss):\\/\\/[\\w\\D]*?\\?", "gi"); - var link = URL.replace(re, protocol + "//" + hostname + ":" + port + "/vnc?"); - - try{ - _rfb = new RFB(document.querySelector("#VNC_canvas"), URL, rfbConfig); - _rfb.addEventListener("connect", connected); - _rfb.addEventListener("disconnect", disconnectedFromServer); - _rfb.addEventListener("desktopname", desktopNameChange); - _rfb.addEventListener("credentialsrequired", credentialsRequired); - }catch(err){ - setStatus("Something went wrong, connection is closed", "Failed"); - } - - $("#open_in_a_new_window").attr("href", link); - } - - function disconnect() { - if (_rfb) { _rfb.disconnect(); } - } - - function sendCtrlAltDel() { - if (_rfb) { _rfb.sendCtrlAltDel(); } - } -}); diff --git a/src/sunstone/public/css/guac-custom.css b/src/sunstone/public/css/guac-custom.css new file mode 100644 index 0000000000..49ee565036 --- /dev/null +++ b/src/sunstone/public/css/guac-custom.css @@ -0,0 +1,327 @@ +body { + margin:0; + padding:0; + font-family: Helvetica; + height:100%; +} + +html { + height:100%; +} + +.remote-buttons { + white-space: nowrap; +} + +.main { + width: 100%; + display: inline-flex; + height: 100%; + flex-direction: column; + background-color: rgb(40, 40, 40); +} + +.guacamole-main{ + flex-grow: 1; +} + +.guacamole-status { + text-align: center; + position: relative; + width: 100%; +} + +.remote-logo{ + border-radius: 50%; + background-color: #282828; + padding: 0.4em; + margin-right: 1em; + height: 40px; + width: 40px; +} + +.container{ + display: flex; + justify-content: center; + align-items: center; +} + +.guacamole-state{ + white-space: nowrap; + max-width: 20em; + overflow: hidden; + text-overflow: ellipsis; +} + + +/* left-align the status text on lower resolutions */ +@media screen and (max-width: 800px){ + .guacamole-status { + z-index: 1; + position: relative; + width: auto; + float: left; + } +} + +.guacamole-main { + width: 100%; + height: fit-content; + display: flex; + align-items: center; + place-content: center; + background-color: #282828; +} + +.guacamole-main > div { + z-index: 1; +} + +.guacamole-main .guacamole-display { + cursor: none; +} + +.osk-container { + z-index: 2; + background: rgba(0, 0, 0, 0.59); + position: absolute; + top: 30%; + left: 0; + display: none; + border: 1px solid #acacac; + border-radius: 6px; + box-shadow: 0 0 20px #acacac; +} + +.osk-container-header { + background: linear-gradient(to top, #ebebeb, #d5d5d5); + color: #4d494d; + font-size: 11pt; + line-height: 20px; + text-align: center; + width: 100%; + height: 28px; + user-select: none; + cursor: default; + border-top: 1px solid #f3f1f3; + border-bottom: 1px solid #b1aeb1; + border-top-left-radius: 6px; + border-top-right-radius: 6px; +} + +.osk-container-header .buttons { + padding-left: 8px; + padding-top: 3px; + float: left; + line-height: 0; +} + +.osk-container-header .buttons .close { + background: #ff5c5c; + font-size: 13px; + font-weight: bold; + width: 15px; + height: 15px; + border-radius: 50%; + display: inline-block; +} + +.osk-container-header .layouts { + padding-right: 8px; + padding-top: 3px; + float: right; + line-height: 0; +} + + +.guac-keyboard { + display: inline-block; + width: 100%; + + margin: 0; + padding: 0; + cursor: default; + + text-align: left; + vertical-align: middle; +} + +.guac-keyboard, +.guac-keyboard * { + overflow: hidden; + white-space: nowrap; +} + +.guac-keyboard .guac-keyboard-key-container { + display: inline-block; + margin: 0.05em; + position: relative; +} + +.guac-keyboard .guac-keyboard-key { + + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + + background: #444; + + border: 0.125em solid #666; + -moz-border-radius: 0.25em; + -webkit-border-radius: 0.25em; + -khtml-border-radius: 0.25em; + border-radius: 0.25em; + + color: white; + font-size: 40%; + font-weight: lighter; + text-align: center; + white-space: pre; + + text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25), + 1px -1px 0 rgba(0, 0, 0, 0.25), + -1px 1px 0 rgba(0, 0, 0, 0.25), + -1px -1px 0 rgba(0, 0, 0, 0.25); + +} + +.guac-keyboard .guac-keyboard-key:hover { + cursor: pointer; +} + +.guac-keyboard .guac-keyboard-key.highlight { + background: #666; + border-color: #666; +} + +/* Align some keys to the left */ +.guac-keyboard .guac-keyboard-key-caps, +.guac-keyboard .guac-keyboard-key-enter, +.guac-keyboard .guac-keyboard-key-tab, +.guac-keyboard .guac-keyboard-key-lalt, +.guac-keyboard .guac-keyboard-key-ralt, +.guac-keyboard .guac-keyboard-key-alt-gr, +.guac-keyboard .guac-keyboard-key-lctrl, +.guac-keyboard .guac-keyboard-key-rctrl, +.guac-keyboard .guac-keyboard-key-lshift, +.guac-keyboard .guac-keyboard-key-rshift { + text-align: left; + padding-left: 0.75em; +} + +/* Active shift */ +.guac-keyboard.guac-keyboard-modifier-shift .guac-keyboard-key-rshift, +.guac-keyboard.guac-keyboard-modifier-shift .guac-keyboard-key-lshift, + +/* Active ctrl */ +.guac-keyboard.guac-keyboard-modifier-control .guac-keyboard-key-rctrl, +.guac-keyboard.guac-keyboard-modifier-control .guac-keyboard-key-lctrl, + +/* Active alt */ +.guac-keyboard.guac-keyboard-modifier-alt .guac-keyboard-key-ralt, +.guac-keyboard.guac-keyboard-modifier-alt .guac-keyboard-key-lalt, + +/* Active alt-gr */ +.guac-keyboard.guac-keyboard-modifier-alt-gr .guac-keyboard-key-alt-gr, + +/* Active caps */ +.guac-keyboard.guac-keyboard-modifier-caps .guac-keyboard-key-caps, + +/* Active super */ +.guac-keyboard.guac-keyboard-modifier-super .guac-keyboard-key-super { + background: #882; + border-color: #DD4; +} + +.guac-keyboard .guac-keyboard-key.guac-keyboard-pressed { + background: #822; + border-color: #D44; +} + +.guac-keyboard .guac-keyboard-group { + line-height: 0; +} + +.guac-keyboard .guac-keyboard-group.guac-keyboard-alpha, +.guac-keyboard .guac-keyboard-group.guac-keyboard-movement { + display: inline-block; + text-align: center; + vertical-align: top; +} + +.guac-keyboard .guac-keyboard-group.guac-keyboard-main { + + /* IE10 */ + display: -ms-flexbox; + -ms-flex-align: stretch; + -ms-flex-direction: row; + + /* Ancient Mozilla */ + display: -moz-box; + -moz-box-align: stretch; + -moz-box-orient: horizontal; + + /* Ancient WebKit */ + display: -webkit-box; + -webkit-box-align: stretch; + -webkit-box-orient: horizontal; + + /* Old WebKit */ + display: -webkit-flex; + -webkit-align-items: stretch; + -webkit-flex-direction: row; + + /* W3C */ + display: flex; + align-items: stretch; + flex-direction: row; + +} + +.guac-keyboard .guac-keyboard-group.guac-keyboard-movement { + -ms-flex: 1 1 auto; + -moz-box-flex: 1; + -webkit-box-flex: 1; + -webkit-flex: 1 1 auto; + flex: 1 1 auto; +} + +.guac-keyboard .guac-keyboard-gap { + display: inline-block; +} + +/* Hide keycaps requiring modifiers which are NOT currently active. */ +.guac-keyboard:not(.guac-keyboard-modifier-caps) +.guac-keyboard-cap.guac-keyboard-requires-caps, + +.guac-keyboard:not(.guac-keyboard-modifier-shift) +.guac-keyboard-cap.guac-keyboard-requires-shift, + +.guac-keyboard:not(.guac-keyboard-modifier-alt-gr) +.guac-keyboard-cap.guac-keyboard-requires-alt-gr, + +/* Hide keycaps NOT requiring modifiers which ARE currently active, where that + modifier is used to determine which cap is displayed for the current key. */ +.guac-keyboard.guac-keyboard-modifier-shift +.guac-keyboard-key.guac-keyboard-uses-shift +.guac-keyboard-cap:not(.guac-keyboard-requires-shift), + +.guac-keyboard.guac-keyboard-modifier-caps +.guac-keyboard-key.guac-keyboard-uses-caps +.guac-keyboard-cap:not(.guac-keyboard-requires-caps), + +.guac-keyboard.guac-keyboard-modifier-alt-gr +.guac-keyboard-key.guac-keyboard-uses-alt-gr +.guac-keyboard-cap:not(.guac-keyboard-requires-alt-gr) { + + display: none; + +} + +/* Fade out keys which do not use AltGr if AltGr is active */ +.guac-keyboard.guac-keyboard-modifier-alt-gr +.guac-keyboard-key:not(.guac-keyboard-uses-alt-gr):not(.guac-keyboard-key-alt-gr) { + opacity: 0.5; +} \ No newline at end of file diff --git a/src/sunstone/public/css/novnc-custom.css b/src/sunstone/public/css/novnc-custom.css index 3cf9489bc7..7a3f89159f 100644 --- a/src/sunstone/public/css/novnc-custom.css +++ b/src/sunstone/public/css/novnc-custom.css @@ -112,6 +112,7 @@ html { display: inline-flex; height: 100%; flex-direction: column; + background-color: rgb(40, 40, 40); } #noVNC_screen > #VNC_canvas{ flex-grow: 1; @@ -392,6 +393,28 @@ html { width: 100%; } +.remote_logo{ + border-radius: 50%; + background-color: #282828; + padding: 0.4em; + margin-right: 1em; + height: 40px; + width: 40px; +} + +#noVNC_status_msg{ + white-space: nowrap; + max-width: 20em; + overflow: hidden; + text-overflow: ellipsis; +} + +.container{ + display: flex; + justify-content: center; + align-items: center; +} + #showExtraKeysButton { display: none; } #toggleCtrlButton { display: inline; } #toggleAltButton { display: inline; } diff --git a/src/sunstone/public/css/spice-custom.css b/src/sunstone/public/css/spice-custom.css index f5c8717ab0..1df226854e 100644 --- a/src/sunstone/public/css/spice-custom.css +++ b/src/sunstone/public/css/spice-custom.css @@ -55,3 +55,29 @@ main { .spice-message-error { color: red; } + +#VMRC_buttons { + white-space: nowrap; +} + +.remote_logo{ + border-radius: 50%; + background-color: #282828; + padding: 0.4em; + margin-right: 1em; + height: 40px; + width: 40px; +} + +#spice_status_msg{ + white-space: nowrap; + max-width: 20em; + overflow: hidden; + text-overflow: ellipsis; +} + +.container{ + display: flex; + justify-content: center; + align-items: center; +} diff --git a/src/sunstone/public/css/vmrc-custom.css b/src/sunstone/public/css/vmrc-custom.css new file mode 100644 index 0000000000..01390f7ffc --- /dev/null +++ b/src/sunstone/public/css/vmrc-custom.css @@ -0,0 +1,503 @@ +/* + * Based on the VMRC base CSS + * Copyright (C) 2012 Joel Martin + * Copyright (C) 2013 Samuel Mannehed for Cendio AB + * VMRC is licensed under the MPL 2.0 (see LICENSE.txt) + * This file is licensed under the 2-Clause BSD license (see LICENSE.txt). + */ + +body { + margin:0; + padding:0; + font-family: Helvetica; + /*Background image with light grey curve.*/ + height:100%; +} + +html { + height:100%; +} + +#VMRC_controls ul { + list-style: none; + margin: 0; + padding: 0; +} +#VMRC_controls li { + padding-bottom:8px; +} + +#VMRC_host { + width:150px; +} +#VMRC_port { + width: 80px; +} +#VMRC_password { + width: 150px; +} +#VMRC_path { + width: 100px; +} +#VMRC_connect_button { + width: 110px; + float:right; +} + +#VMRC_buttons { + white-space: nowrap; +} + +#VMRC_view_drag_button { + display: none; +} +#VMRC_xvp_buttons { + display: none; +} +#VMRC_mobile_buttons { + display: none; +} + +#VMRC_extra_keys { + display: inline; + list-style-type: none; + padding: 0; + margin: 0; + position: relative; +} + +.VMRC-buttons-left { + float: left; + z-index: 1; + position: relative; +} + +.VMRC-buttons-right { + float:right; + right: 0; + z-index: 2; + position: absolute; +} + +#VMRC_status { + text-align: center; +} + +#VMRC_settings_menu { + margin: 3px; + text-align: left; +} +#VMRC_settings_menu ul { + list-style: none; + margin: 0; + padding: 0; +} + +#VMRC_apply { + float:right; +} + +/* Do not set width/height for VNC_screen or VNC_canvas or incorrect + * scaling will occur. Canvas resizes to remote VNC settings */ +#VMRC_screen_pad { + margin: 0; + padding: 0; + height: 36px; +} +#VMRC_screen { + width: 100%; + display: flex; + height: 100%; + flex-direction: column; + background-color: rgb(40, 40, 40); +} +#VMRC_screen > #VNC_canvas{ + flex-grow: 1; +} + +#VMRC_container, #VMRC_canvas { + margin: 0; + padding: 0; +} + +#VMRC_canvas { + flex-grow: 1; +} + +#VNC_clipboard_clear_button { + float:right; +} +#VNC_clipboard_text { + font-size: 11px; +} + +#VMRC_clipboard_clear_button { + float:right; +} + +/*Bubble contents divs*/ +#VMRC_settings { + display:none; + margin-top:73px; + right:20px; + position:fixed; +} + +#VMRC_controls { + display:none; + margin-top:73px; + right:12px; + position:fixed; +} +#VMRC_controls.top:after { + right:15px; +} + +#VMRC_description { + display:none; + position:fixed; + + margin-top:73px; + right:20px; + left:20px; + padding:15px; + color:#000; + + border:2px solid #E0E0E0; +} + +#VMRC_popup_status_panel { + display:none; + position: fixed; + z-index: 1; + + margin:15px; + margin-top:60px; + padding:15px; + width:auto; + + text-align:center; + font-weight:bold; + word-wrap:break-word; + background:rgba(0,0,0,0.65); + + -webkit-border-radius:10px; + -moz-border-radius:10px; + border-radius:10px; +} + +#VMRC_xvp { + display:none; + margin-top:73px; + right:30px; + position:fixed; +} +#VMRC_xvp.top:after { + right:125px; +} + +#VMRC_clipboard { + display:none; + margin-top:73px; + right:30px; + position:fixed; +} +#VMRC_clipboard.top:after { + right:85px; +} + +#keyboardinput { + width:1px; + height:1px; + background-color:#fff; + color:#fff; + border:0; + position: relative; + left: -40px; + z-index: -1; +} + +/* + * Advanced Styling + */ + +.VMRC_status_normal { + color: #b2bdcd; /* Old browsers */ +} +.VMRC_status_error { + color: #f04040; /* Old browsers */ +} +.VMRC_status_warn { + color: #f0f040; /* Old browsers */ +} + +/* Control bar */ +#VMRC-control-bar { + position:fixed; + + display:block; + height:36px; + left:0; + top:0; + width:100%; + z-index:200; +} + +.VMRC_status_button { + padding: 4px 4px; + vertical-align: middle; + border:1px solid #869dbc; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + background: #b2bdcd; /* Old browsers */ + background: -moz-linear-gradient(top, #b2bdcd 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2bdcd), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */ + background: -ms-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b2bdcd', endColorstr='#6e84a3',GradientType=0 ); /* IE6-9 */ + background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */ + /*box-shadow:inset 0.4px 0.4px 0.4px #000000;*/ +} + +.VMRC_status_button_selected { + padding: 4px 4px; + vertical-align: middle; + border:1px solid #4366a9; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + background: #779ced; /* Old browsers */ + background: -moz-linear-gradient(top, #779ced 0%, #3970e0 49%, #2160dd 51%, #2463df 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#779ced), color-stop(49%,#3970e0), color-stop(51%,#2160dd), color-stop(100%,#2463df)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* Opera11.10+ */ + background: -ms-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* IE10+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#779ced', endColorstr='#2463df',GradientType=0 ); /* IE6-9 */ + background: linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* W3C */ + /*box-shadow:inset 0.4px 0.4px 0.4px #000000;*/ +} + + +/*Settings Bubble*/ +.triangle-right { + position:relative; + padding:15px; + margin:1em 0 3em; + color:#fff; + background:#fff; /* default background for browsers without gradient support */ + /* css3 */ + /*background:-webkit-gradient(linear, 0 0, 0 100%, from(#2e88c4), to(#075698)); + background:-moz-linear-gradient(#2e88c4, #075698); + background:-o-linear-gradient(#2e88c4, #075698); + background:linear-gradient(#2e88c4, #075698);*/ + -webkit-border-radius:10px; + -moz-border-radius:10px; + border-radius:10px; + color:#000; + border:2px solid #E0E0E0; +} + +.triangle-right.top:after { + border-color: transparent #E0E0E0; + border-width: 20px 20px 0 0; + bottom: auto; + left: auto; + right: 50px; + top: -20px; +} + +.triangle-right:after { + content:""; + position:absolute; + bottom:-20px; /* value = - border-top-width - border-bottom-width */ + left:50px; /* controls horizontal position */ + border-width:20px 0 0 20px; /* vary these values to change the angle of the vertex */ + border-style:solid; + border-color:#E0E0E0 transparent; + /* reduce the damage in FF3.0 */ + display:block; + width:0; +} + +.triangle-right.top:after { + top:-40px; /* value = - border-top-width - border-bottom-width */ + right:50px; /* controls horizontal position */ + bottom:auto; + left:auto; + border-width:40px 40px 0 0; /* vary these values to change the angle of the vertex */ + border-color:transparent #E0E0E0; +} + +/*Default VMRC logo.*/ +/* From: http://fonts.googleapis.com/css?family=Orbitron:700 */ +@font-face { + font-family: 'Orbitron'; + font-style: normal; + font-weight: 700; + src: local('?'), url('Orbitron700.woff') format('woff'), + url('Orbitron700.ttf') format('truetype'); +} + +#VMRC_logo { + margin-top: 170px; + margin-left: 10px; + color:yellow; + text-align:left; + font-family: 'Orbitron', 'OrbitronTTF', sans-serif; + line-height:90%; + text-shadow: + 5px 5px 0 #000, + -1px -1px 0 #000, + 1px -1px 0 #000, + -1px 1px 0 #000, + 1px 1px 0 #000; +} + + +#VMRC_logo span{ + color:green; +} + +/* ---------------------------------------- + * Media sizing + * ---------------------------------------- + */ + + +.VMRC_status_button { + font-size: 12px; +} + +#VMRC_clipboard_text { + width: 500px; +} + +#VMRC_logo { + font-size: 180px; +} + +.VMRC-buttons-left { + padding-left: 10px; +} + +.VMRC-buttons-right { + padding-right: 10px; +} + +#VMRC_status { + position: absolute; + width: 100%; +} + +#wmksContainer { + position: relative; + height: 100%; + width: 100%; + padding: 1em 0; +} + +.remote_logo{ + border-radius: 50%; + background-color: #282828; + padding: 0.4em; + margin-right: 1em; + height: 40px; + width: 40px; +} + +#VMRC_status_msg{ + white-space: nowrap; + max-width: 20em; + overflow: hidden; + text-overflow: ellipsis; +} + +.container{ + display: flex; + justify-content: center; + align-items: center; +} + +#showExtraKeysButton { display: none; } +#toggleCtrlButton { display: inline; } +#toggleAltButton { display: inline; } +#sendTabButton { display: inline; } +#sendEscButton { display: inline; } + +/* left-align the status text on lower resolutions */ +@media screen and (max-width: 800px){ + #VMRC_status { + z-index: 1; + position: relative; + width: auto; + float: left; + } +} + +@media screen and (max-width: 640px){ + #VMRC_clipboard_text { + width: 410px; + } + #VMRC_logo { + font-size: 150px; + } + .VMRC_status_button { + font-size: 10px; + } + .VMRC-buttons-left { + padding-left: 0; + } + .VMRC-buttons-right { + padding-right: 0; + } + /* collapse the extra keys on lower resolutions */ + #showExtraKeysButton { + display: inline; + } + #toggleCtrlButton { + display: none; + position: absolute; + top: 30px; + left: 0; + } + #toggleAltButton { + display: none; + position: absolute; + top: 65px; + left: 0; + } + #sendTabButton { + display: none; + position: absolute; + top: 100px; + left: 0; + } + #sendEscButton { + display: none; + position: absolute; + top: 135px; + left: 0; + } +} + +@media screen and (min-width: 321px) and (max-width: 480px) { + #VMRC_clipboard_text { + width: 250px; + } + #VMRC_logo { + font-size: 110px; + } +} + +@media screen and (max-width: 320px) { + .VMRC_status_button { + font-size: 9px; + } + #VMRC_clipboard_text { + width: 220px; + } + #VMRC_logo { + font-size: 90px; + } +} \ No newline at end of file diff --git a/src/sunstone/public/images/remote_console/guacamole.png b/src/sunstone/public/images/remote_console/guacamole.png new file mode 100644 index 0000000000000000000000000000000000000000..055856ed9fe9112f2356943dc96d5fa4eb50a4eb GIT binary patch literal 2087 zcmV+?2-x?DP)&~{L zQ_JqUonc3-)2{6-yDQdL+v%wIghkOHi?i*z1FMx5L>`&|!U};ar~R((47kbai!|yN%-F;%u@Nm)%&rQ&G&ce`h2J&z@G4%0D_6dF~a*4UX1! zc6MeHk-Ek@Q7PIptd`Q7scX@vFig8ZJiufv4aE9rB!Sn7e z=30Z(nN@}zF!H%S!ohGn$wlvz=r-~#hpr2}_+|OUJoc9oNxm&vM=qBxp`?dK{ zG1pAl*p#`+*OP&UUOFZOz{QmOSn(rJMg~o;Dd|BiRi%1+3J^M-PE)B=OWNDpz7dPX zzY+?C)_iIDs&iNTQvY>+Xa8hi)0sJ7#P)`MXb_bMcBm^$)>ldBT@%1ez^O&M2B=c5 z$EMAjrp9euUEOM(PRH-_-^$cZuObJBgD>`x71dA37# zcJ@L_#XWUPxM2bqaW_?PxV2i9aNNt=Ybv-JO^xI5@UT{|*N?Tfwt5!GB(H~G_Tf1( zR$I*4jQ3!zqvxHv)5Papc)ZM4DMf&ofK=ygAEOkE3pbSf711%#^Fh?-5{blS0vz1B za&U0)-q_ff;o-xF#f621HYs^A|8$SqIA*C^X9LzZnXVNUWIC2!FJ4?#nv`00owvn^ zrL(j148hUe-OUqZ32bR1vB>8B{rh4v2?ihDt-rfdoG<>l59fgPX~0rsCucEZb z&i|CZRgR4RPD*afH-!q>qK1YBXMzQu)WeheXm{@1Sur#;)I%omSqEyD7ne!Dcr5N1 zo8u;B+Cfh4+cju9q&j#gX;@?--RIesji1qaJT%>`$_eMuYhsFW6l$DjO zk{8Q=dxZVjGcjaIOnSy_H5g;uD}GO_Tv52Rrl#f-Bftj_9^}&6+S*pawF6`VK=oZ+ zU4j1o{#Mcaz~ucAf7U;5*322%=c0)1ot&IJAF;YtN!bx6LH*ENg7c2w+nbaV;m752=XZ2;oERAy=`&)1n!9Hg$i zynOA}Pq&f^vL=$}S92)RaaQh|$qt@dZ%E7u&y^O7mXk`=+|ulWycjXX(b3uA@hG)x zYikdfelZ@8Isj)>R#v{1k&$65RtPttqHw-W`dgg`Ys(<1!xm>W;>V{1MdZCxavgeQdpV?;aC}SQi!+ z_OeteU6fnI`vW&8%7x7jW`fAtAl$zzPa&{J3H@n&Li|Eat!4wVGz0tgn%fryX{*##Kh$H2qTVJG=590^IUyF* zG&MIJSF6?QVq;?$TH0*vbKYkq5D1pykQL4EL0Cler5XE#T|xYt`P~ z?vB&+&-9>4oQ|UEGyt?5!F&mF6$=Xo;|#bgk_0%uA94H6M@{YT^yLoq{rlu}Hi3tLmLq8_CzP`Su>gwt*7)-{? z7R8O~hH5!<>G;6FKm|@VIv1c2CUDq;yq1=h!-9XBY!-0Dct681ePA{m(?>HRJ1Y>@Fe%5G`r+;y(t<|i-!?%&88>YJ_ ziIemuT;ZzKYPl#yrEpCL6krNykZ$N7=pRHPHR53T2%9j}`OQow)5hGoXi^rSlaFj_ zsy{g`z>ts-Ysi2nSQ>`*#i4Or2YHzB<>e6l&`;QG_M2BSuPlp?k6($7`K^%9ki}@* zt!H|+q@-j~V`JmzIA|5f5ut+p;)xHyrM9>+ldwQ!2P}!Oz_!fH%%9D)nWba*p50`h zW$=P8Sf;@C2wdL?&)8YC05s@b2xYrTF!$nwHxP$Ru(}0cm%1Hvo7Jyko<}@i5{X1B z;A&S8kODv&A}ixW=uwOJpi)`BCTj3|h#iqRfh9?e*lHme2tkfTSOnqP8?BNTG0b_P zb^jIz3enxyCBq9!k{r_{O(T+U?`#e`F%Z3^fVD!gg~ zhW3M@(%F=&CmBjvH`tA;sHk{yLd<4_hlg9EsrVQ!j75A_AujtY1w;-8De8i&ix7kV z$j{GT^xS}%8+aXj6}{R@WcPN2z%hW1M%-Nn03l39-V#Xzfq53b_r{yrMri9Y2=PmE z3e4QFx3{M`yEt112M60i|6Wrnl}q@1{^HQEP}>7;2WHg47vskm|I`15_%Ha0#Ktg$ R|H=RW002ovPDHLkV1nQ34txLr literal 0 HcmV?d00001 diff --git a/src/sunstone/public/images/remote_console/noVNC.png b/src/sunstone/public/images/remote_console/noVNC.png new file mode 100644 index 0000000000000000000000000000000000000000..61fdd93462b8526e643cd2e37e12a952914b7f67 GIT binary patch literal 1407 zcmV-_1%UdAP)7P9OXgxw z>ZlGkaBOAPsa@9&O9vBHT3582-Lz9Tw63gmTB{5cON$lMwnM}!`(|xBT69vKmJa5M zh0>y1K@^J>Uy@d%dDXjfq7jWr{1Vy5^1z?KIsfxKzdZNc=K|mlfB3^6+Z(791%Pwl zbx%^}C^b&6_G2v)ii9|KK6!yWI_zke?*XY&Dh(HqJPDqKCN7WrIwT{6q0i7if^rYO za%f|V*&4;03b;LhrC5b7Dqby~56uA|2E319ji3y#6}k9|RzXh#8!Knu*&e_wU}ps8 zE5x98oq{RwQ^y{L5E6y&Q5ljz0gzAts$1_9UlTJhyadi-F9S|)58yFirDRmxhRv1x z6Z&@tyD#w1Y44o6Dd?AzwI(`(t*DA6MmK zxF|R;2tu?^0fUbO^Sp+y;Dh)^K@`H*@2RuYj2I!7@M``lE*zzfS0g5ZN#VozIzE)Y zx4`GYsQXzJGt{^)y^sg7m@yqB}d4TYjb*3kH8g~y zXV2IHeAw37N=+X;C_jJ!ZMc|iXoxLqX^~N`XR4~SQ5bN3aS_@wGlesE?x;S)P0^Da zTdA^A=m14UQD}UetHuk`)2GmokRS$n0=#`&^#ShovdILbm>4)zP@sAP14`tq#R4q- z{ajvpy4Dpi8UrpaEC6ZmUf4V}#SE|dC9~PPa&zIJBMEN320!9C+zF|^p03mBccD%sklzjaF`&d*b`1mMI8U}0It0pJ9joh8sh z&FCoi8}S&8aH^w2)cF*!wpK&Bbc__x>w*37Vg4=W-r%6@Te3br4kV?L>J&whbp;F! z70Rz&3(+kuq6y+18>4=|cu^JXGe8oTE@{|_33i+m=;}fP$;qO4|Gs>O(TMbRJCJg6 zfC&%dNT=TwkgWCeDB=wUYKr8To<{xW&%YAuGe8pe?kPUUBgbwu0((gbojp7(w3A{3 z13uSN03OIu@S+wzPz@BO`ndff^Zsb5<*~FD(IS z&mK61yBD<;pfkF=l_ytcq~i^D1>C)x>%V+CT;)kkOpLBoBTH&5s_5IWJ#ABgt*G zdRKNf``pu$291p>ZCV=j)2>~pPbOmu-FfQjG;Df0dnGXu^~vR8mOD>#bBHV>gQ`qQ zLVZC&=(`&?7?_z!f0UX^{hE@3`rM1^!~1?jPJj5rAO841#owEXn!wWM6uSTb N002ovPDHLkV1jv?i|zmb literal 0 HcmV?d00001 diff --git a/src/sunstone/public/images/remote_console/spice.png b/src/sunstone/public/images/remote_console/spice.png new file mode 100644 index 0000000000000000000000000000000000000000..34ee02472cd1a67905774cf48757156f045ce167 GIT binary patch literal 2338 zcmV+-3ElRIP)s^+O|6s-~?(q&6s` zX`vy|KncYK3>a*1Y_Rcqm-W71Gq>mN-eH$lLNWcuy*fH`cV}mQ^FQa@duIte!bT}& zPDB&XByKVvGb8LYG!xC>R_i#Xgb>9iTQ22zLN7TjGE@4w#0PnoAE0XjLo& za&bWBJ>2`D9cn8#t*J+Vc6iIs&beZTPj!s*4+F^5W6F5>&4b)q;{dcn?c@)la7YHo zs@KXrrWnh)LWfUvj2{Y6f_Cm%fchQ48Xs%?JO?)c+H+o>gDi5N;h!yV&j51|1h{M4 zHUYs_7Ah6}#nI96mtJ|rE(k&s&@|0(E}siro4fXe*W-m~I4W~69|vdW>3AMfQpDet zxOyzda$K=|2jC6<`GYCAdG%^>bs`bmzG>4Bbf533v6-14KD}kjxleE1${<~-Y$`FG zo?c%i)txF)%Y&i86Ap*NW&z@Z1se_1kG0h$2t*PD$l&jmEQLB0OWy277d7jg#X1Yu6L$OforX)#B zJy*SML~FH1gb>LuiUdP!WYI6;_lwXDY2gmQ2Mh5Uzn^?#WMt!$Jw2ntLqjh+gF$7E z(%Fj(3x5%#(S3dE)>htLJn*XM6}KlMiMSu5sVpi}8fX_H!AKTYQfD?>?r$`t9$B_& zl0=AUR?Cz&(kSvJn@!F_ds@kGzrYpzM{Ko>WQB{bms{FZRa_vZ8-y6NL*q}2MlEIC69u7m* z;b@%ArOzFxpG-|}U3w-Q411H1gb?-~>`GawVr`BUGj>`n2iGZzT~Sp5WGo+>tqEyX zt4r7Ic5^He@t?+=wB|ilKvq>R-4}4Du9KLmMmBeM@7U7U_nJ2lP)Pu%HwG9A0YyI} z7?p#@e~d%Jn7I54M;Ce*{M-Z_!UJK@R^%{3eJd0TB{~mDqi(*Zi<_MTG0;LLiAQaHt~KajJGWTA&zWTCW$Xra8ZF#R~r^zu!B@ zryy1w)>>S=3vd%5!k1jG*al7e{(!E3A=cg94fgjzG$s%lm5{dY6p1Befa z;;zlA`kgLK3ro?c04`S(=oTOYW@Gd>0~(wVuE4(TLr{wn7*GarDG9;~>;dd_+6|Nc zk|8@61)J=^O9@Rl7V;KksZl7*jT3TXPk(>p+^SW{IS$Cy>Be1vzW~^=j*zdfmF4H0 z4u_p!QQQT{JW~__>!Bdb$|cyV9ELNAk02C{HH#&Voq_uDVMv`PaOp$F!7!UQ)6DB)i|n0nxSTZ>=LrvFbjq0 z$y93c%_~<9?-?C^A-7?}Fum=a8oEIPpiYCp74ldYgIJk3G=ng5o7RTsS7f7k_057ftSSxnEjxrS)B!jw_f-Fbb81H1dbr_Rw!hZ36_~*Kd zpyTeQU+ixJCa`NoH+=9r5yp=ApjPYy&1t)pK^_kSrBEte8oPe|+@B^Uj{YW}LT6zKjaut$k9*3pRWEs1cCsBFLsJAtVOhhr1|^T@e$Wd6WR}K&YGF0l^Cr zrN6JeN6&Omn|j<&agC;^B4yJ~uo$Kbmks*vAJlpw(^K+!wK~g177X;bNHwToWQvoM zN8X*8IrA3j$B?21Duy<|LTj>3a|@1nQm}!&Vh4Le20}#O`laDZ$Ldjq1YnTAol_9k*XBlPL3S z8EhS!m0GQsdL;kN{6E`cz~#2bfXi)<0hikz11`5c23&6YF9h*C<#pl_$p8QV07*qo IM6N<$g7WW6Qvd(} literal 0 HcmV?d00001 diff --git a/src/sunstone/public/images/remote_console/vmrc.png b/src/sunstone/public/images/remote_console/vmrc.png new file mode 100644 index 0000000000000000000000000000000000000000..c21b3e8d042095d01f094b40afa81cbdcad74c7d GIT binary patch literal 2057 zcmV+k2=@1hP)PARrIoQPv9qmr58vG8*BxEm{Q&?X0DY7% zPMDl~a#hOe7q%>JPR|skL;40#!-XDl%L zI0K&j!{FYR-j42^bilQxshc|L?`>j{bAY8vG8N+@j$G=xcfze(8Y9n64PfnpCKl_n zt0;v$2z{ClHLMv-jDgXn1G=swbxsI*-%||5&GOg26KUIeAhLaG0C$^!bTtNqE(wr& zv!O;M156`0-QL%3k}>N6(WPi@$5aBozMzSTmuv+?7kP+hv!F&KFrDB`KyzQqRWSQO z0<_G|P}>omLInvhMu5f@|94S<_*o{Du$UY$PsQ9-l2Kn1vi9gy0=_oi05p55|00jr zC)1&h1emX)c(v@vN`~5_v9_&Eli!2f+S1gG9RwI9Ktqme7kI?ZWF%FPj%)cEN*0M|0RNE&*;EkJdyZgM^EG^THI+D# z-?g2?739|ch+n>|YW|*rqPfLjs_P4`wJH(%LzXb(-)Y*HfE_ao(Q6)jb5ejFGo5S2 zAN}PRGUq9n@dM2j?6qB@yTo@C;nqOo-Dh$O3JNgzDWIExj%-S}Z1j*dlyHZzrT|Q{ zs%ZT}cuFNnlQACIfdKw|^4@cDBae+I1wl z%jz@k=`|@&zFNJkj*Fa4G^?|ej-GL@nRboGdpyaq=LDnk#U!S!*f#k1>CctpHsFKz z@XI@PFZi=x`^w{NR=ZSVDLU5iQNZl@V}PuJ?K>Xp`fYRcMMc2{+o?Ig^v>OdT}ywc zFX!mpWQsUkHa589!_;1k;qo=TUz8BDRCis10ex50tL*{hy+hsNpA-dOQbIYS#G9Xq zqRo$_|9aVce`&hl;S&}evS;@5EjcL6$xaoZOG8XCd`i(Z;E6rq-yaD|@97%MWy5t| zHV{Juh;IWltO8JmW*zw{gXfX0>qz$l-Vq?VM}H!$eD#^d&+*fk7lZ$Fg>14RRnvgS z-x%ES$G^xe6pe|*OLQ@f_y8zA$fdNOG>oYS35+(QAKfo*>zdRJ&p)+jFVAy+gnCCE z;jJ>p0UHLlA3Px+0C3fW7_ms!f$Lo@Jk{&deopTJU&}XDHtjo-#nLdRwnFyue>)-)7w8Pi-J`(KH+-MB6!*+Dd(hdt z1XxK5p1S@L3w`agKAtgW;rH3qzuCWdXvlVbAP+T!Q#or%_4U-xet$ucb|0CQuVu36*RJ#@8EN@?_d_}O*c-zPk?h{i`|_h1 zzpJ=EV+*vH3$Q<;i$AUjm!1Ds3!3BB_y7T$DvBRdPcl z8$`Im926dWI^)<~b9@Uu95_;OP-M!EBe6FRo{*Y=xa*@y=E0<2Gf0ls46^o}mQk3VtQ&yN1=+$~YxuARu;9CF`kk(D` zSkqQ~V5M#PGY<<-Rjd@Maxy%5qRe9L0p&zZOSnF4LhGO`sv2yI^mqduqA*wR=95c$5e0V$WM?ybE6Ye n6Vqc)`o+l%F|G^T=!gCfKVUZ{scQ{C00000NkvXXu0mjf7{mG7 literal 0 HcmV?d00001 diff --git a/src/sunstone/public/scss/_layout.scss b/src/sunstone/public/scss/_layout.scss index aa33b6b5a3..9edb9e2248 100644 --- a/src/sunstone/public/scss/_layout.scss +++ b/src/sunstone/public/scss/_layout.scss @@ -159,263 +159,4 @@ progress{ background-color: $busy; } } -} - -.guacamole-main { - width: 100%; - height: fit-content; - display: flex; - align-items: center; - place-content: center; - background-color: #282828; - & > div { - z-index: 1; - } - & .guacamole-display { - cursor: none; - } -} - -#guacVMDialog { - overflow: hidden; -} - -.osk-container { - z-index: 2; - background: rgba(0, 0, 0, 0.59); - position: absolute; - top: 30%; - left: 0; - display: none; - border: 1px solid #acacac; - border-radius: 6px; - box-shadow: 0 0 20px #acacac; - & > .osk-container-header { - background: linear-gradient(to top, #ebebeb, #d5d5d5); - color: #4d494d; - font-size: 11pt; - line-height: 20px; - text-align: center; - width: 100%; - height: 28px; - user-select: none; - cursor: default; - border-top: 1px solid #f3f1f3; - border-bottom: 1px solid #b1aeb1; - border-top-left-radius: 6px; - border-top-right-radius: 6px; - & .buttons { - padding-left: 8px; - padding-top: 3px; - float: left; - line-height: 0; - & .close { - background: #ff5c5c; - font-size: 13px; - font-weight: bold; - width: 15px; - height: 15px; - border-radius: 50%; - display: inline-block; - } - } - & .layouts { - padding-right: 8px; - padding-top: 3px; - float: right; - line-height: 0; - } - } -} - -.guac-keyboard { - display: inline-block; - width: 100%; - - margin: 0; - padding: 0; - cursor: default; - - text-align: left; - vertical-align: middle; -} - -.guac-keyboard, -.guac-keyboard * { - overflow: hidden; - white-space: nowrap; -} - -.guac-keyboard .guac-keyboard-key-container { - display: inline-block; - margin: 0.05em; - position: relative; -} - -.guac-keyboard .guac-keyboard-key { - - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - - background: #444; - - border: 0.125em solid #666; - -moz-border-radius: 0.25em; - -webkit-border-radius: 0.25em; - -khtml-border-radius: 0.25em; - border-radius: 0.25em; - - color: white; - font-size: 40%; - font-weight: lighter; - text-align: center; - white-space: pre; - - text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25), - 1px -1px 0 rgba(0, 0, 0, 0.25), - -1px 1px 0 rgba(0, 0, 0, 0.25), - -1px -1px 0 rgba(0, 0, 0, 0.25); - -} - -.guac-keyboard .guac-keyboard-key:hover { - cursor: pointer; -} - -.guac-keyboard .guac-keyboard-key.highlight { - background: #666; - border-color: #666; -} - -/* Align some keys to the left */ -.guac-keyboard .guac-keyboard-key-caps, -.guac-keyboard .guac-keyboard-key-enter, -.guac-keyboard .guac-keyboard-key-tab, -.guac-keyboard .guac-keyboard-key-lalt, -.guac-keyboard .guac-keyboard-key-ralt, -.guac-keyboard .guac-keyboard-key-alt-gr, -.guac-keyboard .guac-keyboard-key-lctrl, -.guac-keyboard .guac-keyboard-key-rctrl, -.guac-keyboard .guac-keyboard-key-lshift, -.guac-keyboard .guac-keyboard-key-rshift { - text-align: left; - padding-left: 0.75em; -} - -/* Active shift */ -.guac-keyboard.guac-keyboard-modifier-shift .guac-keyboard-key-rshift, -.guac-keyboard.guac-keyboard-modifier-shift .guac-keyboard-key-lshift, - -/* Active ctrl */ -.guac-keyboard.guac-keyboard-modifier-control .guac-keyboard-key-rctrl, -.guac-keyboard.guac-keyboard-modifier-control .guac-keyboard-key-lctrl, - -/* Active alt */ -.guac-keyboard.guac-keyboard-modifier-alt .guac-keyboard-key-ralt, -.guac-keyboard.guac-keyboard-modifier-alt .guac-keyboard-key-lalt, - -/* Active alt-gr */ -.guac-keyboard.guac-keyboard-modifier-alt-gr .guac-keyboard-key-alt-gr, - -/* Active caps */ -.guac-keyboard.guac-keyboard-modifier-caps .guac-keyboard-key-caps, - -/* Active super */ -.guac-keyboard.guac-keyboard-modifier-super .guac-keyboard-key-super { - background: #882; - border-color: #DD4; -} - -.guac-keyboard .guac-keyboard-key.guac-keyboard-pressed { - background: #822; - border-color: #D44; -} - -.guac-keyboard .guac-keyboard-group { - line-height: 0; -} - -.guac-keyboard .guac-keyboard-group.guac-keyboard-alpha, -.guac-keyboard .guac-keyboard-group.guac-keyboard-movement { - display: inline-block; - text-align: center; - vertical-align: top; -} - -.guac-keyboard .guac-keyboard-group.guac-keyboard-main { - - /* IE10 */ - display: -ms-flexbox; - -ms-flex-align: stretch; - -ms-flex-direction: row; - - /* Ancient Mozilla */ - display: -moz-box; - -moz-box-align: stretch; - -moz-box-orient: horizontal; - - /* Ancient WebKit */ - display: -webkit-box; - -webkit-box-align: stretch; - -webkit-box-orient: horizontal; - - /* Old WebKit */ - display: -webkit-flex; - -webkit-align-items: stretch; - -webkit-flex-direction: row; - - /* W3C */ - display: flex; - align-items: stretch; - flex-direction: row; - -} - -.guac-keyboard .guac-keyboard-group.guac-keyboard-movement { - -ms-flex: 1 1 auto; - -moz-box-flex: 1; - -webkit-box-flex: 1; - -webkit-flex: 1 1 auto; - flex: 1 1 auto; -} - -.guac-keyboard .guac-keyboard-gap { - display: inline-block; -} - -/* Hide keycaps requiring modifiers which are NOT currently active. */ -.guac-keyboard:not(.guac-keyboard-modifier-caps) -.guac-keyboard-cap.guac-keyboard-requires-caps, - -.guac-keyboard:not(.guac-keyboard-modifier-shift) -.guac-keyboard-cap.guac-keyboard-requires-shift, - -.guac-keyboard:not(.guac-keyboard-modifier-alt-gr) -.guac-keyboard-cap.guac-keyboard-requires-alt-gr, - -/* Hide keycaps NOT requiring modifiers which ARE currently active, where that - modifier is used to determine which cap is displayed for the current key. */ -.guac-keyboard.guac-keyboard-modifier-shift -.guac-keyboard-key.guac-keyboard-uses-shift -.guac-keyboard-cap:not(.guac-keyboard-requires-shift), - -.guac-keyboard.guac-keyboard-modifier-caps -.guac-keyboard-key.guac-keyboard-uses-caps -.guac-keyboard-cap:not(.guac-keyboard-requires-caps), - -.guac-keyboard.guac-keyboard-modifier-alt-gr -.guac-keyboard-key.guac-keyboard-uses-alt-gr -.guac-keyboard-cap:not(.guac-keyboard-requires-alt-gr) { - - display: none; - -} - -/* Fade out keys which do not use AltGr if AltGr is active */ -.guac-keyboard.guac-keyboard-modifier-alt-gr -.guac-keyboard-key:not(.guac-keyboard-uses-alt-gr):not(.guac-keyboard-key-alt-gr) { - opacity: 0.5; } \ No newline at end of file diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 878a399599..4161c4f8c9 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -550,7 +550,7 @@ before do @request_body = request.body.read request.body.rewind - unless %w(/ /login /vnc /spice /version /webauthn_options_for_get /ws /vmrc).include?(request.path) + unless %w(/ /login /vnc /spice /version /webauthn_options_for_get /ws /vmrc /guac).include?(request.path) halt [401, "csrftoken"] unless authorized? && valid_csrftoken? end @@ -747,6 +747,20 @@ get '/vnc' do end end +get '/guac' do + content_type 'text/html', :charset => 'utf-8' + if !authorized? + erb :login + else + erb :guac, :locals => { + :logos_conf => $conf[:locals][:logos_conf], + :oned_conf => $conf[:locals][:oned_conf], + :support => $conf[:locals][:support], + :upgrade => $conf[:locals][:upgrade] + } + end +end + get '/vmrc' do content_type 'text/html', :charset => 'utf-8' if !authorized? diff --git a/src/sunstone/views/guac.erb b/src/sunstone/views/guac.erb new file mode 100644 index 0000000000..75d369a8ef --- /dev/null +++ b/src/sunstone/views/guac.erb @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ +
+ + + +
+
+
+
+ + + + +
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+ + + <% view = $views_config.view(session[:user], session[:user_gname], session[:default_view]) %> + + + \ No newline at end of file diff --git a/src/sunstone/views/vmrc.erb b/src/sunstone/views/vmrc.erb index fd5543d4f9..3559f4e1fb 100644 --- a/src/sunstone/views/vmrc.erb +++ b/src/sunstone/views/vmrc.erb @@ -10,7 +10,8 @@ - + + <% view = $views_config.view(session[:user], session[:user_gname], session[:default_view]) %> @@ -68,27 +69,45 @@
-
-
- - - - - - -
- -
Loading
-
-
- +
+
+
+ + +
+
+ -
+
+ Loading +
+
+ + +
+ + + + +
+
+
-
-
+ +
+
diff --git a/src/sunstone/views/vnc.erb b/src/sunstone/views/vnc.erb index b2345eba2e..eaf0023222 100644 --- a/src/sunstone/views/vnc.erb +++ b/src/sunstone/views/vnc.erb @@ -18,7 +18,16 @@
-
Loading
+
+
+ +
+ Loading +
+
+