forked from shaba/openuds
Updated to allow audio redirection, and newer build methods.
This commit is contained in:
parent
7e8fa876fa
commit
bf47f40939
@ -4,10 +4,10 @@
|
|||||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>net.sourceforge.guacamole</groupId>
|
<groupId>org.openuds.server</groupId>
|
||||||
<artifactId>transport</artifactId>
|
<artifactId>transport</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>1.2.0</version>
|
<version>1.2.1</version>
|
||||||
<name>Guacamole Transport</name>
|
<name>Guacamole Transport</name>
|
||||||
<url>http://openuds.org/</url>
|
<url>http://openuds.org/</url>
|
||||||
|
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<overlays>
|
<overlays>
|
||||||
<overlay>
|
<overlay>
|
||||||
<groupId>net.sourceforge.guacamole</groupId>
|
<groupId>org.glyptodon.guacamole</groupId>
|
||||||
<artifactId>guacamole-common-js</artifactId>
|
<artifactId>guacamole-common-js</artifactId>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
</overlay>
|
</overlay>
|
||||||
@ -60,16 +60,17 @@
|
|||||||
|
|
||||||
<!-- Main Guacamole library -->
|
<!-- Main Guacamole library -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sourceforge.guacamole</groupId>
|
<groupId>org.glyptodon.guacamole</groupId>
|
||||||
<artifactId>guacamole-common</artifactId>
|
<artifactId>guacamole-common</artifactId>
|
||||||
<version>0.8.0</version>
|
<version>0.8.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Guacamole JavaScript library -->
|
<!-- Guacamole JavaScript library -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sourceforge.guacamole</groupId>
|
<groupId>org.glyptodon.guacamole</groupId>
|
||||||
<artifactId>guacamole-common-js</artifactId>
|
<artifactId>guacamole-common-js</artifactId>
|
||||||
<version>0.7.2</version>
|
<version>0.7.4</version>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -77,13 +78,4 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<!-- Main Guacamole repository -->
|
|
||||||
<repository>
|
|
||||||
<id>guac-dev</id>
|
|
||||||
<url>http://guac-dev.org/repo</url>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -3,12 +3,14 @@ package org.openuds.guacamole;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import net.sourceforge.guacamole.GuacamoleException;
|
import net.sourceforge.guacamole.GuacamoleException;
|
||||||
import net.sourceforge.guacamole.net.GuacamoleSocket;
|
import net.sourceforge.guacamole.net.GuacamoleSocket;
|
||||||
import net.sourceforge.guacamole.net.GuacamoleTunnel;
|
import net.sourceforge.guacamole.net.GuacamoleTunnel;
|
||||||
@ -69,7 +71,6 @@ public class TunnelServlet
|
|||||||
if( data == null || width == null || height == null)
|
if( data == null || width == null || height == null)
|
||||||
throw new GuacamoleException("Can't read required parameters");
|
throw new GuacamoleException("Can't read required parameters");
|
||||||
|
|
||||||
|
|
||||||
Hashtable<String,String> params = Util.readParameters( getConfigValue(UDS) + UDS_PATH + data);
|
Hashtable<String,String> params = Util.readParameters( getConfigValue(UDS) + UDS_PATH + data);
|
||||||
|
|
||||||
if( params == null ) {
|
if( params == null ) {
|
||||||
@ -82,6 +83,16 @@ public class TunnelServlet
|
|||||||
GuacamoleClientInformation info = new GuacamoleClientInformation();
|
GuacamoleClientInformation info = new GuacamoleClientInformation();
|
||||||
info.setOptimalScreenWidth(Integer.parseInt(width));
|
info.setOptimalScreenWidth(Integer.parseInt(width));
|
||||||
info.setOptimalScreenHeight(Integer.parseInt(height));
|
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
|
// Create our configuration
|
||||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||||
|
@ -44,6 +44,109 @@
|
|||||||
<script type="text/javascript" src="guacamole-common-js/audio.js"></script>
|
<script type="text/javascript" src="guacamole-common-js/audio.js"></script>
|
||||||
<script type="text/javascript" src="guacamole-common-js/guacamole.js"></script>
|
<script type="text/javascript" src="guacamole-common-js/guacamole.js"></script>
|
||||||
<script type="text/javascript" src="guacamole-common-js/oskeyboard.js"></script>
|
<script type="text/javascript" src="guacamole-common-js/oskeyboard.js"></script>
|
||||||
|
<script type="text/javascript"> /* <![CDATA[ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get Audio supported items
|
||||||
|
*/
|
||||||
|
GuacAudio = new (function() {
|
||||||
|
|
||||||
|
var codecs = [
|
||||||
|
'audio/ogg; codecs="vorbis"',
|
||||||
|
'audio/mp4; codecs="mp4a.40.5"',
|
||||||
|
'audio/mpeg; codecs="mp3"',
|
||||||
|
'audio/webm; codecs="vorbis"',
|
||||||
|
'audio/wav; codecs=1'
|
||||||
|
];
|
||||||
|
|
||||||
|
var probably_supported = [];
|
||||||
|
var maybe_supported = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of all supported audio mimetypes, ordered by liklihood of
|
||||||
|
* working.
|
||||||
|
*/
|
||||||
|
this.supported = [];
|
||||||
|
|
||||||
|
// Build array of supported audio formats
|
||||||
|
codecs.forEach(function(mimetype) {
|
||||||
|
|
||||||
|
var audio = new Audio();
|
||||||
|
var support_level = audio.canPlayType(mimetype);
|
||||||
|
|
||||||
|
// Trim semicolon and trailer
|
||||||
|
var semicolon = mimetype.indexOf(";");
|
||||||
|
if (semicolon != -1)
|
||||||
|
mimetype = mimetype.substring(0, semicolon);
|
||||||
|
|
||||||
|
// Partition by probably/maybe
|
||||||
|
if (support_level == "probably")
|
||||||
|
probably_supported.push(mimetype);
|
||||||
|
else if (support_level == "maybe")
|
||||||
|
maybe_supported.push(mimetype);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add probably supported types first
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
this.supported, probably_supported);
|
||||||
|
|
||||||
|
// Prioritize "maybe" supported types second
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
this.supported, maybe_supported);
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
GuacVideo = new (function() {
|
||||||
|
|
||||||
|
var codecs = [
|
||||||
|
'video/ogg; codecs="theora, vorbis"',
|
||||||
|
'video/mp4; codecs="avc1.4D401E, mp4a.40.5"',
|
||||||
|
'video/webm; codecs="vp8.0, vorbis"'
|
||||||
|
];
|
||||||
|
|
||||||
|
var probably_supported = [];
|
||||||
|
var maybe_supported = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of all supported video mimetypes, ordered by liklihood of
|
||||||
|
* working.
|
||||||
|
*/
|
||||||
|
this.supported = [];
|
||||||
|
|
||||||
|
// Build array of supported audio formats
|
||||||
|
codecs.forEach(function(mimetype) {
|
||||||
|
|
||||||
|
var video = document.createElement("video");
|
||||||
|
var support_level = video.canPlayType(mimetype);
|
||||||
|
|
||||||
|
// Trim semicolon and trailer
|
||||||
|
var semicolon = mimetype.indexOf(";");
|
||||||
|
if (semicolon != -1)
|
||||||
|
mimetype = mimetype.substring(0, semicolon);
|
||||||
|
|
||||||
|
// Partition by probably/maybe
|
||||||
|
if (support_level == "probably")
|
||||||
|
probably_supported.push(mimetype);
|
||||||
|
else if (support_level == "maybe")
|
||||||
|
maybe_supported.push(mimetype);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add probably supported types first
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
this.supported, probably_supported);
|
||||||
|
|
||||||
|
// Prioritize "maybe" supported types second
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
this.supported, maybe_supported);
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
/* ]]> */
|
||||||
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -80,10 +183,21 @@
|
|||||||
// Get display div from document
|
// Get display div from document
|
||||||
var display = document.getElementById("display");
|
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.
|
// Instantiate client, using an HTTP tunnel for communications.
|
||||||
var guac = new Guacamole.Client(
|
var guac = new Guacamole.Client(tunnel);
|
||||||
new Guacamole.HTTPTunnel("tunnel")
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Add client to display div
|
// Add client to display div
|
||||||
@ -115,6 +229,15 @@
|
|||||||
// the sake of authentication.
|
// the sake of authentication.
|
||||||
var connect_string = "data=" + data + "&width=" + optimal_width + "&height=" + optimal_height;
|
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);
|
display.appendChild(inner);
|
||||||
|
|
||||||
guac.connect(connect_string);
|
guac.connect(connect_string);
|
||||||
|
Loading…
Reference in New Issue
Block a user