|
|
@ -63,8 +63,8 @@ app.get('/api/config', function(req, res){
|
|
|
|
res.send('define(' + JSON.stringify({
|
|
|
|
res.send('define(' + JSON.stringify({
|
|
|
|
websocketURL:'ws' + ((httpsOpts) ? 's' : '') + '://' + host + ':' +
|
|
|
|
websocketURL:'ws' + ((httpsOpts) ? 's' : '') + '://' + host + ':' +
|
|
|
|
config.websocketPort + '/cryptpad_websocket',
|
|
|
|
config.websocketPort + '/cryptpad_websocket',
|
|
|
|
webrtcURL: (config.webrtcPort) ? 'ws' + ((httpsOpts) ? 's' : '') + '://' + host + ':' +
|
|
|
|
webrtcURL:'ws' + ((httpsOpts) ? 's' : '') + '://' + host + ':' +
|
|
|
|
config.webrtcPort : ''
|
|
|
|
config.websocketPort + '/cryptpad_webrtc',
|
|
|
|
}) + ');');
|
|
|
|
}) + ');');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -74,7 +74,6 @@ httpServer.listen(config.httpPort,config.httpAddress,function(){
|
|
|
|
console.log('listening on %s',config.httpPort);
|
|
|
|
console.log('listening on %s',config.httpPort);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if(config.websocketPort) {
|
|
|
|
|
|
|
|
var wsConfig = { server: httpServer };
|
|
|
|
var wsConfig = { server: httpServer };
|
|
|
|
if (config.websocketPort !== config.httpPort) {
|
|
|
|
if (config.websocketPort !== config.httpPort) {
|
|
|
|
console.log("setting up a new websocket server");
|
|
|
|
console.log("setting up a new websocket server");
|
|
|
@ -83,22 +82,6 @@ if(config.websocketPort) {
|
|
|
|
var wsSrv = new WebSocketServer(wsConfig);
|
|
|
|
var wsSrv = new WebSocketServer(wsConfig);
|
|
|
|
Storage.create(config, function (store) {
|
|
|
|
Storage.create(config, function (store) {
|
|
|
|
console.log('DB connected');
|
|
|
|
console.log('DB connected');
|
|
|
|
// ChainPadSrv.create(wsSrv, store);
|
|
|
|
|
|
|
|
NetfluxSrv.run(store, wsSrv);
|
|
|
|
NetfluxSrv.run(store, wsSrv);
|
|
|
|
//WebRTCSrv.run(store, wsSrv);
|
|
|
|
WebRTCSrv.run(wsSrv);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if(config.webrtcPort) {
|
|
|
|
|
|
|
|
var wrConfig = { server: httpServer };
|
|
|
|
|
|
|
|
if (config.webrtcPort !== config.httpPort) {
|
|
|
|
|
|
|
|
console.log("setting up a new webrtc server");
|
|
|
|
|
|
|
|
wrConfig = { port: config.webrtcPort};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var wrSrv = new WebSocketServer(wrConfig);
|
|
|
|
|
|
|
|
WebRTCSrv.run(wrSrv);
|
|
|
|
|
|
|
|
// Storage.create(config, function (store) {
|
|
|
|
|
|
|
|
// console.log('DB connected for WebRTC');
|
|
|
|
|
|
|
|
// ChainPadSrv.create(wsSrv, store);
|
|
|
|
|
|
|
|
//NetfluxSrv.run(store, wsSrv);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|