simplify websocket configuration even more

pull/1/head
ansuz 5 years ago
parent 67cde69120
commit 97bc793ca8

@ -166,7 +166,7 @@ app.get('/api/config', function(req, res){
},
removeDonateButton: (config.removeDonateButton === true),
allowSubscriptions: (config.allowSubscriptions === true),
websocketPath: config.useExternalWebsocket ? undefined : config.websocketPath,
websocketPath: config.websocketPath,
httpUnsafeOrigin: config.httpUnsafeOrigin.replace(/^\s*/, ''),
adminEmail: config.adminEmail,
adminKeys: admins,
@ -234,7 +234,13 @@ var nt = nThen(function (w) {
log = config.log = _log;
}));
}).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) {
config.store = _store;
}));
@ -264,7 +270,6 @@ var nt = nThen(function (w) {
rpc = _rpc;
}));
}).nThen(function () {
if (config.useExternalWebsocket) { return; }
var HK = require('./historyKeeper.js');
var hkConfig = {
tasks: config.tasks,
@ -275,7 +280,6 @@ var nt = nThen(function (w) {
};
historyKeeper = HK.create(hkConfig);
}).nThen(function () {
if (config.useExternalWebsocket) { return; }
var wsSrv = new WebSocketServer(wsConfig);
NetfluxSrv.run(wsSrv, config, historyKeeper);
});

@ -4,7 +4,7 @@ define([
var Config = {};
Config.getWebsocketURL = function (origin) {
var path = ApiConfig.websocketPath;
var path = ApiConfig.websocketPath || '/cryptpad_websocket';
if (/^ws{1,2}:\/\//.test(path)) { return path; }
var l = window.location;

Loading…
Cancel
Save