GUACAMOLE-724: Migrate usage of var to const/let in all directly touched code.

This commit is contained in:
Michael Jumper
2021-07-08 03:19:34 -07:00
parent d6c5165f90
commit dd86130600
15 changed files with 201 additions and 201 deletions

View File

@@ -24,26 +24,26 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
function clientController($scope, $routeParams, $injector) {
// Required types
var ConnectionGroup = $injector.get('ConnectionGroup');
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientGroup = $injector.get('ManagedClientGroup');
var ManagedClientState = $injector.get('ManagedClientState');
var ManagedFilesystem = $injector.get('ManagedFilesystem');
var Protocol = $injector.get('Protocol');
var ScrollState = $injector.get('ScrollState');
const ConnectionGroup = $injector.get('ConnectionGroup');
const ManagedClient = $injector.get('ManagedClient');
const ManagedClientGroup = $injector.get('ManagedClientGroup');
const ManagedClientState = $injector.get('ManagedClientState');
const ManagedFilesystem = $injector.get('ManagedFilesystem');
const Protocol = $injector.get('Protocol');
const ScrollState = $injector.get('ScrollState');
// Required services
var $location = $injector.get('$location');
var authenticationService = $injector.get('authenticationService');
var connectionGroupService = $injector.get('connectionGroupService');
var clipboardService = $injector.get('clipboardService');
var dataSourceService = $injector.get('dataSourceService');
var guacClientManager = $injector.get('guacClientManager');
var iconService = $injector.get('iconService');
var preferenceService = $injector.get('preferenceService');
var requestService = $injector.get('requestService');
var tunnelService = $injector.get('tunnelService');
var userPageService = $injector.get('userPageService');
const $location = $injector.get('$location');
const authenticationService = $injector.get('authenticationService');
const connectionGroupService = $injector.get('connectionGroupService');
const clipboardService = $injector.get('clipboardService');
const dataSourceService = $injector.get('dataSourceService');
const guacClientManager = $injector.get('guacClientManager');
const iconService = $injector.get('iconService');
const preferenceService = $injector.get('preferenceService');
const requestService = $injector.get('requestService');
const tunnelService = $injector.get('tunnelService');
const userPageService = $injector.get('userPageService');
/**
* The minimum number of pixels a drag gesture must move to result in the
@@ -230,7 +230,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
$scope.addRemoveClient = function addRemoveClient(id, remove) {
// Deconstruct current path into corresponding client IDs
var ids = ManagedClientGroup.getClientIdentifiers($routeParams.id);
const ids = ManagedClientGroup.getClientIdentifiers($routeParams.id);
// Add/remove ID as requested
if (remove)
@@ -247,9 +247,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
* Reloads the contents of $scope.clientGroup to reflect the client IDs
* currently listed in the URL.
*/
var reparseRoute = function reparseRoute() {
const reparseRoute = function reparseRoute() {
var previousClients = $scope.clientGroup ? $scope.clientGroup.clients.slice() : [];
const previousClients = $scope.clientGroup ? $scope.clientGroup.clients.slice() : [];
// Replace existing group with new group
setAttachedGroup(guacClientManager.getManagedClientGroup($routeParams.id));
@@ -282,7 +282,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
* @param {ManagedClientGroup} [managedClientGroup]
* The ManagedClientGroup to attach to the interface, if any.
*/
var setAttachedGroup = function setAttachedGroup(managedClientGroup) {
const setAttachedGroup = function setAttachedGroup(managedClientGroup) {
if ($scope.clientGroup) {
@@ -290,7 +290,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
// seen their status)
_.filter($scope.clientGroup.clients, client => {
var connectionState = client.clientState.connectionState;
const connectionState = client.clientState.connectionState;
return connectionState === ManagedClientState.ConnectionState.DISCONNECTED
|| connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR
|| connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR;
@@ -393,7 +393,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
* @returns {boolean}
* true if Ctrl+Alt+Shift has been pressed, false otherwise.
*/
var isMenuShortcutPressed = function isMenuShortcutPressed(keyboard) {
const isMenuShortcutPressed = function isMenuShortcutPressed(keyboard) {
// Ctrl+Alt+Shift has NOT been pressed if any key is currently held
// down that isn't Ctrl, Alt, or Shift
@@ -468,7 +468,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
// Automatically track and cache the currently-focused client
$scope.$on('guacClientFocused', function focusedClientChanged(event, newFocusedClient) {
var oldFocusedClient = $scope.focusedClient;
const oldFocusedClient = $scope.focusedClient;
$scope.focusedClient = newFocusedClient;
// Apply any parameter changes when focus is changing
@@ -543,7 +543,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
// Count total number of links within the ManagedClient's share link map
var linkCount = 0;
for (var dummy in $scope.focusedClient.shareLinks)
for (const dummy in $scope.focusedClient.shareLinks)
linkCount++;
return linkCount;

View File

@@ -22,7 +22,7 @@
*/
angular.module('client').directive('guacClient', [function guacClient() {
var directive = {
const directive = {
restrict: 'E',
replace: true,
templateUrl: 'app/client/templates/guacClient.html'
@@ -51,31 +51,31 @@ angular.module('client').directive('guacClient', [function guacClient() {
function guacClientController($scope, $injector, $element) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
const ManagedClient = $injector.get('ManagedClient');
// Required services
var $window = $injector.get('$window');
const $window = $injector.get('$window');
/**
* Whether the local, hardware mouse cursor is in use.
*
* @type Boolean
*/
var localCursor = false;
let localCursor = false;
/**
* The current Guacamole client instance.
*
* @type Guacamole.Client
*/
var client = null;
let client = null;
/**
* The display of the current Guacamole client instance.
*
* @type Guacamole.Display
*/
var display = null;
let display = null;
/**
* The element associated with the display of the current
@@ -83,21 +83,21 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Element
*/
var displayElement = null;
let displayElement = null;
/**
* The element which must contain the Guacamole display element.
*
* @type Element
*/
var displayContainer = $element.find('.display')[0];
const displayContainer = $element.find('.display')[0];
/**
* The main containing element for the entire directive.
*
* @type Element
*/
var main = $element[0];
const main = $element[0];
/**
* Guacamole mouse event object, wrapped around the main client
@@ -105,7 +105,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Guacamole.Mouse
*/
var mouse = new Guacamole.Mouse(displayContainer);
const mouse = new Guacamole.Mouse(displayContainer);
/**
* Guacamole absolute mouse emulation object, wrapped around the
@@ -113,7 +113,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Guacamole.Mouse.Touchscreen
*/
var touchScreen = new Guacamole.Mouse.Touchscreen(displayContainer);
const touchScreen = new Guacamole.Mouse.Touchscreen(displayContainer);
/**
* Guacamole relative mouse emulation object, wrapped around the
@@ -121,7 +121,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Guacamole.Mouse.Touchpad
*/
var touchPad = new Guacamole.Mouse.Touchpad(displayContainer);
const touchPad = new Guacamole.Mouse.Touchpad(displayContainer);
/**
* Guacamole touch event handling object, wrapped around the main
@@ -129,13 +129,13 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Guacamole.Touch
*/
var touch = new Guacamole.Touch(displayContainer);
const touch = new Guacamole.Touch(displayContainer);
/**
* Updates the scale of the attached Guacamole.Client based on current window
* size and "auto-fit" setting.
*/
var updateDisplayScale = function updateDisplayScale() {
const updateDisplayScale = function updateDisplayScale() {
if (!display) return;
@@ -163,19 +163,19 @@ angular.module('client').directive('guacClient', [function guacClient() {
* @param {Guacamole.Mouse.State} mouseState The current mouse
* state.
*/
var scrollToMouse = function scrollToMouse(mouseState) {
const scrollToMouse = function scrollToMouse(mouseState) {
// Determine mouse position within view
var mouse_view_x = mouseState.x + displayContainer.offsetLeft - main.scrollLeft;
var mouse_view_y = mouseState.y + displayContainer.offsetTop - main.scrollTop;
const mouse_view_x = mouseState.x + displayContainer.offsetLeft - main.scrollLeft;
const mouse_view_y = mouseState.y + displayContainer.offsetTop - main.scrollTop;
// Determine viewport dimensions
var view_width = main.offsetWidth;
var view_height = main.offsetHeight;
const view_width = main.offsetWidth;
const view_height = main.offsetHeight;
// Determine scroll amounts based on mouse position relative to document
var scroll_amount_x;
let scroll_amount_x;
if (mouse_view_x > view_width)
scroll_amount_x = mouse_view_x - view_width;
else if (mouse_view_x < 0)
@@ -183,7 +183,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
else
scroll_amount_x = 0;
var scroll_amount_y;
let scroll_amount_y;
if (mouse_view_y > view_height)
scroll_amount_y = mouse_view_y - view_height;
else if (mouse_view_y < 0)
@@ -206,7 +206,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
* @param {Guacamole.Mouse.MouseEvent} event
* The mouse event to handle.
*/
var handleMouseEvent = function handleMouseEvent(event) {
const handleMouseEvent = function handleMouseEvent(event) {
// Do not attempt to handle mouse state changes if the client
// or display are not yet available
@@ -231,7 +231,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
* @param {Guacamole.Mouse.MouseEvent} event
* The mouse event to handle.
*/
var handleEmulatedMouseEvent = function handleEmulatedMouseEvent(event) {
const handleEmulatedMouseEvent = function handleEmulatedMouseEvent(event) {
// Do not attempt to handle mouse state changes if the client
// or display are not yet available
@@ -256,7 +256,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
* @param {Guacamole.Touch.Event} touchEvent
* The touch event.
*/
var handleTouchEvent = function handleTouchEvent(event) {
const handleTouchEvent = function handleTouchEvent(event) {
// Do not attempt to handle touch state changes if the client
// or display are not yet available
@@ -404,9 +404,9 @@ angular.module('client').directive('guacClient', [function guacClient() {
// Connect, if not already connected
ManagedClient.connect($scope.client, main.offsetWidth, main.offsetHeight);
var pixelDensity = $window.devicePixelRatio || 1;
var width = main.offsetWidth * pixelDensity;
var height = main.offsetHeight * pixelDensity;
const pixelDensity = $window.devicePixelRatio || 1;
const width = main.offsetWidth * pixelDensity;
const height = main.offsetHeight * pixelDensity;
if (display.getWidth() !== width || display.getHeight() !== height)
client.sendSize(width, height);
@@ -436,7 +436,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Number
*/
var initialScale = null;
let initialScale = null;
/**
* If a pinch gesture is in progress, the X coordinate of the point on the
@@ -445,7 +445,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Number
*/
var initialCenterX = 0;
let initialCenterX = 0;
/**
* If a pinch gesture is in progress, the Y coordinate of the point on the
@@ -454,7 +454,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
*
* @type Number
*/
var initialCenterY = 0;
let initialCenterY = 0;
// Zoom and pan client via pinch gestures
$scope.clientPinch = function clientPinch(inProgress, startLength, currentLength, centerX, centerY) {
@@ -484,7 +484,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
}
// Determine new scale absolutely
var currentScale = initialScale * currentLength / startLength;
let currentScale = initialScale * currentLength / startLength;
// Fix scale within limits - scroll will be miscalculated otherwise
currentScale = Math.max(currentScale, $scope.client.clientProperties.minScale);
@@ -564,7 +564,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
* @param {Event} e
* The event related to the in-progress drag/drop operation.
*/
var notifyDragStart = function notifyDragStart(e) {
const notifyDragStart = function notifyDragStart(e) {
e.preventDefault();
e.stopPropagation();
@@ -583,7 +583,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
* @param {Event} e
* The event related to the end of the former drag/drop operation.
*/
var notifyDragEnd = function notifyDragEnd(e) {
const notifyDragEnd = function notifyDragEnd(e) {
e.preventDefault();
e.stopPropagation();
@@ -608,8 +608,8 @@ angular.module('client').directive('guacClient', [function guacClient() {
return;
// Upload each file
var files = e.dataTransfer.files;
for (var i=0; i<files.length; i++)
const files = e.dataTransfer.files;
for (let i = 0; i < files.length; i++)
ManagedClient.uploadFile($scope.client, files[i]);
}, false);

View File

@@ -24,7 +24,7 @@
*/
angular.module('client').directive('guacClientNotification', [function guacClientNotification() {
var directive = {
const directive = {
restrict: 'E',
replace: true,
templateUrl: 'app/client/templates/guacClientNotification.html'
@@ -45,16 +45,16 @@ angular.module('client').directive('guacClientNotification', [function guacClien
function guacClientNotificationController($scope, $injector, $element) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientState = $injector.get('ManagedClientState');
var Protocol = $injector.get('Protocol');
const ManagedClient = $injector.get('ManagedClient');
const ManagedClientState = $injector.get('ManagedClientState');
const Protocol = $injector.get('Protocol');
// Required services
var $location = $injector.get('$location');
var authenticationService = $injector.get('authenticationService');
var guacClientManager = $injector.get('guacClientManager');
var requestService = $injector.get('requestService');
var userPageService = $injector.get('userPageService');
const $location = $injector.get('$location');
const authenticationService = $injector.get('authenticationService');
const guacClientManager = $injector.get('guacClientManager');
const requestService = $injector.get('requestService');
const userPageService = $injector.get('userPageService');
/**
* A Notification object describing the client status to display as a
@@ -70,7 +70,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* code not present in this list will be represented by the "DEFAULT"
* translation.
*/
var CLIENT_ERRORS = {
const CLIENT_ERRORS = {
0x0201: true,
0x0202: true,
0x0203: true,
@@ -89,7 +89,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* All error codes for which automatic reconnection is appropriate when a
* client error occurs.
*/
var CLIENT_AUTO_RECONNECT = {
const CLIENT_AUTO_RECONNECT = {
0x0200: true,
0x0202: true,
0x0203: true,
@@ -104,7 +104,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* code not present in this list will be represented by the "DEFAULT"
* translation.
*/
var TUNNEL_ERRORS = {
const TUNNEL_ERRORS = {
0x0201: true,
0x0202: true,
0x0203: true,
@@ -122,7 +122,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* All error codes for which automatic reconnection is appropriate when a
* tunnel error occurs.
*/
var TUNNEL_AUTO_RECONNECT = {
const TUNNEL_AUTO_RECONNECT = {
0x0200: true,
0x0202: true,
0x0203: true,
@@ -134,7 +134,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
/**
* Action which logs out from Guacamole entirely.
*/
var LOGOUT_ACTION = {
const LOGOUT_ACTION = {
name : "CLIENT.ACTION_LOGOUT",
className : "logout button",
callback : function logoutCallback() {
@@ -147,7 +147,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* Action which returns the user to the home screen. If the home page has
* not yet been determined, this will be null.
*/
var NAVIGATE_HOME_ACTION = null;
let NAVIGATE_HOME_ACTION = null;
// Assign home page action once user's home page has been determined
userPageService.getHomePage()
@@ -169,7 +169,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
/**
* Action which replaces the current client with a newly-connected client.
*/
var RECONNECT_ACTION = {
const RECONNECT_ACTION = {
name : "CLIENT.ACTION_RECONNECT",
className : "reconnect button",
callback : function reconnectCallback() {
@@ -182,7 +182,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* The reconnect countdown to display if an error or status warrants an
* automatic, timed reconnect.
*/
var RECONNECT_COUNTDOWN = {
const RECONNECT_COUNTDOWN = {
text: "CLIENT.TEXT_RECONNECT_COUNTDOWN",
callback: RECONNECT_ACTION.callback,
remaining: 15
@@ -200,7 +200,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* The status notification to show, as would be accepted by
* guacNotification.showStatus().
*/
var notifyConnectionClosed = function notifyConnectionClosed(status) {
const notifyConnectionClosed = function notifyConnectionClosed(status) {
// Re-authenticate to verify auth status at end of connection
authenticationService.updateCurrentToken($location.search())
@@ -220,7 +220,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* The current connection state, as defined by
* ManagedClientState.ConnectionState.
*/
var notifyConnectionState = function notifyConnectionState(connectionState) {
const notifyConnectionState = function notifyConnectionState(connectionState) {
// Hide any existing status
$scope.status = false;
@@ -230,14 +230,14 @@ angular.module('client').directive('guacClientNotification', [function guacClien
return;
// Build array of available actions
var actions;
let actions;
if (NAVIGATE_HOME_ACTION)
actions = [ NAVIGATE_HOME_ACTION, RECONNECT_ACTION, LOGOUT_ACTION ];
else
actions = [ RECONNECT_ACTION, LOGOUT_ACTION ];
// Get any associated status code
var status = $scope.client.clientState.statusCode;
const status = $scope.client.clientState.statusCode;
// Connecting
if (connectionState === ManagedClientState.ConnectionState.CONNECTING
@@ -254,10 +254,10 @@ angular.module('client').directive('guacClientNotification', [function guacClien
else if (connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR) {
// Determine translation name of error
var errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
const errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
// Determine whether the reconnect countdown applies
var countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
const countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
// Show error status
notifyConnectionClosed({
@@ -276,10 +276,10 @@ angular.module('client').directive('guacClientNotification', [function guacClien
else if (connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR) {
// Determine translation name of error
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
const errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
// Determine whether the reconnect countdown applies
var countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
const countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
// Show error status
notifyConnectionClosed({
@@ -322,18 +322,18 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* instructions, where each object key is the name of a requested
* parameter and each value is the current value entered by the user.
*/
var notifyParametersRequired = function notifyParametersRequired(requiredParameters) {
const notifyParametersRequired = function notifyParametersRequired(requiredParameters) {
/**
* Action which submits the current set of parameter values, requesting
* that the connection continue.
*/
var SUBMIT_PARAMETERS = {
const SUBMIT_PARAMETERS = {
name : "CLIENT.ACTION_CONTINUE",
className : "button",
callback : function submitParameters() {
if ($scope.client) {
var params = $scope.client.requiredParameters;
const params = $scope.client.requiredParameters;
$scope.client.requiredParameters = null;
ManagedClient.sendArguments($scope.client, params);
}
@@ -344,7 +344,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* Action which cancels submission of additional parameters and
* disconnects from the current connection.
*/
var CANCEL_PARAMETER_SUBMISSION = {
const CANCEL_PARAMETER_SUBMISSION = {
name : "CLIENT.ACTION_CANCEL",
className : "button",
callback : function cancelSubmission() {
@@ -381,7 +381,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* true if the given connection state allows submission of connection
* parameters via "argv" instructions, false otherwise.
*/
var canSubmitParameters = function canSubmitParameters(connectionState) {
const canSubmitParameters = function canSubmitParameters(connectionState) {
return (connectionState === ManagedClientState.ConnectionState.WAITING ||
connectionState === ManagedClientState.ConnectionState.CONNECTED);
};
@@ -394,8 +394,8 @@ angular.module('client').directive('guacClientNotification', [function guacClien
'client.forms'
], function clientStateChanged(newValues) {
var connectionState = newValues[0];
var requiredParameters = newValues[1];
const connectionState = newValues[0];
const requiredParameters = newValues[1];
// Prompt for parameters only if parameters can actually be submitted
if (requiredParameters && canSubmitParameters(connectionState))
@@ -414,7 +414,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
* @param {event} e
* The AngularJS event to selectively prevent.
*/
var preventDefaultDuringNotification = function preventDefaultDuringNotification(e) {
const preventDefaultDuringNotification = function preventDefaultDuringNotification(e) {
if ($scope.status && $scope.client.clientProperties.focused)
e.preventDefault();
};

View File

@@ -25,12 +25,12 @@
angular.module('client').directive('guacClientPanel', ['$injector', function guacClientPanel($injector) {
// Required services
var guacClientManager = $injector.get('guacClientManager');
var sessionStorageFactory = $injector.get('sessionStorageFactory');
const guacClientManager = $injector.get('guacClientManager');
const sessionStorageFactory = $injector.get('sessionStorageFactory');
// Required types
var ManagedClientGroup = $injector.get('ManagedClientGroup');
var ManagedClientState = $injector.get('ManagedClientState');
const ManagedClientGroup = $injector.get('ManagedClientGroup');
const ManagedClientState = $injector.get('ManagedClientState');
/**
* Getter/setter for the boolean flag controlling whether the client panel

View File

@@ -23,7 +23,7 @@
*/
angular.module('client').directive('guacClientZoom', [function guacClientZoom() {
var directive = {
const directive = {
restrict: 'E',
replace: true,
templateUrl: 'app/client/templates/guacClientZoom.html'

View File

@@ -41,9 +41,9 @@ angular.module('client').directive('guacFileTransferManager', [function guacFile
controller: ['$scope', '$injector', function guacFileTransferManagerController($scope, $injector) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientGroup = $injector.get('ManagedClientGroup');
var ManagedFileTransferState = $injector.get('ManagedFileTransferState');
const ManagedClient = $injector.get('ManagedClient');
const ManagedClientGroup = $injector.get('ManagedClientGroup');
const ManagedFileTransferState = $injector.get('ManagedFileTransferState');
/**
* Determines whether the given file transfer state indicates an

View File

@@ -24,7 +24,7 @@
*/
angular.module('client').directive('guacTiledClients', [function guacTiledClients() {
var directive = {
const directive = {
restrict: 'E',
templateUrl: 'app/client/templates/guacTiledClients.html',
};
@@ -63,8 +63,8 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
function guacTiledClientsController($scope, $injector, $element) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientGroup = $injector.get('ManagedClientGroup');
const ManagedClient = $injector.get('ManagedClient');
const ManagedClientGroup = $injector.get('ManagedClientGroup');
/**
* Returns the currently-focused ManagedClient. If there is no such
@@ -76,9 +76,9 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
*/
$scope.getFocusedClient = function getFocusedClient() {
var managedClientGroup = $scope.clientGroup;
const managedClientGroup = $scope.clientGroup;
if (managedClientGroup) {
var focusedClients = _.filter(managedClientGroup.clients, client => client.clientProperties.focused);
const focusedClients = _.filter(managedClientGroup.clients, client => client.clientProperties.focused);
if (focusedClients.length === 1)
return focusedClients[0];
}
@@ -121,10 +121,10 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
// via shift-click
if (shift) {
var minRow = $scope.clientGroup.rows - 1;
var minColumn = $scope.clientGroup.columns - 1;
var maxRow = 0;
var maxColumn = 0;
let minRow = $scope.clientGroup.rows - 1;
let minColumn = $scope.clientGroup.columns - 1;
let maxRow = 0;
let maxColumn = 0;
// Determine extents of selected area
ManagedClientGroup.forEach($scope.clientGroup, (client, row, column) => {

View File

@@ -23,7 +23,7 @@
*/
angular.module('client').directive('guacTiledThumbnails', [function guacTiledThumbnails() {
var directive = {
const directive = {
restrict: 'E',
replace: true,
templateUrl: 'app/client/templates/guacTiledThumbnails.html'
@@ -45,7 +45,7 @@ angular.module('client').directive('guacTiledThumbnails', [function guacTiledThu
function guacTiledThumbnailsController($scope, $injector, $element) {
// Required types
var ManagedClientGroup = $injector.get('ManagedClientGroup');
const ManagedClientGroup = $injector.get('ManagedClientGroup');
/**
* The overall height of the thumbnail view of the tiled grid of

View File

@@ -24,12 +24,12 @@ angular.module('client').factory('guacClientManager', ['$injector',
function guacClientManager($injector) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientGroup = $injector.get('ManagedClientGroup');
const ManagedClient = $injector.get('ManagedClient');
const ManagedClientGroup = $injector.get('ManagedClientGroup');
// Required services
var $window = $injector.get('$window');
var sessionStorageFactory = $injector.get('sessionStorageFactory');
const $window = $injector.get('$window');
const sessionStorageFactory = $injector.get('sessionStorageFactory');
var service = {};
@@ -63,7 +63,7 @@ angular.module('client').factory('guacClientManager', ['$injector',
*
* @type Function
*/
var storedManagedClientGroups = sessionStorageFactory.create([], function destroyClientGroupStorage() {
const storedManagedClientGroups = sessionStorageFactory.create([], function destroyClientGroupStorage() {
// Disconnect all clients when storage is destroyed
service.clear();
@@ -89,13 +89,13 @@ angular.module('client').factory('guacClientManager', ['$injector',
* @param {string} id
* The ID of the ManagedClient to remove.
*/
var ungroupManagedClient = function ungroupManagedClient(id) {
const ungroupManagedClient = function ungroupManagedClient(id) {
var managedClientGroups = storedManagedClientGroups();
const managedClientGroups = storedManagedClientGroups();
// Remove client from all groups
managedClientGroups.forEach(group => {
var removed = _.remove(group.clients, client => (client.id === id));
const removed = _.remove(group.clients, client => (client.id === id));
if (removed.length) {
// Reset focus state if client is being removed from a group
@@ -165,20 +165,20 @@ angular.module('client').factory('guacClientManager', ['$injector',
*/
service.replaceManagedClient = function replaceManagedClient(id) {
var managedClients = storedManagedClients();
var managedClientGroups = storedManagedClientGroups();
const managedClients = storedManagedClients();
const managedClientGroups = storedManagedClientGroups();
// Remove client if it exists
if (id in managedClients) {
var hadFocus = managedClients[id].clientProperties.focused;
const hadFocus = managedClients[id].clientProperties.focused;
managedClients[id].client.disconnect();
delete managedClients[id];
// Remove client from all groups
managedClientGroups.forEach(group => {
var index = _.findIndex(group.clients, client => (client.id === id));
const index = _.findIndex(group.clients, client => (client.id === id));
if (index === -1)
return;
@@ -235,8 +235,8 @@ angular.module('client').factory('guacClientManager', ['$injector',
*/
service.getManagedClientGroup = function getManagedClientGroup(id) {
var managedClientGroups = storedManagedClientGroups();
var existingGroup = _.find(managedClientGroups, (group) => {
const managedClientGroups = storedManagedClientGroups();
const existingGroup = _.find(managedClientGroups, (group) => {
return id === ManagedClientGroup.getIdentifier(group);
});
@@ -244,8 +244,8 @@ angular.module('client').factory('guacClientManager', ['$injector',
if (existingGroup)
return existingGroup;
var clients = [];
var clientIds = ManagedClientGroup.getClientIdentifiers(id);
const clients = [];
const clientIds = ManagedClientGroup.getClientIdentifiers(id);
// Separate active clients by whether they should be displayed within
// the current view
@@ -253,7 +253,7 @@ angular.module('client').factory('guacClientManager', ['$injector',
clients.push(service.getManagedClient(id));
});
var group = new ManagedClientGroup({
const group = new ManagedClientGroup({
clients : clients
});
@@ -279,17 +279,17 @@ angular.module('client').factory('guacClientManager', ['$injector',
*/
service.removeManagedClientGroup = function removeManagedClientGroup(id) {
var managedClients = storedManagedClients();
var managedClientGroups = storedManagedClientGroups();
const managedClients = storedManagedClients();
const managedClientGroups = storedManagedClientGroups();
// Remove all matching groups (there SHOULD only be one)
var removed = _.remove(managedClientGroups, (group) => ManagedClientGroup.getIdentifier(group) === id);
const removed = _.remove(managedClientGroups, (group) => ManagedClientGroup.getIdentifier(group) === id);
// Disconnect all clients associated with the removed group(s)
removed.forEach((group) => {
group.clients.forEach((client) => {
var id = client.id;
const id = client.id;
if (managedClients[id]) {
managedClients[id].client.disconnect();
delete managedClients[id];

View File

@@ -24,34 +24,34 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
function defineManagedClient($rootScope, $injector) {
// Required types
var ClientProperties = $injector.get('ClientProperties');
var ClientIdentifier = $injector.get('ClientIdentifier');
var ClipboardData = $injector.get('ClipboardData');
var ManagedArgument = $injector.get('ManagedArgument');
var ManagedClientState = $injector.get('ManagedClientState');
var ManagedClientThumbnail = $injector.get('ManagedClientThumbnail');
var ManagedDisplay = $injector.get('ManagedDisplay');
var ManagedFilesystem = $injector.get('ManagedFilesystem');
var ManagedFileUpload = $injector.get('ManagedFileUpload');
var ManagedShareLink = $injector.get('ManagedShareLink');
const ClientProperties = $injector.get('ClientProperties');
const ClientIdentifier = $injector.get('ClientIdentifier');
const ClipboardData = $injector.get('ClipboardData');
const ManagedArgument = $injector.get('ManagedArgument');
const ManagedClientState = $injector.get('ManagedClientState');
const ManagedClientThumbnail = $injector.get('ManagedClientThumbnail');
const ManagedDisplay = $injector.get('ManagedDisplay');
const ManagedFilesystem = $injector.get('ManagedFilesystem');
const ManagedFileUpload = $injector.get('ManagedFileUpload');
const ManagedShareLink = $injector.get('ManagedShareLink');
// Required services
var $document = $injector.get('$document');
var $q = $injector.get('$q');
var $rootScope = $injector.get('$rootScope');
var $window = $injector.get('$window');
var activeConnectionService = $injector.get('activeConnectionService');
var authenticationService = $injector.get('authenticationService');
var clipboardService = $injector.get('clipboardService');
var connectionGroupService = $injector.get('connectionGroupService');
var connectionService = $injector.get('connectionService');
var preferenceService = $injector.get('preferenceService');
var requestService = $injector.get('requestService');
var tunnelService = $injector.get('tunnelService');
var guacAudio = $injector.get('guacAudio');
var guacHistory = $injector.get('guacHistory');
var guacImage = $injector.get('guacImage');
var guacVideo = $injector.get('guacVideo');
const $document = $injector.get('$document');
const $q = $injector.get('$q');
const $rootScope = $injector.get('$rootScope');
const $window = $injector.get('$window');
const activeConnectionService = $injector.get('activeConnectionService');
const authenticationService = $injector.get('authenticationService');
const clipboardService = $injector.get('clipboardService');
const connectionGroupService = $injector.get('connectionGroupService');
const connectionService = $injector.get('connectionService');
const preferenceService = $injector.get('preferenceService');
const requestService = $injector.get('requestService');
const tunnelService = $injector.get('tunnelService');
const guacAudio = $injector.get('guacAudio');
const guacHistory = $injector.get('guacHistory');
const guacImage = $injector.get('guacImage');
const guacVideo = $injector.get('guacVideo');
/**
* The minimum amount of time to wait between updates to the client
@@ -253,18 +253,18 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
* A promise which resolves with the string of connection parameters to
* be passed to the Guacamole client, once the string is ready.
*/
var getConnectString = function getConnectString(identifier, width, height) {
const getConnectString = function getConnectString(identifier, width, height) {
var deferred = $q.defer();
const deferred = $q.defer();
// Calculate optimal width/height for display
var pixel_density = $window.devicePixelRatio || 1;
var optimal_dpi = pixel_density * 96;
var optimal_width = width * pixel_density;
var optimal_height = height * pixel_density;
const pixel_density = $window.devicePixelRatio || 1;
const optimal_dpi = pixel_density * 96;
const optimal_width = width * pixel_density;
const optimal_height = height * pixel_density;
// Build base connect string
var connectString =
let connectString =
"token=" + encodeURIComponent(authenticationService.getCurrentToken())
+ "&GUAC_DATA_SOURCE=" + encodeURIComponent(identifier.dataSource)
+ "&GUAC_ID=" + encodeURIComponent(identifier.id)
@@ -676,7 +676,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
return;
// Parse connection details from ID
var clientIdentifier = ClientIdentifier.fromString(managedClient.id);
const clientIdentifier = ClientIdentifier.fromString(managedClient.id);
// Connect the Guacamole client
getConnectString(clientIdentifier, width, height)

View File

@@ -33,7 +33,7 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
* The object whose properties should be copied within the new
* ManagedClientGroup.
*/
var ManagedClientGroup = function ManagedClientGroup(template) {
const ManagedClientGroup = function ManagedClientGroup(template) {
// Use empty object by default
template = template || {};
@@ -97,7 +97,7 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
*/
ManagedClientGroup.recalculateTiles = function recalculateTiles(group) {
var recalculated = new ManagedClientGroup({
const recalculated = new ManagedClientGroup({
clients : group.clients
});
@@ -222,7 +222,7 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
// Generate a name from ONLY the focused clients, unless there are no
// focused clients
var relevantClients = _.filter(group.clients, client => client.clientProperties.focused);
let relevantClients = _.filter(group.clients, client => client.clientProperties.focused);
if (!relevantClients.length)
relevantClients = group.clients;
@@ -262,9 +262,9 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
* ManagedClientGroup.
*/
ManagedClientGroup.forEach = function forEach(group, callback) {
var current = 0;
for (var row = 0; row < group.rows; row++) {
for (var column = 0; column < group.columns; column++) {
let current = 0;
for (let row = 0; row < group.rows; row++) {
for (let column = 0; column < group.columns; column++) {
callback(group.clients[current], row, column, current);
current++;
@@ -312,22 +312,22 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
*/
ManagedClientGroup.getClientGrid = function getClientGrid(group) {
var index = 0;
let index = 0;
// Operate on cached copy of grid
var clientGrid = group._grid || (group._grid = []);
const clientGrid = group._grid || (group._grid = []);
// Delete any rows in excess of the required size
clientGrid.splice(group.rows);
for (var row = 0; row < group.rows; row++) {
for (let row = 0; row < group.rows; row++) {
// Prefer to use existing column arrays, deleting any columns in
// excess of the required size
var currentRow = clientGrid[row] || (clientGrid[row] = []);
const currentRow = clientGrid[row] || (clientGrid[row] = []);
currentRow.splice(group.columns);
for (var column = 0; column < group.columns; column++) {
for (let column = 0; column < group.columns; column++) {
currentRow[column] = group.clients[index++] || null;
}

View File

@@ -27,10 +27,10 @@ angular.module('clipboard').directive('guacClipboard', ['$injector',
function guacClipboard($injector) {
// Required types
var ClipboardData = $injector.get('ClipboardData');
const ClipboardData = $injector.get('ClipboardData');
// Required services
var clipboardService = $injector.get('clipboardService');
const clipboardService = $injector.get('clipboardService');
/**
* Configuration object for the guacClipboard directive.
@@ -78,7 +78,7 @@ angular.module('clipboard').directive('guacClipboard', ['$injector',
* The ClipboardData to display within the clipboard editor for
* editing.
*/
var updateClipboardEditor = function updateClipboardEditor(data) {
const updateClipboardEditor = function updateClipboardEditor(data) {
// If the clipboard data is a string, render it as text
if (typeof data.data === 'string')

View File

@@ -26,13 +26,13 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
function clipboardService($injector) {
// Get required services
var $q = $injector.get('$q');
var $window = $injector.get('$window');
var $rootScope = $injector.get('$rootScope');
var sessionStorageFactory = $injector.get('sessionStorageFactory');
const $q = $injector.get('$q');
const $window = $injector.get('$window');
const $rootScope = $injector.get('$rootScope');
const sessionStorageFactory = $injector.get('sessionStorageFactory');
// Required types
var ClipboardData = $injector.get('ClipboardData');
const ClipboardData = $injector.get('ClipboardData');
/**
* Getter/setter which retrieves or sets the current stored clipboard
@@ -42,7 +42,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
*
* @type Function
*/
var storedClipboardData = sessionStorageFactory.create(new ClipboardData());
const storedClipboardData = sessionStorageFactory.create(new ClipboardData());
var service = {};
@@ -189,7 +189,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
* A promise that will resolve if setting the clipboard was successful,
* and will reject if it failed.
*/
var setLocalClipboard = function setLocalClipboard(data) {
const setLocalClipboard = function setLocalClipboard(data) {
var deferred = $q.defer();
@@ -437,7 +437,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
* if getting the clipboard was successful, and will reject if it
* failed.
*/
var getLocalClipboard = function getLocalClipboard() {
const getLocalClipboard = function getLocalClipboard() {
// If the clipboard is already being read, do not overlap the read
// attempts; instead share the result across all requests

View File

@@ -48,21 +48,21 @@ angular.module('element').directive('guacClick', [function guacClick() {
*
* @type guacClick~callback
*/
var guacClick = $scope.$eval($attrs.guacClick);
const guacClick = $scope.$eval($attrs.guacClick);
/**
* The element which will register the click.
*
* @type Element
*/
var element = $element[0];
const element = $element[0];
/**
* Whether either Shift key is currently pressed.
*
* @type boolean
*/
var shift = false;
let shift = false;
/**
* Whether either Ctrl key is currently pressed. To allow the
@@ -71,7 +71,7 @@ angular.module('element').directive('guacClick', [function guacClick() {
*
* @type boolean
*/
var ctrl = false;
let ctrl = false;
/**
* Updates the state of the {@link shift} and {@link ctrl} flags
@@ -81,7 +81,7 @@ angular.module('element').directive('guacClick', [function guacClick() {
* @param {Guacamole.Keyboard} keyboard
* The Guacamole.Keyboard instance to read key states from.
*/
var updateModifiers = function updateModifiers(keyboard) {
const updateModifiers = function updateModifiers(keyboard) {
shift = !!(
keyboard.pressed[0xFFE1] // Left shift

View File

@@ -24,12 +24,12 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
function indexController($scope, $injector) {
// Required services
var $document = $injector.get('$document');
var $route = $injector.get('$route');
var $window = $injector.get('$window');
var clipboardService = $injector.get('clipboardService');
var guacNotification = $injector.get('guacNotification');
var guacClientManager = $injector.get('guacClientManager');
const $document = $injector.get('$document');
const $route = $injector.get('$route');
const $window = $injector.get('$window');
const clipboardService = $injector.get('clipboardService');
const guacNotification = $injector.get('guacNotification');
const guacClientManager = $injector.get('guacClientManager');
/**
* The error that prevents the current page from rendering at all. If no