1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #1529 from btsimonh/websocketsnonadmin

Fix WebSockets not working when httpAdminRoot false
This commit is contained in:
Nick O'Leary 2018-01-24 11:00:48 +00:00 committed by GitHub
commit 14efd0b2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -69,13 +69,21 @@ module.exports = {
runtime.init(userSettings,api); runtime.init(userSettings,api);
api.init(httpServer,runtime); api.init(httpServer,runtime);
apiEnabled = true; apiEnabled = true;
server = runtime.adminApi.server;
runtime.server = runtime.adminApi.server;
} else { } else {
runtime.init(userSettings); runtime.init(userSettings);
apiEnabled = false; apiEnabled = false;
if (httpServer){
server = httpServer;
runtime.server = httpServer;
} else {
server = runtime.adminApi.server;
runtime.server = runtime.adminApi.server; // useless at this point, but at least harmless.
}
} }
adminApp = runtime.adminApi.adminApp; adminApp = runtime.adminApi.adminApp;
nodeApp = runtime.nodeApp; nodeApp = runtime.nodeApp;
server = runtime.adminApi.server;
return; return;
}, },
start: function() { start: function() {

View File

@ -84,7 +84,7 @@ function createNodeApi(node) {
red.auth = runtime.adminApi.auth; red.auth = runtime.adminApi.auth;
red.httpAdmin = runtime.adminApi.adminApp; red.httpAdmin = runtime.adminApi.adminApp;
red.httpNode = runtime.nodeApp; red.httpNode = runtime.nodeApp;
red.server = runtime.adminApi.server; red.server = runtime.server;
} else { } else {
//TODO: runtime.adminApi is always stubbed if not enabled, so this block //TODO: runtime.adminApi is always stubbed if not enabled, so this block
// is unused - but may be needed for the unit tests // is unused - but may be needed for the unit tests