From bae405d082f8c8ff9d7f5989a15824e1e27ad002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sat, 29 Jun 2019 17:24:53 +0200 Subject: [PATCH] fixes --- server/src/uds/plugins/__init__.py | 4 +--- server/src/uds/transports/RDP/RDPFile.py | 3 +++ server/src/uds/web/util/configjs.py | 12 ++++++------ server/src/uds/web/util/errors.py | 11 +++++------ server/src/uds/web/views/modern.py | 10 +++------- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/server/src/uds/plugins/__init__.py b/server/src/uds/plugins/__init__.py index 9d8ea6dc..62c8d83f 100644 --- a/server/src/uds/plugins/__init__.py +++ b/server/src/uds/plugins/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2012 Virtual Cable S.L. +# Copyright (c) 2012-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -27,8 +27,6 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import unicode_literals - import logging logger = logging.getLogger(__name__) diff --git a/server/src/uds/transports/RDP/RDPFile.py b/server/src/uds/transports/RDP/RDPFile.py index 79b602fc..c6923ba5 100644 --- a/server/src/uds/transports/RDP/RDPFile.py +++ b/server/src/uds/transports/RDP/RDPFile.py @@ -333,6 +333,9 @@ class RDPFile(object): # DirectX? res += 'redirectdirectx:i:1\n' + # Camera? + # res += 'camerastoredirect:s:*\n' + return res def getMacOsX(self): diff --git a/server/src/uds/web/util/configjs.py b/server/src/uds/web/util/configjs.py index 84065b08..971e9977 100644 --- a/server/src/uds/web/util/configjs.py +++ b/server/src/uds/web/util/configjs.py @@ -116,9 +116,9 @@ def udsJs(request): 'user': reverse('page.index'), 'customAuth': reverse('uds.web.views.customAuth', kwargs={'idAuth': ''}), 'services': reverse('webapi.services'), - 'enabler': reverse('webapi.enabler', kwargs={ 'idService': 'param1', 'idTransport': 'param2' }), - 'action': reverse('webapi.action', kwargs={ 'idService': 'param1', 'action': 'param2' }), - 'galleryImage': reverse('webapi.galleryImage', kwargs={ 'idImage': 'param1' }), + 'enabler': reverse('webapi.enabler', kwargs={'idService': 'param1', 'idTransport': 'param2'}), + 'action': reverse('webapi.action', kwargs={'idService': 'param1', 'action': 'param2'}), + 'galleryImage': reverse('webapi.galleryImage', kwargs={'idImage': 'param1'}), 'transportIcon': reverse('webapi.transportIcon', kwargs={'idTrans': 'param1'}), 'static': static(''), # Launcher URL if exists @@ -145,7 +145,7 @@ def udsJs(request): if profile['role'] == 'staff': # Add staff things # If is admin (informational, REST api checks users privileges anyway...) - profile['admin'] = True; + profile['admin'] = True # REST auth config['auth_token'] = request.session.session_key config['auth_header'] = AUTH_TOKEN_HEADER @@ -159,6 +159,7 @@ def udsJs(request): if 'errors' in request.session: errors = request.session['errors'] del request.session['errors'] + request.session.modified = True # Ensure saves it uds = { 'profile': profile, @@ -170,7 +171,6 @@ def udsJs(request): } # Reset some 1 time values... - request.session['launch'] = ''; + request.session['launch'] = '' return 'var udsData = ' + json.dumps(uds) + ';\n' - diff --git a/server/src/uds/web/util/errors.py b/server/src/uds/web/util/errors.py index 52914946..698de912 100644 --- a/server/src/uds/web/util/errors.py +++ b/server/src/uds/web/util/errors.py @@ -30,7 +30,8 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import traceback +import logging from django.utils.translation import ugettext_lazy as _ from django.shortcuts import render @@ -41,8 +42,6 @@ from django.urls import reverse from uds.core.util import encoders from uds.models import DeployedService, Transport, UserService, Authenticator -import traceback -import logging logger = logging.getLogger(__name__) @@ -96,10 +95,10 @@ def errorString(errorId): return strings[0] -def errorView(request, error): - idError = int(error) +def errorView(request, errorCode): + idError = int(errorCode) code = (error >> 8) & 0xFF - idError = idError & 0xFF; + idError = idError & 0xFF errStr = errorString(idError) if code != 0: diff --git a/server/src/uds/web/views/modern.py b/server/src/uds/web/views/modern.py index b26cf576..c7150b6c 100644 --- a/server/src/uds/web/views/modern.py +++ b/server/src/uds/web/views/modern.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2018 Virtual Cable S.L. +# Copyright (c) 2018-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -29,10 +29,9 @@ @author: Adolfo Gómez, dkmaster at dkmon dot com """ import logging -import json from django.shortcuts import render -from django.http import HttpResponse +from django.http import HttpResponse, JsonResponse from django.urls import reverse from uds.web.util.errors import errorView from uds.core.auths.auth import ( @@ -103,7 +102,4 @@ def js(request): @denyNonAuthenticated def servicesData(request): - data = getServicesData(request) - - return HttpResponse(content=json.dumps(data), content_type='application/json') - + return JsonResponse(getServicesData(request))