mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-44: Expose tunnel UUID to JavaScript. Document allowed internal use of the empty opcode.
This commit is contained in:
		| @@ -124,10 +124,6 @@ public class TunnelRESTService { | ||||
|         GuacamoleSession session = authenticationService.getGuacamoleSession(authToken); | ||||
|         Map<String, StreamInterceptingTunnel> tunnels = session.getTunnels(); | ||||
|  | ||||
|         // STUB: For sake of testing, if only one tunnel exists, use that | ||||
|         if (tunnels.size() == 1) | ||||
|             tunnelUUID = tunnels.keySet().iterator().next(); | ||||
|  | ||||
|         // Pull tunnel with given UUID | ||||
|         final StreamInterceptingTunnel tunnel = tunnels.get(tunnelUUID); | ||||
|         if (tunnel == null) | ||||
|   | ||||
| @@ -30,6 +30,7 @@ import org.eclipse.jetty.websocket.WebSocket.Connection; | ||||
| import org.eclipse.jetty.websocket.WebSocketServlet; | ||||
| import org.apache.guacamole.GuacamoleClientException; | ||||
| import org.apache.guacamole.GuacamoleConnectionClosedException; | ||||
| import org.apache.guacamole.protocol.GuacamoleInstruction; | ||||
| import org.apache.guacamole.tunnel.http.HTTPTunnelRequest; | ||||
| import org.apache.guacamole.tunnel.TunnelRequest; | ||||
| import org.apache.guacamole.protocol.GuacamoleStatus; | ||||
| @@ -136,6 +137,12 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet { | ||||
|  | ||||
|                         try { | ||||
|  | ||||
|                             // Send tunnel UUID | ||||
|                             connection.sendMessage(new GuacamoleInstruction( | ||||
|                                 GuacamoleTunnel.INTERNAL_DATA_OPCODE, | ||||
|                                 tunnel.getUUID().toString() | ||||
|                             ).toString()); | ||||
|  | ||||
|                             try { | ||||
|  | ||||
|                                 // Attempt to read | ||||
|   | ||||
| @@ -30,6 +30,7 @@ import org.apache.guacamole.GuacamoleException; | ||||
| import org.apache.guacamole.io.GuacamoleReader; | ||||
| import org.apache.guacamole.io.GuacamoleWriter; | ||||
| import org.apache.guacamole.net.GuacamoleTunnel; | ||||
| import org.apache.guacamole.protocol.GuacamoleInstruction; | ||||
| import org.apache.guacamole.protocol.GuacamoleStatus; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| @@ -127,6 +128,12 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe | ||||
|  | ||||
|                 try { | ||||
|  | ||||
|                     // Send tunnel UUID | ||||
|                     remote.sendString(new GuacamoleInstruction( | ||||
|                         GuacamoleTunnel.INTERNAL_DATA_OPCODE, | ||||
|                         tunnel.getUUID().toString() | ||||
|                     ).toString()); | ||||
|  | ||||
|                     try { | ||||
|  | ||||
|                         // Attempt to read | ||||
|   | ||||
| @@ -35,6 +35,7 @@ import org.apache.catalina.websocket.WebSocketServlet; | ||||
| import org.apache.catalina.websocket.WsOutbound; | ||||
| import org.apache.guacamole.GuacamoleClientException; | ||||
| import org.apache.guacamole.GuacamoleConnectionClosedException; | ||||
| import org.apache.guacamole.protocol.GuacamoleInstruction; | ||||
| import org.apache.guacamole.tunnel.http.HTTPTunnelRequest; | ||||
| import org.apache.guacamole.tunnel.TunnelRequest; | ||||
| import org.apache.guacamole.protocol.GuacamoleStatus; | ||||
| @@ -164,6 +165,12 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet { | ||||
|  | ||||
|                         try { | ||||
|  | ||||
|                             // Send tunnel UUID | ||||
|                             outbound.writeTextMessage(CharBuffer.wrap(new GuacamoleInstruction( | ||||
|                                 GuacamoleTunnel.INTERNAL_DATA_OPCODE, | ||||
|                                 tunnel.getUUID().toString() | ||||
|                             ).toString())); | ||||
|  | ||||
|                             try { | ||||
|  | ||||
|                                 // Attempt to read | ||||
|   | ||||
		Reference in New Issue
	
	Block a user