Replace the Netflux old client (netflux.js) by the Netflux2 client.

Move the WebRTC peer-to-peer use case in /padrtc, which still uses the old
Netflux client
Use es6-promises.min.js to solve a issue with some browser and the new
Netflux client
This commit is contained in:
Yann Flory
2016-04-07 18:48:01 +02:00
parent cf9f60bd57
commit 0b3d6e15b8
14 changed files with 2628 additions and 160 deletions

View File

@@ -101,9 +101,8 @@ const handleMessage = function (ctx, user, msg) {
if (cmd === 'MSG') {
if (obj === HISTORY_KEEPER_ID) {
let parsed;
try { parsed = JSON.parse(json[2]); } catch (err) { return; }
try { parsed = JSON.parse(json[2]); } catch (err) { console.error(err); return; }
if (parsed[0] === 'GET_HISTORY') {
console.log('getHistory ' + parsed[1]);
getHistory(ctx, parsed[1], function (msg) {
sendMsg(ctx, user, [0, HISTORY_KEEPER_ID, 'MSG', user.id, JSON.stringify(msg)]);
});
@@ -168,6 +167,7 @@ let run = module.exports.run = function (storage, socketServer) {
});
}, 5000);
socketServer.on('connection', function(socket) {
if(socket.upgradeReq.url !== '/cryptpad_websocket') { return; }
let conn = socket.upgradeReq.connection;
let user = {
addr: conn.remoteAddress + '|' + conn.remotePort,