1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

* Added support for Android OS

* Updated HTML5 part a bit
* Added printing support for guacamole
This commit is contained in:
Adolfo Gómez 2013-11-05 22:00:12 +00:00
parent 66d56dc6e5
commit aba57d8400
8 changed files with 69 additions and 48 deletions

View File

@ -38,9 +38,10 @@ logger = logging.getLogger(__name__)
Linux = 'Linux' Linux = 'Linux'
Windows = 'Windows' Windows = 'Windows'
Macintosh = 'Macintosh' Macintosh = 'Macintosh'
Android = 'Android'
knownOss = { 'Linux' : Linux, 'Windows' : Windows, 'Macintosh' : Macintosh } knownOss = { 'Linux' : Linux, 'Windows' : Windows, 'Macintosh' : Macintosh, 'Android': Android }
def getOsFromUA(ua): def getOsFromUA(ua):
''' '''
@ -54,6 +55,7 @@ def getOsFromUA(ua):
break break
except Exception: except Exception:
pass pass
logger.debug(res) logger.debug('User-Agent: {0}'.format(ua))
logger.debug('Detected OS: {0}'.format(res))
return res return res

View File

@ -1,9 +1,12 @@
@CHARSET "UTF-8"; @CHARSET "UTF-8";
html, body {
height: 100%;
}
body { body {
padding-top: 60px; padding-top: 60px;
padding-bottom: 40px; padding-bottom: 40px;
background-color: #ffffff;
} }
@media (max-width: 979px) { @media (max-width: 979px) {
@ -14,6 +17,7 @@ body {
footer { footer {
display: none;
padding:1.6% 2%; padding:1.6% 2%;
margin-top:4em; margin-top:4em;
text-align:right; text-align:right;
@ -85,13 +89,9 @@ footer {
} }
.profile-img .profile-img
{ {
font-size: 96px;
width: 96px; width: 96px;
height: 96px; height: 96px;
margin: 0 auto 10px; margin: 0 auto 10px;
display: block; display: block;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -1,33 +1,35 @@
{% extends "uds/html5/internal_page.html" %} {% extends "uds/html5/internal_page.html" %}
{% load i18n static html5 %} {% load i18n static html5 %}
{% block css %}
<style>
.testing {
width: 95px;
height: 95px;
margin-bottom: 16px;
margin-left: 16px;
background: rgb(255,255,255); /* Old browsers */
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(229,229,229,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(229,229,229,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); /* IE6-9 */
overflow: hidden;
}
</style>
{% endblock %}
{% block js %} {% block js %}
<script> <script>
function squarifyMe(element) {
squareItUp();
window.onresize = function(element) {
squareItUp();
}
function squareItUp() {
$(element).height($(element).width());
}
}
$(function() { $(function() {
squarifyMe('.square');
{% if not java %} {% if not java %}
$('#jmessage').dialog({
autoOpen: false,
width: 500,
buttons: {
"Ok": function() {
$(this).dialog("close");
}
}
});
$("a.nojava").click( function() { $("a.nojava").click( function() {
$('#jmessage').dialog('open'); $('#no-java-dialog').modal({
keyboard: false
})
return false; return false;
}); });
@ -38,16 +40,14 @@
{% block body %} {% block body %}
<h2>{% trans "Services" %}</h2> <h2>{% trans "Services" %}</h2>
<ul> <div class="clearfix">
<div class="row"> {% for ser in services %}
{% for ser in services %}
{% if forloop.counter0|divisibleby:2 == 1 %}
</div><div class="row">
{% endif %}
{% if ser.transports %} {% if ser.transports %}
{% with trans=ser.transports|first %} {% with trans=ser.transports|first %}
<div class="col-sm-6 col-md-4"> {% if forloop.counter0 > 0 %}
<div class="thumbnail"> {% endif %}
<div class="pull-left">
<div class="thumbnail testing">
<a class="{% if not java and trans.needsJava %} nojava{% endif %}" href="{% url "uds.web.views.service" idService=ser.id idTransport=trans.id %}"> <a class="{% if not java and trans.needsJava %} nojava{% endif %}" href="{% url "uds.web.views.service" idService=ser.id idTransport=trans.id %}">
<img src="{% url "uds.web.views.transportIcon" idTrans=trans.id %}" class="" alt="{{ ser.name }}" /> <img src="{% url "uds.web.views.transportIcon" idTrans=trans.id %}" class="" alt="{{ ser.name }}" />
<div class="caption">{{ ser.name }}</div> <div class="caption">{{ ser.name }}</div>
@ -64,10 +64,23 @@
</div> </div>
{% if not java %} {% if not java %}
<div id="jmessage" title="{% trans "Java not found" %}"> <div class="modal fade" id="no-java-dialog">
<p>{% trans "Java is not available on your browser, and the selected transport needs it." %}</p> <div class="modal-dialog">
<p>{% trans "Please, install latest version from" %} <a href="http://www.java.com">{% trans "Java website" %}</a> {% trans "and restart browser" %}</p> <div class="modal-content">
</div> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{% trans "Java not found" %}</h4>
</div>
<div class="modal-body">
<p>{% trans "Java is not available on your browser, and the selected transport needs it." %}</p>
<p>{% trans "Please, install latest version from" %} <a href="http://www.java.com" target="_blank">{% trans "Java website" %}</a> {% trans "and restart browser" %}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endif %} {% endif %}
{% if user.isStaff %} {% if user.isStaff %}

View File

@ -69,10 +69,10 @@
{% block body %} {% block body %}
<div class="container"> <div class="container">
<div class="row" id="login"> <div class="row" id="login">
<div class="col-sm-6 col-md-4 col-md-offset-4"> <div class="col-md-4 col-md-offset-4">
<h1 class="text-center login-title">{% trans 'Welcome to UDS' %}</h1> <h1 class="text-center login-title">{% trans 'Welcome to UDS' %}</h1>
<div class="account-wall"> <div class="account-wall">
<span class="fa fa-user profile-img text-info"></span> <img class="profile-img" src="{% get_static_prefix %}img/login-img.png" alt="">
<form id="loginform" class="form-signin" name="loginform" method="post"> <form id="loginform" class="form-signin" name="loginform" method="post">
{% if form.errors %} {% if form.errors %}
<div class="alert alert-dismissable alert-danger"> <div class="alert alert-dismissable alert-danger">

View File

@ -39,6 +39,7 @@ from uds.core.util.Cache import Cache
from uds.core.util import net from uds.core.util import net
from uds.core.transports.BaseTransport import Transport from uds.core.transports.BaseTransport import Transport
from uds.core.util import connection from uds.core.util import connection
from uds.core.util import OsDetector
import logging import logging
@ -56,6 +57,7 @@ class HTML5RDPTransport(Transport):
typeDescription = _('RDP Transport using HTML5 client') typeDescription = _('RDP Transport using HTML5 client')
iconFile = 'rdp.png' iconFile = 'rdp.png'
needsJava = False # If this transport needs java for rendering needsJava = False # If this transport needs java for rendering
supportedOss = [OsDetector.Linux, OsDetector.Windows, OsDetector.Macintosh, OsDetector.Android]
guacamoleServer = gui.TextField(label=_('Tunnel Server'), order = 1, tooltip = _('Host of the tunnel server (use http/https & port if needed) as accesible from users'), defvalue = 'https://', length = 64) guacamoleServer = gui.TextField(label=_('Tunnel Server'), order = 1, tooltip = _('Host of the tunnel server (use http/https & port if needed) as accesible from users'), defvalue = 'https://', length = 64)
useEmptyCreds = gui.CheckBoxField(label = _('Empty creds'), order = 2, tooltip = _('If checked, the credentials used to connect will be emtpy')) useEmptyCreds = gui.CheckBoxField(label = _('Empty creds'), order = 2, tooltip = _('If checked, the credentials used to connect will be emtpy'))
@ -122,7 +124,7 @@ class HTML5RDPTransport(Transport):
# Build params dict # Build params dict
params = { 'protocol':'rdp', params = { 'protocol':'rdp',
'hostname':ip, 'username': username, 'password': password, 'hostname':ip, 'username': username, 'password': password,
'ignore-cert': 'true', 'ignore-cert': 'true', 'enable-printing': 'true'
} }
if self.enableAudio.isTrue() is False: if self.enableAudio.isTrue() is False:

View File

@ -47,11 +47,11 @@ class CustomSelect(forms.Select):
visible = 'style="display: none;"' visible = 'style="display: none;"'
else: else:
visible = ''; visible = '';
res = '<select id="id_{0}" name="{0}" class="form-control"{1}>'.format(name, visible) res = '<select id="id_{0}" name="{0}" class="form-control">'.format(name)
for choice in self.choices: for choice in self.choices:
res += '<option value="{0}">{1}</option>'.format(choice[0], choice[1]) res += '<option value="{0}">{1}</option>'.format(choice[0], choice[1])
res += '</select>' res += '</select>'
return mark_safe('<div class="form-group"><label>' + unicode(_('authenticator')) + '</label>' + res + '</div>') return mark_safe('<div class="form-group"{0}><label>'.format(visible) + unicode(_('authenticator')) + '</label>' + res + '</div>')
class BaseForm(forms.Form): class BaseForm(forms.Form):

View File

@ -161,6 +161,8 @@ def index(request):
# Information for administrators # Information for administrators
nets = '' nets = ''
validTrans = '' validTrans = ''
logger.debug('OS: {0}'.format(os['OS']))
if request.user.isStaff(): if request.user.isStaff():
nets = ','.join( [ n.name for n in Network.networksFor(request.ip) ]) nets = ','.join( [ n.name for n in Network.networksFor(request.ip) ])
@ -205,10 +207,12 @@ def index(request):
) )
return render_to_response(theme.template('index.html'), response = render_to_response(theme.template('index.html'),
{'services' : services, 'java' : java, 'ip' : request.ip, 'nets' : nets, {'services' : services, 'java' : java, 'ip' : request.ip, 'nets' : nets,
'transports' : validTrans }, 'transports' : validTrans },
context_instance=RequestContext(request)) context_instance=RequestContext(request))
return response
@webLoginRequired @webLoginRequired
def prefs(request): def prefs(request):