2018-01-22 13:01:38 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
2019-01-22 10:54:03 +01:00
|
|
|
/* global angular:false */
|
|
|
|
|
/* global $:false */
|
|
|
|
|
|
2018-01-22 13:01:38 -08:00
|
|
|
angular.module('Application').controller('SupportController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
|
2022-10-04 10:24:48 +02:00
|
|
|
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastOwner) $location.path('/'); });
|
2018-05-01 11:44:47 -07:00
|
|
|
|
2021-10-19 15:14:52 +02:00
|
|
|
$scope.ready = false;
|
2018-01-22 13:01:38 -08:00
|
|
|
$scope.config = Client.getConfig();
|
|
|
|
|
$scope.user = Client.getUserInfo();
|
|
|
|
|
|
2021-10-07 17:16:27 +02:00
|
|
|
$scope.toggleSshSupportError = '';
|
2018-01-22 13:01:38 -08:00
|
|
|
$scope.sshSupportEnabled = false;
|
|
|
|
|
|
|
|
|
|
$scope.toggleSshSupport = function () {
|
2021-10-07 17:16:27 +02:00
|
|
|
$scope.toggleSshSupportError = '';
|
|
|
|
|
|
2018-12-19 13:22:27 -08:00
|
|
|
Client.enableRemoteSupport(!$scope.sshSupportEnabled, function (error) {
|
2021-10-07 17:16:27 +02:00
|
|
|
if (error) {
|
|
|
|
|
if (error.statusCode === 412 || error.statusCode === 417) $scope.toggleSshSupportError = error.message;
|
|
|
|
|
else console.error(error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-12-19 13:22:27 -08:00
|
|
|
|
|
|
|
|
$scope.sshSupportEnabled = !$scope.sshSupportEnabled;
|
|
|
|
|
});
|
2018-01-22 13:01:38 -08:00
|
|
|
};
|
|
|
|
|
|
2021-10-19 15:14:52 +02:00
|
|
|
Client.onReady(function () {
|
2023-12-03 16:28:25 +01:00
|
|
|
Client.getRemoteSupport(function (error, enabled) {
|
2019-10-18 18:23:49 -07:00
|
|
|
if (error) return console.error(error);
|
|
|
|
|
|
2023-12-03 16:28:25 +01:00
|
|
|
$scope.sshSupportEnabled = enabled;
|
|
|
|
|
|
2024-07-12 14:25:11 +02:00
|
|
|
$scope.ready = true;
|
2018-01-22 13:01:38 -08:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.modal-backdrop').remove();
|
|
|
|
|
}]);
|