simplify websocket configuration even more
This commit is contained in:
parent
67cde69120
commit
97bc793ca8
12
server.js
12
server.js
@ -166,7 +166,7 @@ app.get('/api/config', function(req, res){
|
|||||||
},
|
},
|
||||||
removeDonateButton: (config.removeDonateButton === true),
|
removeDonateButton: (config.removeDonateButton === true),
|
||||||
allowSubscriptions: (config.allowSubscriptions === true),
|
allowSubscriptions: (config.allowSubscriptions === true),
|
||||||
websocketPath: config.useExternalWebsocket ? undefined : config.websocketPath,
|
websocketPath: config.websocketPath,
|
||||||
httpUnsafeOrigin: config.httpUnsafeOrigin.replace(/^\s*/, ''),
|
httpUnsafeOrigin: config.httpUnsafeOrigin.replace(/^\s*/, ''),
|
||||||
adminEmail: config.adminEmail,
|
adminEmail: config.adminEmail,
|
||||||
adminKeys: admins,
|
adminKeys: admins,
|
||||||
@ -234,7 +234,13 @@ var nt = nThen(function (w) {
|
|||||||
log = config.log = _log;
|
log = config.log = _log;
|
||||||
}));
|
}));
|
||||||
}).nThen(function (w) {
|
}).nThen(function (w) {
|
||||||
if (config.useExternalWebsocket) { return; }
|
if (config.useExternalWebsocket) {
|
||||||
|
// if you plan to use an external websocket server
|
||||||
|
// then you don't need to load any API services other than the logger.
|
||||||
|
// Just abort.
|
||||||
|
w.abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Storage.create(config, w(function (_store) {
|
Storage.create(config, w(function (_store) {
|
||||||
config.store = _store;
|
config.store = _store;
|
||||||
}));
|
}));
|
||||||
@ -264,7 +270,6 @@ var nt = nThen(function (w) {
|
|||||||
rpc = _rpc;
|
rpc = _rpc;
|
||||||
}));
|
}));
|
||||||
}).nThen(function () {
|
}).nThen(function () {
|
||||||
if (config.useExternalWebsocket) { return; }
|
|
||||||
var HK = require('./historyKeeper.js');
|
var HK = require('./historyKeeper.js');
|
||||||
var hkConfig = {
|
var hkConfig = {
|
||||||
tasks: config.tasks,
|
tasks: config.tasks,
|
||||||
@ -275,7 +280,6 @@ var nt = nThen(function (w) {
|
|||||||
};
|
};
|
||||||
historyKeeper = HK.create(hkConfig);
|
historyKeeper = HK.create(hkConfig);
|
||||||
}).nThen(function () {
|
}).nThen(function () {
|
||||||
if (config.useExternalWebsocket) { return; }
|
|
||||||
var wsSrv = new WebSocketServer(wsConfig);
|
var wsSrv = new WebSocketServer(wsConfig);
|
||||||
NetfluxSrv.run(wsSrv, config, historyKeeper);
|
NetfluxSrv.run(wsSrv, config, historyKeeper);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,7 +4,7 @@ define([
|
|||||||
var Config = {};
|
var Config = {};
|
||||||
|
|
||||||
Config.getWebsocketURL = function (origin) {
|
Config.getWebsocketURL = function (origin) {
|
||||||
var path = ApiConfig.websocketPath;
|
var path = ApiConfig.websocketPath || '/cryptpad_websocket';
|
||||||
if (/^ws{1,2}:\/\//.test(path)) { return path; }
|
if (/^ws{1,2}:\/\//.test(path)) { return path; }
|
||||||
|
|
||||||
var l = window.location;
|
var l = window.location;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user