From 45c1ad078bda7800cec1a81f2b8517adec93c43d Mon Sep 17 00:00:00 2001 From: Simon Gaeremynck Date: Tue, 25 Nov 2014 18:42:40 +0000 Subject: [PATCH 1/6] Allow for shardable Etherpad --- src/static/js/pad.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 78c20657..89ebfa76 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -170,7 +170,9 @@ function handshake() var resource = exports.baseURL.substring(1) + "socket.io"; //connect socket = pad.socket = io.connect(url, { - resource: resource, + // Allow deployers to host Etherpad on a non-root path + 'path': exports.baseURL + "socket.io", + 'resource': resource, 'max reconnection attempts': 3, 'sync disconnect on unload' : false }); From 5d15f655f0d697995e221c19e707fc9ff05faaa2 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Sun, 14 Dec 2014 22:01:28 +0100 Subject: [PATCH 2/6] dont make local variables global --- src/node/db/API.js | 6 +++--- src/node/db/Pad.js | 2 +- src/node/eejs/index.js | 2 +- src/node/hooks/express.js | 2 +- src/static/js/ace2_inner.js | 2 +- src/static/js/broadcast_revisions.js | 2 +- src/static/js/changesettracker.js | 2 +- src/static/js/collab_client.js | 4 ++-- src/static/js/contentcollector.js | 2 +- src/static/js/pluginfw/hooks.js | 2 +- src/static/js/timeslider.js | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index 4a912368..2f6542e4 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -263,7 +263,7 @@ exports.getText = function(padID, rev, callback) { if(ERR(err, callback)) return; - data = {text: atext.text}; + var data = {text: atext.text}; callback(null, data); }) @@ -368,7 +368,7 @@ exports.getHTML = function(padID, rev, callback) if(ERR(err, callback)) return; html = "" +html; // adds HTML head html += ""; - data = {html: html}; + var data = {html: html}; callback(null, data); }); } @@ -380,7 +380,7 @@ exports.getHTML = function(padID, rev, callback) if(ERR(err, callback)) return; html = "" +html; // adds HTML head html += ""; - data = {html: html}; + var data = {html: html}; callback(null, data); }); } diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 4670696a..2791334b 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -135,7 +135,7 @@ Pad.prototype.getRevisionDate = function getRevisionDate(revNum, callback) { Pad.prototype.getAllAuthors = function getAllAuthors() { var authors = []; - for(key in this.pool.numToAttrib) + for(var key in this.pool.numToAttrib) { if(this.pool.numToAttrib[key][0] == "author" && this.pool.numToAttrib[key][1] != "") { diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index 48185d80..30f5a442 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -71,7 +71,7 @@ exports.begin_define_block = function (name) { } exports.end_define_block = function () { - content = exports.end_capture(); + var content = exports.end_capture(); return content; } diff --git a/src/node/hooks/express.js b/src/node/hooks/express.js index c6573c80..e858b800 100644 --- a/src/node/hooks/express.js +++ b/src/node/hooks/express.js @@ -56,7 +56,7 @@ exports.restartServer = function () { console.log( "SSL -- server key file: " + settings.ssl.key ); console.log( "SSL -- Certificate Authority's certificate file: " + settings.ssl.cert ); - options = { + var options = { key: fs.readFileSync( settings.ssl.key ), cert: fs.readFileSync( settings.ssl.cert ) }; diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 07a9b971..d6c5c52c 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5038,7 +5038,7 @@ function Ace2Inner(){ //3-renumber every list item of the same level from the beginning, level 1 //IMPORTANT: never skip a level because there imbrication may be arbitrary var builder = Changeset.builder(rep.lines.totalWidth()); - loc = [0,0]; + var loc = [0,0]; function applyNumberList(line, level) { //init diff --git a/src/static/js/broadcast_revisions.js b/src/static/js/broadcast_revisions.js index 1980bdf3..9774dc3f 100644 --- a/src/static/js/broadcast_revisions.js +++ b/src/static/js/broadcast_revisions.js @@ -48,7 +48,7 @@ function loadBroadcastRevisionsJS() }); } - revisionInfo = {}; + var revisionInfo = {}; revisionInfo.addChangeset = function(fromIndex, toIndex, changeset, backChangeset, timeDelta) { var startRevision = revisionInfo[fromIndex] || revisionInfo.createNew(fromIndex); diff --git a/src/static/js/changesettracker.js b/src/static/js/changesettracker.js index f3efc407..fe362c4b 100644 --- a/src/static/js/changesettracker.js +++ b/src/static/js/changesettracker.js @@ -179,7 +179,7 @@ function makeChangesetTracker(scheduler, apool, aceCallbacksProvider) // We need to replace all author attribs with thisSession.author, in case they copy/pasted or otherwise inserted other peoples changes if(apool.numToAttrib){ for (var attr in apool.numToAttrib){ - if (apool.numToAttrib[attr][0] == 'author' && apool.numToAttrib[attr][1] == authorId) authorAttr = Number(attr).toString(36) + if (apool.numToAttrib[attr][0] == 'author' && apool.numToAttrib[attr][1] == authorId) var authorAttr = Number(attr).toString(36) } // Replace all added 'author' attribs with the value of the current user diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index 146ec51b..f83e6d6c 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -152,7 +152,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) // apply msgQueue changeset. if (msgQueue.length != 0) { - while (msg = msgQueue.shift()) { + while (var msg = msgQueue.shift()) { var newRev = msg.newRev; rev=newRev; if (msg.type == "ACCEPT_COMMIT") @@ -274,7 +274,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) // When inInternationalComposition, msg pushed msgQueue. if (msgQueue.length > 0 || editor.getInInternationalComposition()) { - if (msgQueue.length > 0) oldRev = msgQueue[msgQueue.length - 1].newRev; + if (msgQueue.length > 0) var oldRev = msgQueue[msgQueue.length - 1].newRev; else oldRev = rev; if (newRev != (oldRev + 1)) diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index ee0a1c27..0a97498a 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -663,7 +663,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { //var semiloc = oldString.lastIndexOf(';', lineLimit-1); //var lengthToTake = (semiloc >= 0 ? (semiloc+1) : lineLimit); - lengthToTake = lineLimit; + var lengthToTake = lineLimit; newStrings.push(oldString.substring(0, lengthToTake)); oldString = oldString.substring(lengthToTake); newAttribStrings.push(Changeset.subattribution(oldAttribString, 0, lengthToTake)); diff --git a/src/static/js/pluginfw/hooks.js b/src/static/js/pluginfw/hooks.js index a8ac413f..cf5fcc4e 100644 --- a/src/static/js/pluginfw/hooks.js +++ b/src/static/js/pluginfw/hooks.js @@ -41,7 +41,7 @@ exports.syncMapFirst = function (lst, fn) { exports.mapFirst = function (lst, fn, cb) { var i = 0; - next = function () { + var next = function () { if (i >= lst.length) return cb(undefined); fn(lst[i++], function (err, result) { if (err) return cb(err); diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index b3c10b8a..d00c5912 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -62,7 +62,7 @@ function init() { var resource = exports.baseURL.substring(1) + 'socket.io'; //build up the socket io connection - socket = io.connect(url, {resource: resource}); + var socket = io.connect(url, {resource: resource}); //send the ready message once we're connected socket.on('connect', function() From 0263d30b3771badc3db8b2d955e45422516e290d Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Tue, 16 Dec 2014 17:00:35 +0100 Subject: [PATCH 3/6] declare var outside of loop --- src/static/js/collab_client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index f83e6d6c..006b75f4 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -152,7 +152,8 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) // apply msgQueue changeset. if (msgQueue.length != 0) { - while (var msg = msgQueue.shift()) { + var msg; + while (msg = msgQueue.shift()) { var newRev = msg.newRev; rev=newRev; if (msg.type == "ACCEPT_COMMIT") From 69bad8b30c9bc0a32cf4a13f75aaca3d90bf5058 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Wed, 17 Dec 2014 01:10:20 +0100 Subject: [PATCH 4/6] fix typo in addSavedRevisions --- src/node/db/Pad.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 2791334b..94049ff7 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -690,7 +690,7 @@ Pad.prototype.isPasswordProtected = function isPasswordProtected() { Pad.prototype.addSavedRevision = function addSavedRevision(revNum, savedById, label) { //if this revision is already saved, return silently for(var i in this.savedRevisions){ - if(this.savedRevisions.revNum === revNum){ + if(this.savedRevisions[i] && this.savedRevisions[i].revNum === revNum){ return; } } From ffdce760d5a1a38c9c96294087cbbfa76f3f76c2 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 21 Dec 2014 22:05:07 +0000 Subject: [PATCH 5/6] remove unused long paths from windows build --- bin/buildForWindows.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/buildForWindows.sh b/bin/buildForWindows.sh index a1e2c757..78441ba0 100755 --- a/bin/buildForWindows.sh +++ b/bin/buildForWindows.sh @@ -58,6 +58,8 @@ rm -rf .git/objects echo "remove windows jsdom-nocontextify/test folder" rm -rf /tmp/etherpad-lite-win/node_modules/ep_etherpad-lite/node_modules/jsdom-nocontextifiy/test/ rm -rf /tmp/etherpad-lite-win/src/node_modules/jsdom-nocontextifiy/test/ +rm -rf /tmp/etherpad-lite-win/src/node_modules/wd/node_modules/request/node_modules/form-data/node_modules/combined-stream/test +rm -rf /tmp/etherpad-lite-win/src/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/encodings/tables echo "create the zip..." cd /tmp From 745ef5db1cfec24bb1843f552cf50a8549a21437 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 21 Dec 2014 23:10:56 +0000 Subject: [PATCH 6/6] fix timeslider socket issue --- src/static/js/timeslider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index d00c5912..b3c10b8a 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -62,7 +62,7 @@ function init() { var resource = exports.baseURL.substring(1) + 'socket.io'; //build up the socket io connection - var socket = io.connect(url, {resource: resource}); + socket = io.connect(url, {resource: resource}); //send the ready message once we're connected socket.on('connect', function()