From 82caa1aa8b647af08ff35ef882d61e19cd2538e7 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 23 Jan 2017 12:29:12 +0100 Subject: [PATCH 1/4] Fix the Noscript bug --- customize.dist/share/frame.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/customize.dist/share/frame.js b/customize.dist/share/frame.js index d3d4fb00d..9f604af23 100644 --- a/customize.dist/share/frame.js +++ b/customize.dist/share/frame.js @@ -24,7 +24,10 @@ onload(void 0, iframe, e); window.clearTimeout(to); }; - iframe.setAttribute('src', src); + // We must pass a unique parameter here to avoid cache problems in Firefox with + // the NoScript plugin: if the iframe's content is taken from the cache, the JS + // is not executed with NoScript.... + iframe.setAttribute('src', src + '?t=' + new Date().getTime()); parent.appendChild(iframe); }; From f8455875a9ab9b5fdc54ae5f85fe774522c46e51 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 23 Jan 2017 15:07:38 +0100 Subject: [PATCH 2/4] Fix the NoScript (iframe not loaded) bug with inner iframes --- www/code/index.html | 5 ++++- www/pad/index.html | 5 ++++- www/slide/index.html | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/www/code/index.html b/www/code/index.html index 847ac2ec6..b4b1e025f 100644 --- a/www/code/index.html +++ b/www/code/index.html @@ -47,7 +47,10 @@
- + +
diff --git a/www/pad/index.html b/www/pad/index.html index 8437073af..d26ce6b96 100644 --- a/www/pad/index.html +++ b/www/pad/index.html @@ -59,7 +59,10 @@ - + + diff --git a/www/slide/index.html b/www/slide/index.html index 1af49e2ab..c5f2f0fd6 100644 --- a/www/slide/index.html +++ b/www/slide/index.html @@ -51,7 +51,10 @@
- + +
From 4402ea9966143014325caf9f458b7ef4b55fdb85 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Thu, 26 Jan 2017 16:34:00 +0100 Subject: [PATCH 3/4] typo in config.dist --- config.js.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.js.dist b/config.js.dist index b015b55be..103bf959b 100644 --- a/config.js.dist +++ b/config.js.dist @@ -17,7 +17,7 @@ module.exports = { /* httpHeaders: { "Content-Security-Policy": [ - "default-serc 'none'", + "default-src 'none'", "style-src 'unsafe-inline' 'self'", "script-src 'self' 'unsafe-eval' 'unsafe-inline'", "child-src 'self' cryptpad.fr *.cryptpad.fr", From 4aacd291b1d4345d4a12e961b9db615b78943585 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 27 Jan 2017 16:45:41 +0100 Subject: [PATCH 4/4] New config option to use an external websocket server --- config.js.dist | 6 ++++++ server.js | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/config.js.dist b/config.js.dist index 103bf959b..95ba7ed49 100644 --- a/config.js.dist +++ b/config.js.dist @@ -50,6 +50,12 @@ module.exports = { */ //websocketPort: 3000, + /* if you want to run a different version of cryptpad but using the same websocket + * server, you should use the other server port as websocketPort and disable + * the websockets on that server + */ + //useExternalWebsocket: false, + /* If Cryptpad is proxied without using https, the server needs to know. * Specify 'useSecureWebsockets: true' so that it can send * Content Security Policy Headers that prevent http and https from mixing diff --git a/server.js b/server.js index 2be619e48..6414c83bc 100644 --- a/server.js +++ b/server.js @@ -82,7 +82,7 @@ app.get('/api/config', function(req, res){ var host = req.headers.host.replace(/\:[0-9]+/, ''); res.setHeader('Content-Type', 'text/javascript'); res.send('define(' + JSON.stringify({ - websocketPath: config.websocketPath, + websocketPath: config.useExternalWebsocket ? undefined : config.websocketPath, websocketURL:'ws' + ((useSecureWebsockets) ? 's' : '') + '://' + host + ':' + websocketPort + '/cryptpad_websocket', }) + ');'); @@ -95,11 +95,14 @@ httpServer.listen(config.httpPort,config.httpAddress,function(){ }); var wsConfig = { server: httpServer }; -if (websocketPort !== config.httpPort) { - console.log("setting up a new websocket server"); - wsConfig = { port: websocketPort}; + +if(!config.useExternalWebsocket) { + if (websocketPort !== config.httpPort) { + console.log("setting up a new websocket server"); + wsConfig = { port: websocketPort}; + } + var wsSrv = new WebSocketServer(wsConfig); + Storage.create(config, function (store) { + NetfluxSrv.run(store, wsSrv, config); + }); } -var wsSrv = new WebSocketServer(wsConfig); -Storage.create(config, function (store) { - NetfluxSrv.run(store, wsSrv, config); -});