Skip to content

Commit

Permalink
Add vorlon.autostartdisabled.js and vorlon.max.autostartdisabled.js
Browse files Browse the repository at this point in the history
  • Loading branch information
meulta committed May 7, 2015
1 parent 734242e commit 72522ec
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Server/Scripts/vorlon.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,30 @@ export module VORLON {
app.get("/vorlon.js/:idsession",(req: any, res: any) => {
this._sendVorlonJSFile("../public/vorlon/vorlon.js", req, res);
});

app.get("/vorlon.max.autostartdisabled.js/",(req: any, res: any) => {
this._sendVorlonJSFile("../public/vorlon/vorlon.max.js", req, res, false);
});

app.get("/vorlon.autostartdisabled.js/",(req: any, res: any) => {
this._sendVorlonJSFile("../public/vorlon/vorlon.js", req, res, false);
});

//DisplayLogs
winstonDisplay(app, this._log);
}

private _sendVorlonJSFile(filepath:string, req: any, res: any){
private _sendVorlonJSFile(filepath:string, req: any, res: any, autostart:boolean = true){
//Read Socket.io file
var javascriptFile: string;
fs.readFile(path.join(__dirname, "../public/javascripts/socket.io-1.3.5.js"),(err, data) => {
if (err) {
this._log.error("ROUTE : Error reading JS File");
return;
}

javascriptFile = data.toString();

//Read Vorlon.js one file
fs.readFile(path.join(__dirname, filepath),(err, data) => {
if (err) {
Expand All @@ -176,7 +186,11 @@ export module VORLON {
var vorlonpluginfiles: string = data.toString();
vorlonpluginfiles = vorlonpluginfiles.replace('"vorlon/plugins"', '"http://' + req.headers.host + '/vorlon/plugins"');
javascriptFile += "\r" + vorlonpluginfiles;
javascriptFile += "\r (function() { VORLON.Core.Start('http://" + req.headers.host + "/', '" + req.params.idsession + "'); }());";

if(autostart){
javascriptFile += "\r (function() { VORLON.Core.Start('http://" + req.headers.host + "/', '" + req.params.idsession + "'); }());";
}

res.header('Content-Type', 'application/javascript');
res.send(javascriptFile);
});
Expand Down

1 comment on commit 72522ec

@meulta
Copy link
Contributor Author

@meulta meulta commented on 72522ec May 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix #43

Please sign in to comment.