diff --git a/app.js b/app.js index aa86f18..72c953f 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,7 @@ // LinuxServer Guacamole Client //// Application Variables //// +var baseurl = process.env.SUBFOLDER || '/'; var crypto = require('crypto'); var ejs = require('ejs'); var express = require('express'); @@ -23,7 +24,7 @@ var clientOptions = { } }; // Spinup the Guac websocket proxy on port 3000 if guacd is running -var guacServer = new GuacamoleLite({server: http,path:'/guaclite'},{host:'127.0.0.1',port:4822},clientOptions); +var guacServer = new GuacamoleLite({server: http,path:baseurl +'guaclite'},{host:'127.0.0.1',port:4822},clientOptions); // Function needed to encrypt the token string for guacamole connections var encrypt = (value) => { var iv = crypto.randomBytes(16); @@ -71,7 +72,7 @@ app.get("/", function (req, res) { } }); } - res.render(__dirname + '/rdp.ejs', {token : connectionstring}); + res.render(__dirname + '/rdp.ejs', {token : connectionstring, baseurl: baseurl}); }); //// Web File Browser //// app.use(bodyParser.urlencoded({ extended: true })); diff --git a/public/js/rdp.js b/public/js/rdp.js index b51de13..6bd32d2 100644 --- a/public/js/rdp.js +++ b/public/js/rdp.js @@ -57,8 +57,9 @@ $('#nav-trigger').change(function () { var display = document.getElementById("display"); // Instantiate client, using an HTTP tunnel for communications. var connectionstring = $('#connectionstring').val(); +var baseurl = $('#baseurl').val(); var guac = new Guacamole.Client( - new Guacamole.WebSocketTunnel(wsprotocol + '//' + host + ':' + port + '/guaclite?token=' + connectionstring + '&width=' + $(document).width() + '&height=' + $(document).height()) + new Guacamole.WebSocketTunnel(wsprotocol + '//' + host + ':' + port + baseurl + 'guaclite?token=' + connectionstring + '&width=' + $(document).width() + '&height=' + $(document).height()) ); // Show current client clipboard guac.onclipboard = function clientClipboardReceived(stream, mimetype) { diff --git a/rdp.ejs b/rdp.ejs index 8626a95..8f2ce97 100644 --- a/rdp.ejs +++ b/rdp.ejs @@ -6,25 +6,25 @@ Guacamole Client - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + @@ -72,16 +72,17 @@
- + + - + - - - - + + + + - +