diff --git a/guacamole-tunnel/pom.xml b/guacamole-tunnel/pom.xml index 7a245c7c..02e3b139 100644 --- a/guacamole-tunnel/pom.xml +++ b/guacamole-tunnel/pom.xml @@ -4,10 +4,10 @@ http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - net.sourceforge.guacamole + org.openuds.server transport war - 1.2.0 + 1.2.1 Guacamole Transport http://openuds.org/ @@ -36,7 +36,7 @@ - net.sourceforge.guacamole + org.glyptodon.guacamole guacamole-common-js zip @@ -60,16 +60,17 @@ - net.sourceforge.guacamole + org.glyptodon.guacamole guacamole-common 0.8.0 + compile - net.sourceforge.guacamole + org.glyptodon.guacamole guacamole-common-js - 0.7.2 + 0.7.4 zip runtime @@ -77,13 +78,4 @@ - - - - guac-dev - http://guac-dev.org/repo - - - - diff --git a/guacamole-tunnel/src/main/java/org/openuds/guacamole/TunnelServlet.java b/guacamole-tunnel/src/main/java/org/openuds/guacamole/TunnelServlet.java index 91559420..015a37df 100644 --- a/guacamole-tunnel/src/main/java/org/openuds/guacamole/TunnelServlet.java +++ b/guacamole-tunnel/src/main/java/org/openuds/guacamole/TunnelServlet.java @@ -3,12 +3,14 @@ package org.openuds.guacamole; import java.io.BufferedReader; import java.io.FileReader; import java.net.URL; +import java.util.Arrays; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import net.sourceforge.guacamole.GuacamoleException; import net.sourceforge.guacamole.net.GuacamoleSocket; import net.sourceforge.guacamole.net.GuacamoleTunnel; @@ -69,7 +71,6 @@ public class TunnelServlet if( data == null || width == null || height == null) throw new GuacamoleException("Can't read required parameters"); - Hashtable params = Util.readParameters( getConfigValue(UDS) + UDS_PATH + data); if( params == null ) { @@ -82,6 +83,16 @@ public class TunnelServlet GuacamoleClientInformation info = new GuacamoleClientInformation(); info.setOptimalScreenWidth(Integer.parseInt(width)); info.setOptimalScreenHeight(Integer.parseInt(height)); + + // Add audio mimetypes + String[] audio_mimetypes = request.getParameterValues("audio"); + if (audio_mimetypes != null) + info.getAudioMimetypes().addAll(Arrays.asList(audio_mimetypes)); + + // Add video mimetypes + String[] video_mimetypes = request.getParameterValues("video"); + if (video_mimetypes != null) + info.getVideoMimetypes().addAll(Arrays.asList(video_mimetypes)); // Create our configuration GuacamoleConfiguration config = new GuacamoleConfiguration(); diff --git a/guacamole-tunnel/src/main/webapp/index.xhtml b/guacamole-tunnel/src/main/webapp/index.xhtml index 2bd3617a..57718a30 100644 --- a/guacamole-tunnel/src/main/webapp/index.xhtml +++ b/guacamole-tunnel/src/main/webapp/index.xhtml @@ -44,6 +44,109 @@ + @@ -80,10 +183,21 @@ // Get display div from document var display = document.getElementById("display"); + var tunnel; + + // If WebSocket available, try to use it. + if (window.WebSocket) + tunnel = new Guacamole.ChainedTunnel( + new Guacamole.WebSocketTunnel("websocket-tunnel"), + new Guacamole.HTTPTunnel("tunnel") + ); + + // If no WebSocket, then use HTTP. + else + tunnel = new Guacamole.HTTPTunnel("tunnel") + // Instantiate client, using an HTTP tunnel for communications. - var guac = new Guacamole.Client( - new Guacamole.HTTPTunnel("tunnel") - ); + var guac = new Guacamole.Client(tunnel); // Add client to display div @@ -115,6 +229,15 @@ // the sake of authentication. var connect_string = "data=" + data + "&width=" + optimal_width + "&height=" + optimal_height; + // Add audio mimetypes to connect_string + GuacAudio.supported.forEach(function(mimetype) { + connect_string += "&audio=" + encodeURIComponent(mimetype); + }); + + // Add video mimetypes to connect_string + GuacVideo.supported.forEach(function(mimetype) { + connect_string += "&video=" + encodeURIComponent(mimetype); + }); display.appendChild(inner); guac.connect(connect_string);