Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #397 from MicrosoftDX/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
etiennemargraff authored Feb 15, 2017
2 parents c3539de + 7be5ab5 commit 11f9474
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 30 deletions.
14 changes: 5 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": [
Expand All @@ -54,6 +47,7 @@
{
"name": "Launch node.js sample",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/client samples/nodejs/app.js",
"stopOnEntry": false,
"args": [
Expand All @@ -66,6 +60,7 @@
{
"name": "Launch botbuilder sample",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/client samples/botbuilder/index.js",
"stopOnEntry": false,
"args": [
Expand All @@ -78,6 +73,7 @@
{
"name": "Launch ContosoFlowers sample",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/client samples/contosoflowers/app.js",
"stopOnEntry": false,
"args": [
Expand Down
1 change: 1 addition & 0 deletions Plugins/Vorlon/plugins/botFrameworkInspector/control.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ body {
height: 100%;
overflow: hidden;
flex-grow: 5;
max-width: 50%;
}

.scroll {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -114,7 +117,7 @@ module VORLON {
callback();
};

script.src = url;
script.src = vorlonBaseURL + url;
document.getElementsByTagName("head")[0].appendChild(script);
}

Expand Down
10 changes: 7 additions & 3 deletions Plugins/Vorlon/vorlon.clientMessenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions Plugins/Vorlon/vorlon.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 16 additions & 7 deletions Server/Scripts/vorlon.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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');
Expand All @@ -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);
});
Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions Server/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down Expand Up @@ -143,7 +143,7 @@
"name": "Modernizr",
"panel": "bottom",
"foldername": "modernizrReport",
"enabled": false
"enabled": true
},
{
"id": "DOMTIMELINE",
Expand Down
4 changes: 2 additions & 2 deletions Server/config/vorlon.baseurlconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
7 changes: 6 additions & 1 deletion Server/public/vorlon.dashboardManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ 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
.pipe(sourcemaps.write({
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('.'));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vorlon",
"version": "0.5.0",
"version": "0.5.4",
"description": "vorlon",
"main": "Server/server.js",
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions whatsnew.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 11f9474

Please sign in to comment.