forked from shaba/openuds
Changed the mechanics for launching an external url
This commit is contained in:
parent
bbc211ac8c
commit
fc188b5b9c
@ -277,14 +277,20 @@ class Transports(DetailHandler):
|
||||
"""
|
||||
|
||||
def getItems(self, parent: models.ServicePool, item: typing.Optional[str]):
|
||||
def getType(trans):
|
||||
try:
|
||||
return self.typeAsDict(trans.getType())
|
||||
except Exception: # No type found
|
||||
return None
|
||||
|
||||
return [{
|
||||
'id': i.uuid,
|
||||
'name': i.name,
|
||||
'type': self.typeAsDict(i.getType()),
|
||||
'type': getType(i),
|
||||
'comments': i.comments,
|
||||
'priority': i.priority,
|
||||
'trans_type': _(i.getType().name()),
|
||||
} for i in parent.transports.all()]
|
||||
} for i in parent.transports.all() if getType(i)]
|
||||
|
||||
def getTitle(self, parent: models.ServicePool) -> str:
|
||||
return _('Assigned transports')
|
||||
@ -380,7 +386,6 @@ class Publications(DetailHandler):
|
||||
'prefix': 'row-state-'
|
||||
}
|
||||
|
||||
|
||||
class Changelog(DetailHandler):
|
||||
"""
|
||||
Processes the transports detail requests of a Service Pool
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +1,12 @@
|
||||
// "Fake" javascript file for translations
|
||||
// Typescript
|
||||
gettext("Launching service");
|
||||
gettext("Please wait");
|
||||
gettext("Remember that you will need the USD client on your platform to access the service");
|
||||
gettext("Error launching service");
|
||||
gettext("seconds");
|
||||
gettext("Warning");
|
||||
gettext("Service is in maintenance and cannot be executed");
|
||||
gettext("Errors found");
|
||||
gettext("Invalid error string");
|
||||
gettext("We use cookies to track usage and preferences");
|
||||
gettext("I Understand");
|
||||
gettext("Learn more");
|
||||
gettext("Service is in maintenance");
|
||||
gettext("This service is currently not accessible due to schedule restrictions.");
|
||||
gettext("Launcher");
|
||||
@ -15,14 +17,51 @@ gettext("Reset service: ");
|
||||
gettext("Service released");
|
||||
gettext("Service reseted");
|
||||
gettext("Are you sure?");
|
||||
gettext("Errors found");
|
||||
gettext("Warning");
|
||||
gettext("Service is in maintenance and cannot be executed");
|
||||
gettext("Invalid error string");
|
||||
gettext("We use cookies to track usage and preferences");
|
||||
gettext("I Understand");
|
||||
gettext("Learn more");
|
||||
gettext("seconds");
|
||||
gettext("Launching service");
|
||||
gettext("Please wait");
|
||||
gettext("Remember that you will need the USD client on your platform to access the service");
|
||||
gettext("Error launching service");
|
||||
gettext("Please wait");
|
||||
gettext("Your connection is being prepared. It will open on a new window when ready.");
|
||||
gettext("The service is now being prepared. (It is at #).'.replace('#', '' + data.running + '%");
|
||||
gettext("Please, tray again in a few moments.");
|
||||
gettext("Error launching service");
|
||||
// HTML
|
||||
gettext("You can access UDS Open Source code at");
|
||||
gettext("UDS has been developed using these components:");
|
||||
gettext("If you find that we missed any component, please let us know");
|
||||
gettext("UDS Client");
|
||||
gettext("Download UDS client for your platform");
|
||||
gettext("Legacy clients are only provided for old operating system support. Try to avoid them.");
|
||||
gettext("Username");
|
||||
gettext("Password");
|
||||
gettext("Authenticator");
|
||||
gettext("Login");
|
||||
gettext("Downloads");
|
||||
gettext("Always download the UDS actor matching your platform");
|
||||
gettext("Legacy actors are only provided for old operating system support. Try to avoid them.");
|
||||
gettext("An error has occurred");
|
||||
gettext("Return");
|
||||
gettext("UDS Service launcher");
|
||||
gettext("The service you have requested is being launched.");
|
||||
gettext("Please, note that reloading this page will not work.");
|
||||
gettext("To relaunch service, you will have to do it from origin.");
|
||||
gettext("If the service does not launchs automatically, probably you dont have the UDS Client installed");
|
||||
gettext("You can obtain it from the");
|
||||
gettext("UDS Client download page");
|
||||
gettext("Release service");
|
||||
gettext("Reset service");
|
||||
gettext("Connections");
|
||||
gettext("Actions");
|
||||
gettext("Information");
|
||||
gettext("Client IP");
|
||||
gettext("Client IP");
|
||||
gettext("Detected proxy ip");
|
||||
gettext("Transports");
|
||||
gettext("UDS transports for this client");
|
||||
gettext("Networks");
|
||||
gettext("UDS networks for this IP");
|
||||
gettext("Close");
|
||||
gettext("Yes");
|
||||
gettext("No");
|
||||
@ -33,37 +72,3 @@ gettext("UDS Client");
|
||||
gettext("About");
|
||||
gettext("UDS Client");
|
||||
gettext("About");
|
||||
gettext("Information");
|
||||
gettext("Client IP");
|
||||
gettext("Client IP");
|
||||
gettext("Detected proxy ip");
|
||||
gettext("Transports");
|
||||
gettext("UDS transports for this client");
|
||||
gettext("Networks");
|
||||
gettext("UDS networks for this IP");
|
||||
gettext("Release service");
|
||||
gettext("Reset service");
|
||||
gettext("Connections");
|
||||
gettext("Actions");
|
||||
gettext("Username");
|
||||
gettext("Password");
|
||||
gettext("Authenticator");
|
||||
gettext("Login");
|
||||
gettext("UDS Client");
|
||||
gettext("Download UDS client for your platform");
|
||||
gettext("Legacy clients are only provided for old operating system support. Try to avoid them.");
|
||||
gettext("You can access UDS Open Source code at");
|
||||
gettext("UDS has been developed using these components:");
|
||||
gettext("If you find that we missed any component, please let us know");
|
||||
gettext("UDS Service launcher");
|
||||
gettext("The service you have requested is being launched.");
|
||||
gettext("Please, note that reloading this page will not work.");
|
||||
gettext("To relaunch service, you will have to do it from origin.");
|
||||
gettext("If the service does not launchs automatically, probably you dont have the UDS Client installed");
|
||||
gettext("You can obtain it from the");
|
||||
gettext("UDS Client download page");
|
||||
gettext("Downloads");
|
||||
gettext("Always download the UDS actor matching your platform");
|
||||
gettext("Legacy actors are only provided for old operating system support. Try to avoid them.");
|
||||
gettext("An error has occurred");
|
||||
gettext("Return");
|
||||
|
@ -258,11 +258,12 @@ class HTML5RDPTransport(transports.Transport):
|
||||
|
||||
ticket = models.TicketStore.create(params, validity=self.ticketValidity.num())
|
||||
|
||||
return HttpResponseRedirect(
|
||||
onw = 'o_n_w={};'.format(hash(transport.name)) if self.forceNewWindow.isTrue() else ''
|
||||
return str(
|
||||
"{}/transport/?{}.{}&{}".format(
|
||||
self.guacamoleServer.value,
|
||||
ticket,
|
||||
scrambler,
|
||||
'javascript:window.close();' + ('o_n_w=0;' if self.forceNewWindow.isTrue() else '')
|
||||
'javascript:window.close();' + onw
|
||||
)
|
||||
)
|
||||
|
@ -185,7 +185,8 @@ class HTML5VNCTransport(transports.Transport):
|
||||
scrambler = cryptoManager().randomString(32)
|
||||
ticket = models.TicketStore.create(params, validity=self.ticketValidity.num())
|
||||
|
||||
return HttpResponseRedirect(
|
||||
onw = 'o_n_w={};'.format(hash(transport.name)) if self.forceNewWindow.isTrue() else ''
|
||||
return str(
|
||||
"{}/transport/?{}.{}&{}".format(
|
||||
self.guacamoleServer.value,
|
||||
ticket,
|
||||
|
@ -110,9 +110,10 @@ class URLCustomTransport(transports.Transport):
|
||||
.replace('_USERNAME_', username)
|
||||
)
|
||||
|
||||
return HttpResponseRedirect(
|
||||
onw = '&o_n_w={};'.format(hash(transport.name)) if self.forceNewWindow.isTrue() else ''
|
||||
return str(
|
||||
"{}{}".format(
|
||||
url,
|
||||
'&o_n_w=0;' if self.forceNewWindow.isTrue() else ''
|
||||
onw
|
||||
)
|
||||
)
|
||||
|
@ -57,17 +57,29 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@webLoginRequired(admin=False)
|
||||
def transportOwnLink(request: 'HttpRequest', idService: str, idTransport: str):
|
||||
response: typing.MutableMapping[str, typing.Any] = {}
|
||||
try:
|
||||
res = userServiceManager().getService(request.user, request.os, request.ip, idService, idTransport)
|
||||
ip, userService, iads, trans, itrans = res # pylint: disable=unused-variable
|
||||
# This returns a response object in fact
|
||||
if itrans and ip:
|
||||
return itrans.getLink(userService, trans, ip, request.os, request.user, webPassword(request), request)
|
||||
response = {
|
||||
'url': itrans.getLink(userService, trans, ip, request.os, request.user, webPassword(request), request)
|
||||
}
|
||||
except ServiceNotReadyError as e:
|
||||
return errors.exceptionView(request, e)
|
||||
response = {
|
||||
'running': e.code * 25
|
||||
}
|
||||
except Exception as e:
|
||||
logger.exception("Exception")
|
||||
return errors.exceptionView(request, e)
|
||||
response = {
|
||||
'error': str(e)
|
||||
}
|
||||
|
||||
return HttpResponse(
|
||||
content=json.dumps(response),
|
||||
content_type='application/json'
|
||||
)
|
||||
|
||||
# Will never reach this
|
||||
return errors.errorView(request, errors.UNKNOWN_ERROR)
|
||||
|
Loading…
Reference in New Issue
Block a user