diff --git a/.vscode/launch.json b/.vscode/launch.json index 3bddf9dd..850e1972 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,6 +7,7 @@ // Name of configuration; appears in the launch configuration drop down menu. "name": "Launch Server/server.js", // Type of configuration. Possible values: "node", "mono". + "request": "launch", "type": "node", // Workspace relative or absolute path to the program. "program": "${workspaceRoot}/Server/server.js", @@ -29,19 +30,11 @@ // If JavaScript source maps are enabled, the generated code is expected in this directory. "outDir": null }, - { - "name": "Attach", - "type": "node", - // TCP/IP address. Default is "localhost". - "address": "localhost", - // Port to attach to. - "port": 5858, - "sourceMaps": false - }, { // not working since latest vs code and electron versions :-( "name": "Launch desktop App", "type": "node", + "request": "launch", "program": "${workspaceRoot}/desktop/app/background.js", "stopOnEntry": false, "args": [ @@ -54,6 +47,7 @@ { "name": "Launch node.js sample", "type": "node", + "request": "launch", "program": "${workspaceRoot}/client samples/nodejs/app.js", "stopOnEntry": false, "args": [ @@ -66,6 +60,7 @@ { "name": "Launch botbuilder sample", "type": "node", + "request": "launch", "program": "${workspaceRoot}/client samples/botbuilder/index.js", "stopOnEntry": false, "args": [ @@ -78,6 +73,7 @@ { "name": "Launch ContosoFlowers sample", "type": "node", + "request": "launch", "program": "${workspaceRoot}/client samples/contosoflowers/app.js", "stopOnEntry": false, "args": [ diff --git a/Plugins/Vorlon/plugins/botFrameworkInspector/control.css b/Plugins/Vorlon/plugins/botFrameworkInspector/control.css index cce198e8..c9fb0c5b 100644 --- a/Plugins/Vorlon/plugins/botFrameworkInspector/control.css +++ b/Plugins/Vorlon/plugins/botFrameworkInspector/control.css @@ -189,6 +189,7 @@ body { height: 100%; overflow: hidden; flex-grow: 5; + max-width: 50%; } .scroll { diff --git a/Plugins/Vorlon/plugins/botFrameworkInspector/vorlon.botFrameworkInspector.dashboard.ts b/Plugins/Vorlon/plugins/botFrameworkInspector/vorlon.botFrameworkInspector.dashboard.ts index 2332b20a..3bc2d9f6 100644 --- a/Plugins/Vorlon/plugins/botFrameworkInspector/vorlon.botFrameworkInspector.dashboard.ts +++ b/Plugins/Vorlon/plugins/botFrameworkInspector/vorlon.botFrameworkInspector.dashboard.ts @@ -3,7 +3,10 @@ declare var cytoscape: any; module VORLON { + declare var vorlonBaseURL: string; + export class BotFrameworkInspectorDashboard extends DashboardPlugin { + constructor() { super("botFrameworkInspector", "control.html", "control.css"); this._ready = false; @@ -114,7 +117,7 @@ module VORLON { callback(); }; - script.src = url; + script.src = vorlonBaseURL + url; document.getElementsByTagName("head")[0].appendChild(script); } diff --git a/Plugins/Vorlon/vorlon.clientMessenger.ts b/Plugins/Vorlon/vorlon.clientMessenger.ts index 22ea19b4..14028e6c 100644 --- a/Plugins/Vorlon/vorlon.clientMessenger.ts +++ b/Plugins/Vorlon/vorlon.clientMessenger.ts @@ -53,19 +53,23 @@ Core._listenClientId = listenClientId; this._serverUrl = serverUrl; + var options = { + "path": serverUrl.replace(/h.*:\/\/[^\/]*/, "") + "/socket.io" + } + switch (side) { case RuntimeSide.Client: - this._socket = io.connect(serverUrl); + this._socket = io.connect(serverUrl + "/client", options); this._isConnected = true; break; case RuntimeSide.Dashboard: - this._socket = io.connect(serverUrl + "/dashboard"); + this._socket = io.connect(serverUrl + "/dashboard", options); this._isConnected = true; break; } if (this.isConnected) { - var manager = io.Manager(serverUrl); + var manager = io.Manager(serverUrl, options); manager.on('connect_error',(err) => { if (this.onError) { this.onError(err); diff --git a/Plugins/Vorlon/vorlon.core.ts b/Plugins/Vorlon/vorlon.core.ts index fb2a17f9..99370489 100644 --- a/Plugins/Vorlon/vorlon.core.ts +++ b/Plugins/Vorlon/vorlon.core.ts @@ -48,6 +48,10 @@ Core._side = RuntimeSide.Client; Core._sessionID = sessionId; Core._listenClientId = listenClientId; + + if(serverUrl[serverUrl.length-1] === '/'){ + serverUrl = serverUrl.slice(0, -1); + } if(serverUrl.match("$https://")){ Core._isHttpsEnabled = true; diff --git a/Server/Scripts/vorlon.server.ts b/Server/Scripts/vorlon.server.ts index 93664ff8..6c704c76 100644 --- a/Server/Scripts/vorlon.server.ts +++ b/Server/Scripts/vorlon.server.ts @@ -79,7 +79,7 @@ export module VORLON { }); app.get(this.baseURLConfig.baseURL + "/vorlon.max.js/", (req: any, res: any) => { - res.redirect("/vorlon.max.js/default"); + res.redirect(this.baseURLConfig.baseURL + "/vorlon.max.js/default"); }); app.get(this.baseURLConfig.baseURL + "/vorlon.max.js/:idsession", (req: any, res: any) => { @@ -284,8 +284,14 @@ export module VORLON { javascriptFile += "if (((typeof window != 'undefined' && window.module) || (typeof module != 'undefined')) && typeof module.exports != 'undefined') {\r\n"; javascriptFile += "module.exports = VORLON;};\r\n"; + var startUrl = this.httpConfig.protocol + "://" + req.headers.host; + if(baseUrl) { + var splittedBaseUrl = baseUrl.split('//'); + startUrl = splittedBaseUrl[splittedBaseUrl.length - 1] === this.httpConfig.protocol ? baseUrl : startUrl + baseUrl; + } + if (autostart) { - javascriptFile += "\r (function() { VORLON.Core.StartClientSide('" + this.httpConfig.protocol + "://" + req.headers.host + "/', '" + req.params.idsession + "'); }());"; + javascriptFile += "\r (function() { VORLON.Core.StartClientSide('" + startUrl + "/', '" + req.params.idsession + "'); }());"; } res.header('Content-Type', 'application/javascript'); @@ -295,18 +301,21 @@ export module VORLON { } public start(httpServer: http.Server): void { + //SOCKET.IO - var io = socketio(httpServer); + var io = socketio(httpServer, { path: this.baseURLConfig.baseURL + "/socket.io" }); this._io = io; //Listen on / - io.on("connection", socket => { + this._io + .of(this.baseURLConfig.baseURL + "/client") + .on("connection", socket => { this.addClient(socket); }); //Listen on /dashboard - var dashboardio = io - .of("/dashboard") + this._io + .of(this.baseURLConfig.baseURL + "/dashboard") .on("connection", socket => { this.addDashboard(socket); }); @@ -420,7 +429,7 @@ export module VORLON { this._sessions.all().forEach((session) => { for (var clientid in session.connectedClients) { var client = session.connectedClients[clientid]; - if ("/#" + receiveMessage.data.socketid === client.socket.id) { + if (this.baseURLConfig.baseURL + "/client#" + receiveMessage.data.socketid === client.socket.id) { client.opened = false; if (this.dashboards[session.sessionId]) { this._log.debug(formatLog("PLUGIN", "Send RemoveClient to Dashboard " + socket.id, receiveMessage)); diff --git a/Server/config.json b/Server/config.json index ac162a12..386f3429 100644 --- a/Server/config.json +++ b/Server/config.json @@ -7,11 +7,11 @@ "activateAuth": false, "username": "", "password": "", - "host": "localhost", + "host": "0.0.0.0", "port": 1337, "enableWebproxy": true, "baseProxyURL": "", - "proxyHost": "localhost", + "proxyHost": "0.0.0.0", "proxyPort": 5050, "proxyEnvPort": false, "vorlonServerURL": "", @@ -143,7 +143,7 @@ "name": "Modernizr", "panel": "bottom", "foldername": "modernizrReport", - "enabled": false + "enabled": true }, { "id": "DOMTIMELINE", diff --git a/Server/config/vorlon.baseurlconfig.ts b/Server/config/vorlon.baseurlconfig.ts index 6ff2f27e..69eb0dcf 100644 --- a/Server/config/vorlon.baseurlconfig.ts +++ b/Server/config/vorlon.baseurlconfig.ts @@ -13,14 +13,14 @@ export module VORLON { var catalogstring = catalogdata.toString().replace(/^\uFEFF/, ''); var catalog = JSON.parse(catalogstring); if (catalog.baseURL != undefined) { - this.baseURL = catalog.baseURL; + this.baseURL = process.env.BASE_URL || catalog.baseURL; } else { this.baseURL = ""; } if (catalog.baseProxyURL != undefined) { - this.baseProxyURL = catalog.baseProxyURL; + this.baseProxyURL = process.env.BASE_PROXY_URL || catalog.baseProxyURL; } else { this.baseProxyURL = ""; diff --git a/Server/public/vorlon.dashboardManager.ts b/Server/public/vorlon.dashboardManager.ts index 2476f9c6..35db9dc9 100644 --- a/Server/public/vorlon.dashboardManager.ts +++ b/Server/public/vorlon.dashboardManager.ts @@ -18,18 +18,23 @@ module VORLON { DashboardManager.SessionId = sessionid; DashboardManager.PluginsLoaded = false; DashboardManager.DisplayingClient = false; + DashboardManager.vorlonBaseURL = vorlonBaseURL; //Client ID DashboardManager.ListenClientid = listenClientid; DashboardManager.ClientList = {}; DashboardManager.StartListeningServer() DashboardManager.GetClients(); DashboardManager.CatalogUrl = vorlonBaseURL + "/getplugins/" + sessionid; - DashboardManager.vorlonBaseURL = vorlonBaseURL; } public static StartListeningServer(clientid: string = ""): void{ var getUrl = window.location; var baseUrl = getUrl.protocol + "//" + getUrl.host; + + if(DashboardManager.vorlonBaseURL) { + baseUrl = DashboardManager.vorlonBaseURL.split('//')[0] === getUrl.protocol ? DashboardManager.vorlonBaseURL : baseUrl + DashboardManager.vorlonBaseURL; + } + VORLON.Core.StopListening(); VORLON.Core.StartDashboardSide(baseUrl, DashboardManager.SessionId, clientid, DashboardManager.divMapper); if(!VORLON.Core.Messenger.onAddClient && !VORLON.Core.Messenger.onAddClient){ diff --git a/gulpfile.js b/gulpfile.js index fc3b4f46..f7dc7006 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -320,7 +320,7 @@ gulp.task('webserver', function() { gulp.task('typescript-to-js-server', function() { var tsResult = gulp.src(['./Server/**/*.ts', '!./Server/node_modules', '!./Server/node_modules/**'], { base: './' }) - .pipe(sourcemaps.init()) + // .pipe(sourcemaps.init()) .pipe(typescript({ noExternalResolve: true, target: 'ES5', module: 'commonjs' })); return tsResult.js @@ -328,8 +328,8 @@ gulp.task('typescript-to-js-server', function() { includeContent: false, // Return relative source map root directories per file. sourceRoot: function (file) { - var sourceFile = path.join(file.cwd, file.sourceMap.file); - return path.relative(path.dirname(sourceFile), file.cwd); + // var sourceFile = path.join(file.cwd, file.sourceMap.file); + // return path.relative(path.dirname(sourceFile), file.cwd); } })) .pipe(gulp.dest('.')); diff --git a/package.json b/package.json index c3714aa0..cb24c618 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vorlon", - "version": "0.5.0", + "version": "0.5.4", "description": "vorlon", "main": "Server/server.js", "dependencies": { diff --git a/whatsnew.md b/whatsnew.md index 50d6bca6..2b58ade2 100644 --- a/whatsnew.md +++ b/whatsnew.md @@ -1,3 +1,11 @@ +## 0.5.4 +- Plugins + - Bot Framework Inspector + - Fixes on UI +- Vorlon behind proxy + - Fixing Socket.io when Vorlon.js is behind a proxy and BaseUrl is configured + + ## 0.5.0 - Plugins - Bot Framework Inspector