From cc69e762007030300ba6bfaff781566be3689ffa Mon Sep 17 00:00:00 2001 From: noerw Date: Fri, 6 Jan 2017 18:18:55 +0100 Subject: [PATCH 01/41] redirect /admin properly (fix #3114) --- src/node/hooks/express/admin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/hooks/express/admin.js b/src/node/hooks/express/admin.js index 70539f0c4..0884cde56 100644 --- a/src/node/hooks/express/admin.js +++ b/src/node/hooks/express/admin.js @@ -2,7 +2,7 @@ var eejs = require('ep_etherpad-lite/node/eejs'); exports.expressCreateServer = function (hook_name, args, cb) { args.app.get('/admin', function(req, res) { - if('/' != req.path[req.path.length-1]) return res.redirect('/admin/'); + if('/' != req.path[req.path.length-1]) return res.redirect('./admin/'); res.send( eejs.require("ep_etherpad-lite/templates/admin/index.html", {}) ); }); } From f5810957b4204d06563485953e3efeb1392304c2 Mon Sep 17 00:00:00 2001 From: Pablo Saavedra Date: Thu, 2 Feb 2017 10:45:59 +0100 Subject: [PATCH 02/41] This WA is not longer required in the newest Chrome see comments in the issue: ether#2078 The hack is still necessary in Firefox 51 --- src/static/css/iframe_editor.css | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 9aa003aaf..033eeb66a 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -58,9 +58,11 @@ body.doesWrap { white-space: normal; } -body.doesWrap:not(.noprewrap) > div{ - /* Related to #1766 */ - white-space: pre-wrap; +@-moz-document url-prefix() { + body.doesWrap:not(.noprewrap) > div{ + /* Related to #1766 */ + white-space: pre-wrap; + } } #innerdocbody { From 8d60bd52345a7b949421d8750895d5cea34b7063 Mon Sep 17 00:00:00 2001 From: Claudius Mbemba Date: Tue, 30 May 2017 05:36:29 +0200 Subject: [PATCH 03/41] fixed plugin dependency issue running ./bin/run.sh after the 1st time caused the following error "TypeError: Cannot read property 'dependencies' of undefined". fixed it. --- src/static/js/pluginfw/plugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/pluginfw/plugins.js b/src/static/js/pluginfw/plugins.js index 0d0fa1ed5..7cb4b1bdc 100644 --- a/src/static/js/pluginfw/plugins.js +++ b/src/static/js/pluginfw/plugins.js @@ -124,7 +124,7 @@ exports.getPackages = function (cb) { var tmp = {}; tmp[data.name] = data; - flatten(tmp[undefined].dependencies); + flatten(tmp[data.name].dependencies); cb(null, packages); }); }; From 35702a0589fd23f29fe6ceca3e70b1f533edea23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Biel?= Date: Mon, 10 Jul 2017 20:54:32 +0200 Subject: [PATCH 04/41] [feat] New server-side hook: onAccessCheck --- doc/api/hooks_server-side.md | 12 ++++++++++++ src/node/db/SecurityManager.js | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index d4e836404..bb1b53890 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -108,6 +108,18 @@ Usage examples: * https://github.com/tiblu/ep_authorship_toggle +## onAccessCheck +Called from: src/node/db/SecurityManager.js + +Things in context: + +1. padID - the pad the user wants to access +2. password - the password the user has given to access the pad +3. token - the token of the author +3. sessionCookie - the session the use has + +This hook gets called when the access to the concrete pad is being checked. Return `false` to deny access. + ## padCreate Called from: src/node/db/Pad.js diff --git a/src/node/db/SecurityManager.js b/src/node/db/SecurityManager.js index 6fae57ffb..9430e75dd 100644 --- a/src/node/db/SecurityManager.js +++ b/src/node/db/SecurityManager.js @@ -22,6 +22,7 @@ var ERR = require("async-stacktrace"); var async = require("async"); var authorManager = require("./AuthorManager"); +var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js"); var padManager = require("./PadManager"); var sessionManager = require("./SessionManager"); var settings = require("../utils/Settings"); @@ -45,6 +46,14 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback) return; } + // allow plugins to deny access + var deniedByHook = hooks.callAll("onAccessCheck", {'padID': padID, 'password': password, 'token': token, 'sessionCookie': sessionCookie}).indexOf(false) > -1; + if(deniedByHook) + { + callback(null, {accessStatus: "deny"}); + return; + } + // a valid session is required (api-only mode) if(settings.requireSession) { From 5c8a15c3d7fe350cc86abef06f3f0c11a18ea464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Biel?= Date: Wed, 12 Jul 2017 00:28:51 +0200 Subject: [PATCH 05/41] fix `sessionCookie` number in onAccessCheck --- doc/api/hooks_server-side.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index bb1b53890..62e0e994e 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -116,7 +116,7 @@ Things in context: 1. padID - the pad the user wants to access 2. password - the password the user has given to access the pad 3. token - the token of the author -3. sessionCookie - the session the use has +4. sessionCookie - the session the use has This hook gets called when the access to the concrete pad is being checked. Return `false` to deny access. From 4cce3bcbed04882b2abd962fdda002f1d340fefa Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Mon, 31 Jul 2017 14:43:04 +0200 Subject: [PATCH 06/41] Make APIKEY und SESSIONKEY file customizable Running multiple instances sometimes requires different api- and session-keys for security reasons. --- src/node/handler/APIHandler.js | 6 ++++-- src/node/utils/Cli.js | 10 ++++++++++ src/node/utils/Settings.js | 5 +++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 179c2b404..05e147058 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -24,17 +24,19 @@ var fs = require("fs"); var api = require("../db/API"); var padManager = require("../db/PadManager"); var randomString = require("../utils/randomstring"); +var argv = require('../utils/Cli').argv; //ensure we have an apikey var apikey = null; +var apikeyFilename = argv.apikey || "./APIKEY.txt"; try { - apikey = fs.readFileSync("./APIKEY.txt","utf8"); + apikey = fs.readFileSync(apikeyFilename,"utf8"); } catch(e) { apikey = randomString(32); - fs.writeFileSync("./APIKEY.txt",apikey,"utf8"); + fs.writeFileSync(apikeyFilename,apikey,"utf8"); } //a list of all functions diff --git a/src/node/utils/Cli.js b/src/node/utils/Cli.js index 9419ed26b..154590dc7 100644 --- a/src/node/utils/Cli.js +++ b/src/node/utils/Cli.js @@ -39,5 +39,15 @@ for ( var i = 0; i < argv.length; i++ ) { exports.argv.credentials = arg; } + // Override location of settings.json file + if ( prevArg == '--sessionkey' || prevArg == '-k' ) { + exports.argv.sessionkey = arg; + } + + // Override location of settings.json file + if ( prevArg == '--apikey' || prevArg == '-k' ) { + exports.argv.apikey = arg; + } + prevArg = arg; } diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 660b7afb3..3516ca8b9 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -449,11 +449,12 @@ exports.reloadSettings = function reloadSettings() { } if (!exports.sessionKey) { + var sessionkeyFilename = argv.sessionkey || "./SESSIONKEY.txt"; try { - exports.sessionKey = fs.readFileSync("./SESSIONKEY.txt","utf8"); + exports.sessionKey = fs.readFileSync(sessionkeyFilename,"utf8"); } catch(e) { exports.sessionKey = randomString(32); - fs.writeFileSync("./SESSIONKEY.txt",exports.sessionKey,"utf8"); + fs.writeFileSync(sessionkeyFilename,exports.sessionKey,"utf8"); } } else { console.warn("Declaring the sessionKey in the settings.json is deprecated. This value is auto-generated now. Please remove the setting from the file."); From b4ddd0276dbeb7fced5df2e255c06e82bd337e00 Mon Sep 17 00:00:00 2001 From: Jainendra Mandavi Date: Fri, 4 Aug 2017 03:23:12 +0530 Subject: [PATCH 07/41] Use abiword to process .rft files --- src/node/handler/ImportHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 6aa94e649..3e3dc195e 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -90,7 +90,7 @@ exports.doImport = function(req, res, padId) //this allows us to accept source code files like .c or .java function(callback) { var fileEnding = path.extname(srcFile).toLowerCase() - , knownFileEndings = [".txt", ".doc", ".docx", ".pdf", ".odt", ".html", ".htm", ".etherpad"] + , knownFileEndings = [".txt", ".doc", ".docx", ".pdf", ".odt", ".html", ".htm", ".etherpad", ".rtf"] , fileEndingKnown = (knownFileEndings.indexOf(fileEnding) > -1); //if the file ending is known, continue as normal From 193afacb6f2c3affbabea4ca2cd5172550ea0c84 Mon Sep 17 00:00:00 2001 From: bm jade Date: Mon, 7 Aug 2017 16:36:44 +0200 Subject: [PATCH 08/41] FIX fix provide by skupfer from github, It fix the installOnWindows problem --- bin/installOnWindows.bat | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/bin/installOnWindows.bat b/bin/installOnWindows.bat index 89fa335d8..d95bf4c44 100644 --- a/bin/installOnWindows.bat +++ b/bin/installOnWindows.bat @@ -1,21 +1,29 @@ @echo off :: change directory to etherpad-lite root -cd /D "%~dp0\.." +cd /D "%~dp0.." :: Is node installed? cmd /C node -e "" || ( echo "Please install node.js ( http://nodejs.org )" && exit /B 1 ) echo _ -echo Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient. -cmd /C npm install src/ --loglevel warn || exit /B 1 +echo Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient. + +mkdir node_modules +cd /D node_modules +mklink /D "ep_etherpad-lite" "..\src" + +cd /D "ep_etherpad-lite" +cmd /C npm install --loglevel warn || exit /B 1 + +cd /D "%~dp0.." echo _ echo Copying custom templates... set custom_dir=node_modules\ep_etherpad-lite\static\custom FOR %%f IN (index pad timeslider) DO ( - if NOT EXIST "%custom_dir%\%%f.js" copy "%custom_dir%\js.template" "%custom_dir%\%%f.js" - if NOT EXIST "%custom_dir%\%%f.css" copy "%custom_dir%\css.template" "%custom_dir%\%%f.css" + if NOT EXIST "%custom_dir%%%f.js" copy "%custom_dir%\js.template" "%custom_dir%%%f.js" + if NOT EXIST "%custom_dir%%%f.css" copy "%custom_dir%\css.template" "%custom_dir%%%f.css" ) echo _ @@ -25,10 +33,10 @@ del /S var\minified* echo _ echo Setting up settings.json... IF NOT EXIST settings.json ( - echo Can't find settings.json. - echo Copying settings.json.template... - cmd /C copy settings.json.template settings.json || exit /B 1 + echo Can't find settings.json. + echo Copying settings.json.template... + cmd /C copy settings.json.template settings.json || exit /B 1 ) echo _ -echo Installed Etherpad! To run Etherpad type start.bat +echo Installed Etherpad! To run Etherpad type start.bat \ No newline at end of file From 64aee56940c08c2774c44c92e589037d8803c629 Mon Sep 17 00:00:00 2001 From: bm jade Date: Mon, 7 Aug 2017 17:15:02 +0200 Subject: [PATCH 09/41] FIX missing backslashes --- bin/installOnWindows.bat | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/installOnWindows.bat b/bin/installOnWindows.bat index d95bf4c44..6abf66ab0 100644 --- a/bin/installOnWindows.bat +++ b/bin/installOnWindows.bat @@ -1,13 +1,13 @@ @echo off :: change directory to etherpad-lite root -cd /D "%~dp0.." +cd /D "%~dp0\.." :: Is node installed? cmd /C node -e "" || ( echo "Please install node.js ( http://nodejs.org )" && exit /B 1 ) echo _ -echo Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient. +echo Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient. mkdir node_modules cd /D node_modules @@ -16,14 +16,14 @@ mklink /D "ep_etherpad-lite" "..\src" cd /D "ep_etherpad-lite" cmd /C npm install --loglevel warn || exit /B 1 -cd /D "%~dp0.." +cd /D "%~dp0\.." echo _ echo Copying custom templates... set custom_dir=node_modules\ep_etherpad-lite\static\custom FOR %%f IN (index pad timeslider) DO ( - if NOT EXIST "%custom_dir%%%f.js" copy "%custom_dir%\js.template" "%custom_dir%%%f.js" - if NOT EXIST "%custom_dir%%%f.css" copy "%custom_dir%\css.template" "%custom_dir%%%f.css" + if NOT EXIST "%custom_dir%\%%f.js" copy "%custom_dir%\js.template" "%custom_dir%\%%f.js" + if NOT EXIST "%custom_dir%\%%f.css" copy "%custom_dir%\css.template" "%custom_dir%\%%f.css" ) echo _ @@ -33,10 +33,10 @@ del /S var\minified* echo _ echo Setting up settings.json... IF NOT EXIST settings.json ( - echo Can't find settings.json. - echo Copying settings.json.template... - cmd /C copy settings.json.template settings.json || exit /B 1 + echo Can't find settings.json. + echo Copying settings.json.template... + cmd /C copy settings.json.template settings.json || exit /B 1 ) echo _ -echo Installed Etherpad! To run Etherpad type start.bat \ No newline at end of file +echo Installed Etherpad! To run Etherpad type start.bat \ No newline at end of file From 69bf32cd46717a15d3b6ff06bc95b86b42885825 Mon Sep 17 00:00:00 2001 From: ilmar Date: Thu, 19 Oct 2017 16:11:40 +0300 Subject: [PATCH 10/41] fix to https://github.com/ether/etherpad-lite/issues/2486 --- src/node/utils/ExportHtml.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index bd177ac47..576d2b8fd 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -455,7 +455,11 @@ function getHTMLFromAtext(pad, atext, authorColors) if (lineContentFromHook) { - pieces.push(lineContentFromHook, ''); + if (context.lineContent === lineContent && lineContentFromHook !== true) { + pieces.push(lineContentFromHook, ''); // Just to be compatible with plugins that are not updated to this solution + } else { + pieces.push(context.lineContent, ''); // should be used instead of lineContentFromHook because context is passed through each hook with all it's updated from each plugin + } } else { From c36a3264fe5942a382feac97245314f1fbe24994 Mon Sep 17 00:00:00 2001 From: ilmar Date: Sat, 21 Oct 2017 01:04:53 +0300 Subject: [PATCH 11/41] fix to ether/etherpad-lite#2486 --- src/node/utils/ExportHtml.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 576d2b8fd..7f4874a8d 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -455,8 +455,10 @@ function getHTMLFromAtext(pad, atext, authorColors) if (lineContentFromHook) { - if (context.lineContent === lineContent && lineContentFromHook !== true) { - pieces.push(lineContentFromHook, ''); // Just to be compatible with plugins that are not updated to this solution + var lcToTestTrue = lineContentFromHook; + lcToTestTrue = lcToTestTrue.replace(/true/g, '').replace(/ /g, ''); + if (context.lineContent === lineContent && lcToTestTrue.length) { // Just to be compatible with plugins that are not updated to this solution + pieces.push(lineContentFromHook, ''); } else { pieces.push(context.lineContent, ''); // should be used instead of lineContentFromHook because context is passed through each hook with all it's updated from each plugin } From 724b1d734ba85a0638816d6878ae765a13c90111 Mon Sep 17 00:00:00 2001 From: ilmar Date: Tue, 31 Oct 2017 16:23:41 +0200 Subject: [PATCH 12/41] updated html export, run hooks also with lists --- src/node/utils/ExportHtml.js | 37 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 7f4874a8d..13140bb58 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -356,7 +356,15 @@ function getHTMLFromAtext(pad, atext, authorColors) } } } - + var context = { + line: line, + lineContent: lineContent, + apool: apool, + attribLine: attribLines[i], + text: textLines[i], + padId: pad.id + } + var lineContentFromHook = hooks.callAll("getLineHTMLForExport", context); if (whichList >= lists.length)//means we are on a deeper level of indentation than the previous line { if(lists.length > 0){ @@ -373,14 +381,14 @@ function getHTMLFromAtext(pad, atext, authorColors) if(toOpen > 0){ pieces.push(new Array(toOpen + 1).join('
    ')) } - pieces.push('
    1. ', lineContent || '
      '); + pieces.push('
      1. ', context.lineContent || '
        '); } else { if(toOpen > 0){ pieces.push(new Array(toOpen + 1).join('
          ')) } - pieces.push('
          • ', lineContent || '
            '); + pieces.push('
            • ', context.lineContent || '
              '); } } //the following code *seems* dead after my patch. @@ -416,16 +424,16 @@ function getHTMLFromAtext(pad, atext, authorColors) if(lists[lists.length - 1][1] == "number") { pieces.push(new Array(toClose+1).join('
      ')) - pieces.push('
    2. ', lineContent || '
      '); + pieces.push('
    3. ', context.lineContent || '
      '); } else { pieces.push(new Array(toClose+1).join('')) - pieces.push('
    4. ', lineContent || '
      '); + pieces.push('
    5. ', context.lineContent || '
      '); } lists = lists.slice(0,whichList+1) } else { - pieces.push('
    6. ', lineContent || '
      '); + pieces.push('
    7. ', context.lineContent || '
      '); } } } @@ -451,22 +459,9 @@ function getHTMLFromAtext(pad, atext, authorColors) padId: pad.id } - var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", context, " ", " ", ""); + hooks.callAll("getLineHTMLForExport", context); - if (lineContentFromHook) - { - var lcToTestTrue = lineContentFromHook; - lcToTestTrue = lcToTestTrue.replace(/true/g, '').replace(/ /g, ''); - if (context.lineContent === lineContent && lcToTestTrue.length) { // Just to be compatible with plugins that are not updated to this solution - pieces.push(lineContentFromHook, ''); - } else { - pieces.push(context.lineContent, ''); // should be used instead of lineContentFromHook because context is passed through each hook with all it's updated from each plugin - } - } - else - { - pieces.push(lineContent, '
      '); - } + pieces.push(context.lineContent, '
      '); } } From 54e834194b97987d68953c67a758a7f94763cb14 Mon Sep 17 00:00:00 2001 From: Loick Magniez Date: Wed, 22 Nov 2017 16:04:17 +0100 Subject: [PATCH 13/41] Changed the color palette and changed the pad's font size to 16px --- src/node/db/AuthorManager.js | 52 ++++++++++++++++---------------- src/static/css/iframe_editor.css | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/node/db/AuthorManager.js b/src/node/db/AuthorManager.js index 3e3b691a6..1f2a736be 100644 --- a/src/node/db/AuthorManager.js +++ b/src/node/db/AuthorManager.js @@ -25,7 +25,7 @@ var customError = require("../utils/customError"); var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString; exports.getColorPalette = function(){ - return ["#ffc7c7", "#fff1c7", "#e3ffc7", "#c7ffd5", "#c7ffff", "#c7d5ff", "#e3c7ff", "#ffc7f1", "#ff8f8f", "#ffe38f", "#c7ff8f", "#8fffab", "#8fffff", "#8fabff", "#c78fff", "#ff8fe3", "#d97979", "#d9c179", "#a9d979", "#79d991", "#79d9d9", "#7991d9", "#a979d9", "#d979c1", "#d9a9a9", "#d9cda9", "#c1d9a9", "#a9d9b5", "#a9d9d9", "#a9b5d9", "#c1a9d9", "#d9a9cd", "#4c9c82", "#12d1ad", "#2d8e80", "#7485c3", "#a091c7", "#3185ab", "#6818b4", "#e6e76d", "#a42c64", "#f386e5", "#4ecc0c", "#c0c236", "#693224", "#b5de6a", "#9b88fd", "#358f9b", "#496d2f", "#e267fe", "#d23056", "#1a1a64", "#5aa335", "#d722bb", "#86dc6c", "#b5a714", "#955b6a", "#9f2985", "#4b81c8", "#3d6a5b", "#434e16", "#d16084", "#af6a0e", "#8c8bd8"]; + return ["#ffc7c7", "#fff1c7", "#e3ffc7", "#c7ffd5", "#c7ffff", "#c7d5ff", "#e3c7ff", "#ffc7f1", "#ffa8a8", "#ffe699", "#cfff9e", "#99ffb3", "#a3ffff", "#99b3ff", "#cc99ff", "#ff99e5", "#e7b1b1", "#e9dcAf", "#cde9af", "#bfedcc", "#b1e7e7", "#c3cdee", "#d2b8ea", "#eec3e6", "#e9cece", "#e7e0ca", "#d3e5c7", "#bce1c5", "#c1e2e2", "#c1c9e2", "#cfc1e2", "#e0bdd9", "#baded3", "#a0f8eb", "#b1e7e0", "#c3c8e4", "#cec5e2", "#b1d5e7", "#cda8f0", "#f0f0a8", "#f2f2a6", "#f5a8eb", "#c5f9a9", "#ececbb", "#e7c4bc", "#daf0b2", "#b0a0fd", "#bce2e7", "#cce2bb", "#ec9afe", "#edabbd", "#aeaeea", "#c4e7b1", "#d722bb", "#f3a5e7", "#ffa8a8", "#d8c0c5", "#eaaedd", "#adc6eb", "#bedad1", "#dee9af", "#e9afc2", "#f8d2a0", "#b3b3e6"]; }; /** @@ -42,9 +42,9 @@ exports.doesAuthorExists = function (authorID, callback) } /** - * Returns the AuthorID for a token. - * @param {String} token The token - * @param {Function} callback callback (err, author) + * Returns the AuthorID for a token. + * @param {String} token The token + * @param {Function} callback callback (err, author) */ exports.getAuthor4Token = function (token, callback) { @@ -57,21 +57,21 @@ exports.getAuthor4Token = function (token, callback) } /** - * Returns the AuthorID for a mapper. + * Returns the AuthorID for a mapper. * @param {String} token The mapper * @param {String} name The name of the author (optional) - * @param {Function} callback callback (err, author) + * @param {Function} callback callback (err, author) */ exports.createAuthorIfNotExistsFor = function (authorMapper, name, callback) { mapAuthorWithDBKey("mapper2author", authorMapper, function(err, author) { if(ERR(err, callback)) return; - + //set the name of this author if(name) exports.setAuthorName(author.authorID, name); - + //return the authorID callback(null, author); }); @@ -80,27 +80,27 @@ exports.createAuthorIfNotExistsFor = function (authorMapper, name, callback) /** * Returns the AuthorID for a mapper. We can map using a mapperkey, * so far this is token2author and mapper2author - * @param {String} mapperkey The database key name for this mapper + * @param {String} mapperkey The database key name for this mapper * @param {String} mapper The mapper - * @param {Function} callback callback (err, author) + * @param {Function} callback callback (err, author) */ function mapAuthorWithDBKey (mapperkey, mapper, callback) -{ +{ //try to map to an author db.get(mapperkey + ":" + mapper, function (err, author) { if(ERR(err, callback)) return; - + //there is no author with this mapper, so create one if(author == null) { exports.createAuthor(null, function(err, author) { if(ERR(err, callback)) return; - + //create the token2author relation db.set(mapperkey + ":" + mapper, author.authorID); - + //return the author callback(null, author); }); @@ -110,7 +110,7 @@ function mapAuthorWithDBKey (mapperkey, mapper, callback) { //update the timestamp of this author db.setSub("globalAuthor:" + author, ["timestamp"], new Date().getTime()); - + //return the author callback(null, {authorID: author}); } @@ -118,20 +118,20 @@ function mapAuthorWithDBKey (mapperkey, mapper, callback) } /** - * Internal function that creates the database entry for an author - * @param {String} name The name of the author + * Internal function that creates the database entry for an author + * @param {String} name The name of the author */ exports.createAuthor = function(name, callback) { //create the new author name var author = "a." + randomString(16); - + //create the globalAuthors db entry var authorObj = {"colorId" : Math.floor(Math.random()*(exports.getColorPalette().length)), "name": name, "timestamp": new Date().getTime()}; - + //set the global author db entry db.set("globalAuthor:" + author, authorObj); - + callback(null, {authorID: author}); } @@ -212,7 +212,7 @@ exports.listPadsOfAuthor = function (authorID, callback) } //everything is fine, return the pad IDs else - { + { var pads = []; if(author.padIDs != null) { @@ -238,16 +238,16 @@ exports.addPad = function (authorID, padID) { if(ERR(err)) return; if(author == null) return; - + //the entry doesn't exist so far, let's create it if(author.padIDs == null) { author.padIDs = {}; } - + //add the entry for this pad author.padIDs[padID] = 1;// anything, because value is not used - + //save the new element back db.set("globalAuthor:" + authorID, author); }); @@ -264,11 +264,11 @@ exports.removePad = function (authorID, padID) { if(ERR(err)) return; if(author == null) return; - + if(author.padIDs != null) { //remove pad from author - delete author.padIDs[padID]; + delete author.padIDs[padID]; db.set("globalAuthor:" + authorID, author); } }); diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 9aa003aaf..d559efc84 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -31,7 +31,7 @@ body { body.grayedout { background-color: #eee !important } #innerdocbody { - font-size: 12px; /* overridden by body.style */ + font-size: 16px; /* overridden by body.style */ font-family:Arial, sans-serif; /* overridden by body.style */ line-height: 16px; /* overridden by body.style */ background-color: white; From 38cbff11a1ca0381d1a6f89364aa2c822b757b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFck=20Magniez?= Date: Thu, 23 Nov 2017 16:24:08 +0100 Subject: [PATCH 14/41] Adapted the padding due to the font-size modification --- src/static/css/iframe_editor.css | 4 ++++ src/static/css/pad.css | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index d559efc84..34ab404a9 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -38,6 +38,10 @@ body.grayedout { background-color: #eee !important } color: black; } +.innerdocbody>div{ + padding: 1px; +} + body.doesWrap { /* white-space: pre-wrap; */ diff --git a/src/static/css/pad.css b/src/static/css/pad.css index cabde7ef2..eb62a6f9b 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -3,8 +3,9 @@ html, body, p { margin: 0; - padding: 0; + padding: 0px; } + .clear { clear: both } From e0582797f220a906293a0e8cbba2930df91dcb38 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sun, 31 Dec 2017 12:32:50 +0000 Subject: [PATCH 15/41] Call authentication hooks before default basic authentication. This allows authenticators to do any extra session setup for a given user, even if their username/password happens to match settings.json. --- src/node/hooks/express/webaccess.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/node/hooks/express/webaccess.js b/src/node/hooks/express/webaccess.js index 190021a3e..e0b35831c 100644 --- a/src/node/hooks/express/webaccess.js +++ b/src/node/hooks/express/webaccess.js @@ -36,13 +36,16 @@ exports.basicAuth = function (req, res, next) { var userpass = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString().split(":") var username = userpass.shift(); var password = userpass.join(':'); - - if (settings.users[username] != undefined && settings.users[username].password == password) { - settings.users[username].username = username; - req.session.user = settings.users[username]; - return cb(true); - } - return hooks.aCallFirst("authenticate", {req: req, res:res, next:next, username: username, password: password}, hookResultMangle(cb)); + var fallback = function(success) { + if (success) return cb(true); + if (settings.users[username] != undefined && settings.users[username].password == password) { + settings.users[username].username = username; + req.session.user = settings.users[username]; + return cb(true); + } + return cb(false); + }; + return hooks.aCallFirst("authenticate", {req: req, res:res, next:next, username: username, password: password}, hookResultMangle(fallback)); } hooks.aCallFirst("authenticate", {req: req, res:res, next:next}, hookResultMangle(cb)); } From a2992b3624ba283b56877ab70a3e2226ed7a8125 Mon Sep 17 00:00:00 2001 From: Man Yue Mo Date: Wed, 7 Feb 2018 08:43:07 +0000 Subject: [PATCH 16/41] fix jsonp checking. --- src/node/hooks/express/apicalls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/hooks/express/apicalls.js b/src/node/hooks/express/apicalls.js index 4482fd849..009a93d72 100644 --- a/src/node/hooks/express/apicalls.js +++ b/src/node/hooks/express/apicalls.js @@ -19,7 +19,7 @@ var apiCaller = function(req, res, fields) { apiLogger.info("RESPONSE, " + req.params.func + ", " + response); //is this a jsonp call, if yes, add the function call - if(req.query.jsonp && isVarName(response)) + if(req.query.jsonp && isVarName(req.query.jsonp)) response = req.query.jsonp + "(" + response + ")"; res._____send(response); From 4ae95c4107fc6dd056045a7f99b7d6510011e433 Mon Sep 17 00:00:00 2001 From: pedro-nonfree Date: Thu, 8 Feb 2018 19:58:27 +0100 Subject: [PATCH 17/41] documentation now is in doc/ (#3322) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e54ae18e6..85c146aee 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Etherpad is very customizable through plugins. Instructions for installing theme ## Helpful resources The [wiki](https://github.com/ether/etherpad-lite/wiki) is your one-stop resource for Tutorials and How-to's, really check it out! Also, feel free to improve these wiki pages. -Documentation can be found in `docs/`. +Documentation can be found in `doc/`. # Development From 0495dbdb16aa644a002d302a598c454088f55989 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Wed, 14 Feb 2018 18:07:50 +0100 Subject: [PATCH 18/41] Update ueberdb dep to 0.3.6 (#3326) --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index a29c06e5d..a88b5c6c9 100644 --- a/src/package.json +++ b/src/package.json @@ -17,7 +17,7 @@ "etherpad-require-kernel" : "1.0.9", "resolve" : "1.1.7", "socket.io" : "1.7.3", - "ueberdb2" : "0.3.0", + "ueberdb2" : "0.3.6", "express" : "4.13.4", "express-session" : "1.13.0", "cookie-parser" : "1.3.4", From 0c806b7fc0dad3c55f749e736aa8175bbb2a0e2b Mon Sep 17 00:00:00 2001 From: "translatewiki.net" Date: Thu, 15 Feb 2018 09:49:08 +0100 Subject: [PATCH 19/41] Localisation updates from https://translatewiki.net. --- src/locales/diq.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/diq.json b/src/locales/diq.json index 86f443147..a823232f5 100644 --- a/src/locales/diq.json +++ b/src/locales/diq.json @@ -47,7 +47,7 @@ "pad.settings.fontType.monospaced": "Yewca", "pad.settings.globalView": "Asayışo Global", "pad.settings.language": "Zıwan:", - "pad.importExport.import_export": "Zeredayış/Teberdayış", + "pad.importExport.import_export": "Zerredayış/Teberdayış", "pad.importExport.import": "Dosya ya zi dokumanê meqaleyê de tesadufi bar ke", "pad.importExport.importSuccessful": "Mıwafaq biye", "pad.importExport.export": "Mewcud bloknoti ateberd:", @@ -95,7 +95,7 @@ "timeslider.toolbar.returnbutton": "Peyser şo ped", "timeslider.toolbar.authors": "Nuştoği:", "timeslider.toolbar.authorsList": "Nuştoği çıniyê", - "timeslider.toolbar.exportlink.title": "Teber de", + "timeslider.toolbar.exportlink.title": "Teberdayış", "timeslider.exportCurrent": "Versiyonê enewki teber de:", "timeslider.version": "Versiyonê {{version}}", "timeslider.saved": "{{day}} {{month}}, {{year}} de biyo qeyd", From 187e51948d33d7715c7e59669267c1f53e17090b Mon Sep 17 00:00:00 2001 From: Luiza Pagliari Date: Fri, 16 Feb 2018 14:18:51 -0200 Subject: [PATCH 20/41] [fix] Don't show "pad deleted" message when copying pad (#3320) Fix #3183 --- src/node/db/Pad.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index d44cb7b36..0cb01cace 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -464,9 +464,10 @@ Pad.prototype.copy = function copy(destinationID, force, callback) { } else force = true; - //kick everyone from this pad - // TODO: this presents a message on the client saying that the pad was 'deleted'. Fix this? - padMessageHandler.kickSessionsFromPad(sourceID); + // Kick everyone from this pad. + // This was commented due to https://github.com/ether/etherpad-lite/issues/3183. + // Do we really need to kick everyone out? + // padMessageHandler.kickSessionsFromPad(sourceID); // flush the source pad: _this.saveToDatabase(); From 6f979ca1ef953a59c7ff85204476c046acd71641 Mon Sep 17 00:00:00 2001 From: "translatewiki.net" Date: Thu, 22 Feb 2018 12:08:59 +0100 Subject: [PATCH 21/41] Localisation updates from https://translatewiki.net. --- src/locales/fi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/fi.json b/src/locales/fi.json index e42847eee..0a8e43fb6 100644 --- a/src/locales/fi.json +++ b/src/locales/fi.json @@ -65,7 +65,7 @@ "pad.importExport.exportword": "Microsoft Word", "pad.importExport.exportpdf": "PDF", "pad.importExport.exportopen": "ODF (Open Document Format)", - "pad.importExport.abiword.innerHTML": "Tuonti on tuettu vain HTML- ja raakatekstitiedostoista. Lisätietoja tuonnin lisäasetuksista on sivulla install abiword.", + "pad.importExport.abiword.innerHTML": "Tuonti on tuettu vain HTML- ja raakatekstitiedostoista. Monipuoliset tuontiominaisuudet ovat käytettävissä asentamalla AbiWord.", "pad.modals.connected": "Yhdistetty.", "pad.modals.reconnecting": "Muodostetaan yhteyttä muistioon uudelleen...", "pad.modals.forcereconnect": "Pakota yhdistämään uudelleen", From 67a4209df9e6ef8fec1665a366e0632c7cc1eb06 Mon Sep 17 00:00:00 2001 From: sevu Date: Wed, 28 Feb 2018 10:53:13 +0100 Subject: [PATCH 22/41] use apt instead of apt-get (#3330) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85c146aee..d0d224334 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ If cloning to a subdirectory within another project, you may need to do the foll ## GNU/Linux and other UNIX-like systems You'll need gzip, git, curl, libssl develop libraries, python and gcc. -- *For Debian/Ubuntu*: `apt-get install gzip git curl python libssl-dev pkg-config build-essential` +- *For Debian/Ubuntu*: `apt install gzip git curl python libssl-dev pkg-config build-essential` - *For Fedora/CentOS*: `yum install gzip git curl python openssl-devel && yum groupinstall "Development Tools"` - *For FreeBSD*: `portinstall node, npm, curl, git (optional)` From 0139965864ab88cdd6bdbd27fa6f933d2dc1ccf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Severin=20Gl=C3=B6ckner?= Date: Sun, 25 Feb 2018 16:20:58 +0100 Subject: [PATCH 23/41] specify python version --- bin/dirty-db-cleaner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dirty-db-cleaner.py b/bin/dirty-db-cleaner.py index 8ed9c5065..d3e49a0d2 100755 --- a/bin/dirty-db-cleaner.py +++ b/bin/dirty-db-cleaner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -u +#!/usr/bin/env PYTHONUNBUFFERED=1 python2 # # Created by Bjarni R. Einarsson, placed in the public domain. Go wild! # From 6aa19c56a8af9028381ae67e15e41bec7b8e0553 Mon Sep 17 00:00:00 2001 From: "translatewiki.net" Date: Thu, 8 Mar 2018 09:28:32 +0100 Subject: [PATCH 24/41] Localisation updates from https://translatewiki.net. --- src/locales/cs.json | 5 ++++- src/locales/fr.json | 5 +++-- src/locales/te.json | 9 +++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/locales/cs.json b/src/locales/cs.json index cda8ccb08..10fc55e17 100644 --- a/src/locales/cs.json +++ b/src/locales/cs.json @@ -8,7 +8,8 @@ "Quinn", "Aktron", "Mormegil", - "Dvorapa" + "Dvorapa", + "Clon" ] }, "index.newPad": "Založ nový Pad", @@ -63,6 +64,8 @@ "pad.modals.connected": "Připojeno.", "pad.modals.reconnecting": "Znovupřipojování k Padu…", "pad.modals.forcereconnect": "Vynutit znovupřipojení", + "pad.modals.reconnecttimer": "Zkouším to znovu připojit", + "pad.modals.cancel": "Zrušit", "pad.modals.userdup": "Otevřeno v jiném okně", "pad.modals.userdup.explanation": "Zdá se, že tento Pad je na tomto počítači otevřen ve více než jednom okně.", "pad.modals.userdup.advice": "Pro použití tohoto okna je třeba se znovu připojit.", diff --git a/src/locales/fr.json b/src/locales/fr.json index 5f6b664a8..29583d092 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -23,7 +23,8 @@ "Fylip22", "C13m3n7", "Wladek92", - "Urhixidur" + "Urhixidur", + "Envlh" ] }, "index.newPad": "Nouveau pad", @@ -48,7 +49,7 @@ "pad.colorpicker.save": "Enregistrer", "pad.colorpicker.cancel": "Annuler", "pad.loading": "Chargement…", - "pad.noCookie": "Le témoin (cookie) n’a pas pu être trouvé. Veuillez autoriser les témoins dans votre navigateur !", + "pad.noCookie": "Le cookie n’a pas pu être trouvé. Veuillez autoriser les cookies dans votre navigateur !", "pad.passwordRequired": "Vous avez besoin d'un mot de passe pour accéder à ce pad", "pad.permissionDenied": "Vous n'avez pas la permission d’accéder à ce pad", "pad.wrongPassword": "Votre mot de passe est incorrect", diff --git a/src/locales/te.json b/src/locales/te.json index 846ced8e3..13af39709 100644 --- a/src/locales/te.json +++ b/src/locales/te.json @@ -11,12 +11,12 @@ }, "index.newPad": "కొత్త పలక", "index.createOpenPad": "ఒక పేరుతో పలకని సృష్టించండి లేదా అదే పేరుతో ఉన్న పలకని తెరవండి", - "pad.toolbar.bold.title": "మందం", - "pad.toolbar.italic.title": "వాలు అక్షరాలు", + "pad.toolbar.bold.title": "బొద్దు (Ctrl+B)", + "pad.toolbar.italic.title": "వాలు (Ctrl+I)", "pad.toolbar.underline.title": "క్రిందగీత", "pad.toolbar.strikethrough.title": "కొట్టివేత (Ctrl+5)", - "pad.toolbar.ol.title": "నిర్ధేశింపబడిన జాబితా", - "pad.toolbar.ul.title": "అనిర్దేశిత జాబితా, ( క్రమపద్ధతి లేని జాబితా )", + "pad.toolbar.ol.title": "క్రమ జాబితా (Ctrl+Shift+N)", + "pad.toolbar.ul.title": "బిందు జాబితా (Ctrl+Shift+L)", "pad.toolbar.undo.title": "చేయవద్దు", "pad.toolbar.redo.title": "తిరిగిచెయ్యి", "pad.toolbar.clearAuthorship.title": "మూలకర్తపు వర్ణాలను తీసివేయండి", @@ -53,6 +53,7 @@ "pad.modals.connected": "సంబంధం కుదిరింది.", "pad.modals.reconnecting": "మీ పలకకు మరల సంబంధం కలుపుతుంది...", "pad.modals.forcereconnect": "బలవంతంగానైనా సంబంధం కుదిరించు", + "pad.modals.cancel": "రద్దుచేయి", "pad.modals.userdup.explanation": "ఈ పలక, ఈ కంప్యూటర్లో ఒకటికన్న ఎక్కువ గవాక్షములలో తెరుచుకున్నట్లు అనిపిస్తుంది.", "pad.modals.userdup.advice": "బదులుగా ఈ గవాక్షమును వాడడానికి మరల సంబంధం కలపండి", "pad.modals.unauth": "అధికారం లేదు", From 82816acf4a41448eb0edb60bddae451ed2242122 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Thu, 8 Mar 2018 14:44:11 +0100 Subject: [PATCH 25/41] Fix .doc export with LibreOffice (soffice) (#3338) When using LibreOffice to convert pads to doc, we got `Error: no export filter for /tmp/xxxx.doc` (tested with LO 5 and 6). Maybe it's a regression from LO. Anyway, converting HTML to odt, then to doc works. Thx to lpagliari for her review! --- src/node/utils/LibreOffice.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/node/utils/LibreOffice.js b/src/node/utils/LibreOffice.js index 415772456..3cf63e1d6 100644 --- a/src/node/utils/LibreOffice.js +++ b/src/node/utils/LibreOffice.js @@ -35,7 +35,21 @@ var queue = async.queue(doConvertTask, 1); * @param {Function} callback Standard callback function */ exports.convertFile = function(srcFile, destFile, type, callback) { - queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback}); + // soffice can't convert from html to doc directly (verified with LO 5 and 6) + // we need to convert to odt first, then to doc + // to avoid `Error: no export filter for /tmp/xxxx.doc` error + if (type === 'doc') { + queue.push({ + "srcFile": srcFile, + "destFile": destFile.replace(/\.doc$/, '.odt'), + "type": 'odt', + "callback": function () { + queue.push({"srcFile": srcFile.replace(/\.html$/, '.odt'), "destFile": destFile, "type": type, "callback": callback}); + } + }); + } else { + queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback}); + } }; function doConvertTask(task, callback) { From 5c864ec47d32593a156855c989b0a39a73f5c315 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 9 Mar 2018 13:45:24 +0100 Subject: [PATCH 26/41] Add checkPad variant to check all pads/revisions --- bin/checkAllPads.js | 138 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 bin/checkAllPads.js diff --git a/bin/checkAllPads.js b/bin/checkAllPads.js new file mode 100644 index 000000000..1657ba794 --- /dev/null +++ b/bin/checkAllPads.js @@ -0,0 +1,138 @@ +/* + This is a debug tool. It checks all revisions of all pads for data corruption +*/ + +if(process.argv.length != 2) +{ + console.error("Use: node bin/checkAllPads.js"); + process.exit(1); +} + +//initalize the variables +var db, settings, padManager; +var npm = require("../src/node_modules/npm"); +var async = require("../src/node_modules/async"); + +var Changeset = require("../src/static/js/Changeset"); + +async.series([ + //load npm + function(callback) { + npm.load({}, callback); + }, + //load modules + function(callback) { + settings = require('../src/node/utils/Settings'); + db = require('../src/node/db/DB'); + + //initalize the database + db.init(callback); + }, + //load pads + function (callback) + { + padManager = require('../src/node/db/PadManager'); + + padManager.listAllPads(function(err, res) + { + var padIds = res.padIDs; + pads = []; + async.forEach(padIds, function(padId, callback) { + padManager.getPad(padId, function(err, pad) { + pads.push(pad); + callback(err); + }) + }, callback); + }); + }, + function (callback) + { + async.forEach(pads, function(pad, callback) + { + //create an array with key kevisions + //key revisions always save the full pad atext + var head = pad.getHeadRevisionNumber(); + var keyRevisions = []; + for(var i=0;i Date: Fri, 9 Mar 2018 14:02:22 +0100 Subject: [PATCH 27/41] checkAllPads: Increase performance/resilience Performance: Don't preload pads. Check for pool only once per pad. Resilience: Handle missing revision. --- bin/checkAllPads.js | 151 +++++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 72 deletions(-) diff --git a/bin/checkAllPads.js b/bin/checkAllPads.js index 1657ba794..90cb15276 100644 --- a/bin/checkAllPads.js +++ b/bin/checkAllPads.js @@ -1,5 +1,5 @@ /* - This is a debug tool. It checks all revisions of all pads for data corruption + This is a debug tool. It checks all revisions for data corruption */ if(process.argv.length != 2) @@ -35,96 +35,103 @@ async.series([ padManager.listAllPads(function(err, res) { - var padIds = res.padIDs; - pads = []; - async.forEach(padIds, function(padId, callback) { - padManager.getPad(padId, function(err, pad) { - pads.push(pad); - callback(err); - }) - }, callback); + padIds = res.padIDs; + callback(err); }); }, function (callback) { - async.forEach(pads, function(pad, callback) + async.forEach(padIds, function(padId, callback) { - //create an array with key kevisions - //key revisions always save the full pad atext - var head = pad.getHeadRevisionNumber(); - var keyRevisions = []; - for(var i=0;i Date: Mon, 12 Mar 2018 08:57:37 +0100 Subject: [PATCH 28/41] Localisation updates from https://translatewiki.net. --- src/locales/ku-latn.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/locales/ku-latn.json b/src/locales/ku-latn.json index 725a84d72..b5edc68b0 100644 --- a/src/locales/ku-latn.json +++ b/src/locales/ku-latn.json @@ -5,7 +5,8 @@ "Dilyaramude", "George Animal", "Gomada", - "Mehk63" + "Mehk63", + "Ghybu" ] }, "index.newPad": "Bloknota nû", @@ -40,6 +41,7 @@ "pad.importExport.exportpdf": "PDF", "pad.modals.connected": "Hate girêdan.", "pad.modals.reconnecting": "Ji bloknota te re dîsa tê girêdan...", + "pad.modals.cancel": "Betal bike", "pad.modals.userdup": "Di pencereyek din de vebû", "pad.modals.userdup.advice": "Ji bo di vê pencereye de bikarbînîy dîsa giredanek çeke.", "pad.modals.unauth": "Desthilatdar nîne", From d80d64a217196a704d5a045c21ac01794282b6c6 Mon Sep 17 00:00:00 2001 From: "translatewiki.net" Date: Mon, 19 Mar 2018 20:58:02 +0100 Subject: [PATCH 29/41] Localisation updates from https://translatewiki.net. --- src/locales/pms.json | 40 ++++++++++++++++++++++++++++++++++++++++ src/locales/ru.json | 5 +++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/locales/pms.json diff --git a/src/locales/pms.json b/src/locales/pms.json new file mode 100644 index 000000000..8375f1684 --- /dev/null +++ b/src/locales/pms.json @@ -0,0 +1,40 @@ +{ + "@metadata": { + "authors": [ + "Borichèt" + ] + }, + "index.newPad": "Feuj neuv", + "index.createOpenPad": "o creé/duverté un feuj antitolà:", + "pad.toolbar.bold.title": "Grassèt (Ctrl+B)", + "pad.toolbar.italic.title": "Corsiv (Ctrl+I)", + "pad.toolbar.underline.title": "Sotlignà (Ctrl+U)", + "pad.toolbar.strikethrough.title": "Barà (Ctrl+5)", + "pad.toolbar.ol.title": "Lista ordinà (Ctrl+Shift+N)", + "pad.toolbar.ul.title": "Lista nen ordinà (Ctrl+Shift+L)", + "pad.toolbar.indent.title": "Andenté (TAB)", + "pad.toolbar.unindent.title": "Disandenté (Maj+TAB)", + "pad.toolbar.undo.title": "Anulé (Ctrl+Z)", + "pad.toolbar.redo.title": "Ristabilì (Ctrl+Y)", + "pad.toolbar.clearAuthorship.title": "Dëscancelé ij color ch'a identìfico j'autor (Ctrl+Shift+C)", + "pad.toolbar.import_export.title": "Amporté/Esporté da/vers dij formà d'archivi diferent", + "pad.toolbar.timeslider.title": "Stòria dinàmica", + "pad.toolbar.savedRevision.title": "Argistré la revision", + "pad.toolbar.settings.title": "Paràmeter", + "pad.toolbar.embed.title": "Partagé e antëgré ës feuj", + "pad.toolbar.showusers.title": "Smon-e j'utent ansima a 's feuj", + "pad.colorpicker.save": "Argistré", + "pad.colorpicker.cancel": "Anulé", + "pad.loading": "Antramentr ch'as caria…", + "pad.noCookie": "Ël bëscotin a l'é nen ëstàit trovà. Për piasì, ch'a autorisa ij bëscotin su sò navigador!", + "pad.passwordRequired": "A l'ha da manca ëd na ciav për acede a cost feuj-sì", + "pad.permissionDenied": "A l'ha nen ël përmess d'acede a 's feuj-sì", + "pad.wrongPassword": "Soa ciav a l'era nen giusta", + "pad.settings.padSettings": "Paràmeter dël feuj", + "pad.settings.myView": "Mia vista", + "pad.settings.stickychat": "Ciaciarade sempe an slë scren", + "pad.settings.chatandusers": "Smon-e le ciaciarade e j'utent", + "pad.settings.colorcheck": "Color d'identificassion", + "pad.settings.linenocheck": "Nùmer ëd linia", + "pad.settings.rtlcheck": "Ël contnù, dev-lo esse lesù da drita a snistra?" +} diff --git a/src/locales/ru.json b/src/locales/ru.json index b9fbc3c82..801ceaa39 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -7,7 +7,8 @@ "Okras", "Volkov", "Nzeemin", - "Facenapalm" + "Facenapalm", + "Patrick Star" ] }, "index.newPad": "Создать", @@ -58,7 +59,7 @@ "pad.importExport.exportword": "Microsoft Word", "pad.importExport.exportpdf": "PDF", "pad.importExport.exportopen": "ODF (документ OpenOffice)", - "pad.importExport.abiword.innerHTML": "Вы можете импортировать только из обычного текста или HTML. Для более продвинутых функций импорта, пожалуйста, установите AbiWord.", + "pad.importExport.abiword.innerHTML": "Вы можете импортировать только из обычного текста или HTML. Для более продвинутых функций импорта, пожалуйста, установите AbiWord.", "pad.modals.connected": "Подключен.", "pad.modals.reconnecting": "Повторное подключение к вашему документу", "pad.modals.forcereconnect": "Принудительное переподключение", From cb856ea6246f2db206eae9f9e9b6e4193612f01d Mon Sep 17 00:00:00 2001 From: "translatewiki.net" Date: Thu, 22 Mar 2018 08:09:21 +0100 Subject: [PATCH 30/41] Localisation updates from https://translatewiki.net. --- src/locales/pms.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/locales/pms.json b/src/locales/pms.json index 8375f1684..80a857e39 100644 --- a/src/locales/pms.json +++ b/src/locales/pms.json @@ -36,5 +36,13 @@ "pad.settings.chatandusers": "Smon-e le ciaciarade e j'utent", "pad.settings.colorcheck": "Color d'identificassion", "pad.settings.linenocheck": "Nùmer ëd linia", - "pad.settings.rtlcheck": "Ël contnù, dev-lo esse lesù da drita a snistra?" + "pad.settings.rtlcheck": "Ël contnù, dev-lo esse lesù da drita a snistra?", + "pad.settings.fontType": "Sòrt ëd caràter:", + "pad.settings.globalView": "Vista d'ansem", + "pad.settings.language": "Lenga:", + "pad.importExport.import_export": "Amporté/Esporté", + "pad.importExport.import": "Carié n'archivi o document ëd test", + "pad.importExport.importSuccessful": "Bele fàit!", + "pad.importExport.export": "Esporté ël feuj atual coma:", + "pad.importExport.exportetherpad": "Etherpad" } From b0da9a579d1f871b8d484fbc22b73c84297bc8ff Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Sun, 25 Mar 2018 19:24:52 +0200 Subject: [PATCH 31/41] Fix numbering line when plugin add padding-top (like ep_page_view) --- src/static/js/ace2_inner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index df9c96425..90cefa506 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -5404,8 +5404,8 @@ function Ace2Inner(){ // height is taken to be the top offset of the next line. If we // didn't do this special case, we would miss out on any top margin // included on the first line. The default stylesheet doesn't add - // extra margins, but plugins might. - h = b.nextSibling.offsetTop; + // extra margins/padding, but plugins might. + h = b.nextSibling.offsetTop - window.getComputedStyle(doc.body).getPropertyValue("padding-top"); } else { h = b.nextSibling.offsetTop - b.offsetTop; } From 4a18f0d97d9654a6a3749b67b0f24f0c7d5c94ff Mon Sep 17 00:00:00 2001 From: Bryce York Date: Wed, 28 Mar 2018 22:38:30 +1100 Subject: [PATCH 32/41] Fix bug with cleanRun.sh Now works if the output of `pwd` has a space in it. --- bin/cleanRun.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cleanRun.sh b/bin/cleanRun.sh index ef802815d..57325dd23 100755 --- a/bin/cleanRun.sh +++ b/bin/cleanRun.sh @@ -38,4 +38,4 @@ bin/installDeps.sh $* || exit 1 echo "Started Etherpad..." SCRIPTPATH=`pwd -P` -node $SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js $* +node "${$SCRIPTPATH}/node_modules/ep_etherpad-lite/node/server.js" $* From 6047c0de09cf11c2d23eaa0af3527644afcca7f9 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Apr 2018 12:52:34 +0100 Subject: [PATCH 33/41] Make README not suck. --- README.md | 99 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index d0d224334..ad7cc6c5b 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,38 @@ +### This project is looking for a new project lead. If you wish to help steer Etherpad forward please email contact@etherpad.org + # A really-real time collaborative word processor for the web -![alt text](https://i.imgur.com/zYrGkg3.gif "Etherpad in action on PrimaryPad") +![Demo Etherpad Animated Jif](https://i.imgur.com/zYrGkg3.gif "Etherpad in action on PrimaryPad") # About -Etherpad is a really-real time collaborative editor maintained by the Etherpad Community. - -Etherpad is written in JavaScript (99.9%) on both the server and client so it's easy for developers to maintain and add new features. Because of this Etherpad has tons of customizations that you can leverage. - -Etherpad is designed to be easily embeddable and provides a [HTTP API](https://github.com/ether/etherpad-lite/wiki/HTTP-API) -that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. - -There is also a [jQuery plugin](https://github.com/ether/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. - -There's also a full-featured plugin framework, allowing you to easily add your own features. By default your Etherpad is rather sparse and because Etherpad takes a lot of its inspiration from WordPress, plugins are really easy to install and update. Once you have Etherpad installed you should visit the plugin page and take control. - -Finally, Etherpad comes with translations into most languages! Users are automatically delivered the correct language for their local settings. - - -**Visit [beta.etherpad.org](http://beta.etherpad.org) to test it live.** - -Also, check out the **[FAQ](https://github.com/ether/etherpad-lite/wiki/FAQ)**, really! +Etherpad is a really-real time collaborative editor scalable to thousands of simultanious real time users. Unlike all other collaborative tools Etherpad provides full fidelity data export and portability making it fully GDPR compliant. **Visit [beta.etherpad.org](http://beta.etherpad.org) to try it out.** # Installation -Etherpad works with node v0.10+ (except 6.0 and 6.1). +## Uber-Quick Ubuntu +``` +curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - +sudo apt-get install -y nodejs +git clone git://github.com/ether/etherpad-lite.git && cd etherpad-lite && bin/run.sh +``` + +## GNU/Linux and other UNIX-like systems +You'll need gzip, git, curl, libssl develop libraries, python and gcc. +- *For Debian/Ubuntu*: `apt install gzip git curl python libssl-dev pkg-config build-essential` +- *For Fedora/CentOS*: `yum install gzip git curl python openssl-devel && yum groupinstall "Development Tools"` +- *For FreeBSD*: `portinstall node, npm, curl, git (optional)` + +Additionally, you'll need [node.js](https://nodejs.org) installed, Ideally the latest stable version, we recommend installing/compiling nodejs from source (avoiding apt). + +**As any user (we recommend creating a separate user called etherpad):** + +1. Move to a folder where you want to install Etherpad. Clone the git repository `git clone git://github.com/ether/etherpad-lite.git` +2. Change into the new directory containing the cloned source code `cd etherpad-lite` + +Now, run `bin/run.sh` and open in your browser. + +Update to the latest version with `git pull origin`. The next start with bin/run.sh will update the dependencies. + +[Next steps](#next-steps). ## Windows @@ -52,27 +62,6 @@ If cloning to a subdirectory within another project, you may need to do the foll 2. Edit the db `filename` in `settings.json` to the relative directory with the file (e.g. `application/lib/etherpad-lite/var/dirty.db`) 3. Add auto-generated files to the main project `.gitignore` -[Next steps](#next-steps). - -## GNU/Linux and other UNIX-like systems -You'll need gzip, git, curl, libssl develop libraries, python and gcc. -- *For Debian/Ubuntu*: `apt install gzip git curl python libssl-dev pkg-config build-essential` -- *For Fedora/CentOS*: `yum install gzip git curl python openssl-devel && yum groupinstall "Development Tools"` -- *For FreeBSD*: `portinstall node, npm, curl, git (optional)` - -Additionally, you'll need [node.js](https://nodejs.org) installed, Ideally the latest stable version, we recommend installing/compiling nodejs from source (avoiding apt). - -**As any user (we recommend creating a separate user called etherpad):** - -1. Move to a folder where you want to install Etherpad. Clone the git repository `git clone git://github.com/ether/etherpad-lite.git` -2. Change into the new directory containing the cloned source code `cd etherpad-lite` - -Now, run `bin/run.sh` and open in your browser. - -Update to the latest version with `git pull origin`. The next start with bin/run.sh will update the dependencies. - -You like it? [Next steps](#next-steps). - # Next Steps ## Tweak the settings @@ -85,7 +74,7 @@ You should use a dedicated database such as "mysql", if you are planning on usin Etherpad is very customizable through plugins. Instructions for installing themes and plugins can be found in [the plugin wiki article](https://github.com/ether/etherpad-lite/wiki/Available-Plugins). ## Helpful resources -The [wiki](https://github.com/ether/etherpad-lite/wiki) is your one-stop resource for Tutorials and How-to's, really check it out! Also, feel free to improve these wiki pages. +The [wiki](https://github.com/ether/etherpad-lite/wiki) is your one-stop resource for Tutorials and How-to's. Documentation can be found in `doc/`. @@ -100,7 +89,7 @@ You can debug Etherpad using `bin/debugRun.sh`. If you want to find out how Etherpad's `Easysync` works (the library that makes it really realtime), start with this [PDF](https://github.com/ether/etherpad-lite/raw/master/doc/easysync/easysync-full-description.pdf) (complex, but worth reading). -## Getting started +## Contributing You know all this and just want to know how you can help? Look at the [TODO list](https://github.com/ether/etherpad-lite/wiki/TODO) and our [Issue tracker](https://github.com/ether/etherpad-lite/issues). (Please consider using [jshint](http://www.jshint.com/about/), if you plan to contribute code.) @@ -108,18 +97,34 @@ Look at the [TODO list](https://github.com/ether/etherpad-lite/wiki/TODO) and ou Also, and most importantly, read our [**Developer Guidelines**](https://github.com/ether/etherpad-lite/blob/master/CONTRIBUTING.md), really! # Get in touch -Join the [mailinglist](https://groups.google.com/group/etherpad-lite-dev) and make some noise on our busy freenode irc channel [#etherpad-lite-dev](https://webchat.freenode.net?channels=#etherpad-lite-dev)! +[mailinglist](https://groups.google.com/group/etherpad-lite-dev) +[#etherpad-lite-dev freenode IRC](https://webchat.freenode.net?channels=#etherpad-lite-dev)! -# Modules created for this project +# Languages +Etherpad is written in JavaScript on both the server and client so it's easy for developers to maintain and add new features. -* [ueberDB](https://github.com/Pita/ueberDB) "transforms every database into a object key value store" - manages all database access -* [channels](https://github.com/Pita/channels) "Event channels in node.js" - ensures that ueberDB operations are atomic and in series for each key -* [async-stacktrace](https://github.com/Pita/async-stacktrace) "Improves node.js stacktraces and makes it easier to handle errors" +# HTTP API +Etherpad is designed to be easily embeddable and provides a [HTTP API](https://github.com/ether/etherpad-lite/wiki/HTTP-API) +that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. + +# jQuery plugin +There is also a [jQuery plugin](https://github.com/ether/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. + +# Plugin Framework +Etherpad offers a plugin framework, allowing you to easily add your own features. By default your Etherpad is extremely light-weight and it's up to you to customize your experience. Once you have Etherpad installed you should visit the plugin page and take control. + +# Translations / Localizations (i18n / l10n) +Etherpad comes with translations into all languages thanks to the team at TranslateWiki. + +# FAQ +Visit the **[FAQ](https://github.com/ether/etherpad-lite/wiki/FAQ)**. # Donate! * [Flattr](https://flattr.com/thing/71378/Etherpad-Foundation) * Paypal - Press the donate button on [etherpad.org](http://etherpad.org) * [Bitcoin](https://coinbase.com/checkouts/1e572bf8a82e4663499f7f1f66c2d15a) +All donations go to the Etherpad foundation which is part of Software Freedom Conservency + # License [Apache License v2](http://www.apache.org/licenses/LICENSE-2.0.html) From 09c2c034c4733a512b972b0f1877e68c63b64288 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Apr 2018 12:57:14 +0100 Subject: [PATCH 34/41] Continue to make README suck even less.. REALLY! --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ad7cc6c5b..b01fa4ab6 100644 --- a/README.md +++ b/README.md @@ -90,11 +90,7 @@ You can debug Etherpad using `bin/debugRun.sh`. If you want to find out how Etherpad's `Easysync` works (the library that makes it really realtime), start with this [PDF](https://github.com/ether/etherpad-lite/raw/master/doc/easysync/easysync-full-description.pdf) (complex, but worth reading). ## Contributing -You know all this and just want to know how you can help? - -Look at the [TODO list](https://github.com/ether/etherpad-lite/wiki/TODO) and our [Issue tracker](https://github.com/ether/etherpad-lite/issues). (Please consider using [jshint](http://www.jshint.com/about/), if you plan to contribute code.) - -Also, and most importantly, read our [**Developer Guidelines**](https://github.com/ether/etherpad-lite/blob/master/CONTRIBUTING.md), really! +Read our [**Developer Guidelines**](https://github.com/ether/etherpad-lite/blob/master/CONTRIBUTING.md) # Get in touch [mailinglist](https://groups.google.com/group/etherpad-lite-dev) @@ -108,7 +104,7 @@ Etherpad is designed to be easily embeddable and provides a [HTTP API](https://g that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. # jQuery plugin -There is also a [jQuery plugin](https://github.com/ether/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. +There is a [jQuery plugin](https://github.com/ether/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. # Plugin Framework Etherpad offers a plugin framework, allowing you to easily add your own features. By default your Etherpad is extremely light-weight and it's up to you to customize your experience. Once you have Etherpad installed you should visit the plugin page and take control. From 8edd8e1291ececb4d6b873df13f72b5b36b7f380 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Apr 2018 15:47:02 +0100 Subject: [PATCH 35/41] Update package.json --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index a88b5c6c9..039bfc7bb 100644 --- a/src/package.json +++ b/src/package.json @@ -28,7 +28,7 @@ "log4js" : "0.6.35", "cheerio" : "0.20.0", "async-stacktrace" : "0.0.2", - "npm" : "4.0.2", + "npm" : ">=4.0.2", "ejs" : "2.5.7", "graceful-fs" : "4.1.3", "slide" : "1.1.6", From ba732a6b9eebbf88887fdb052ab36d449c72cb30 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Apr 2018 18:05:26 +0100 Subject: [PATCH 36/41] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b01fa4ab6..f464a91db 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ ### This project is looking for a new project lead. If you wish to help steer Etherpad forward please email contact@etherpad.org +[![Deps](https://david-dm.org/ether/etherpad-lite.svg?branch=develop)](https://david-dm.org/ether/etherpad-lite) +[![NSP Status](https://nodesecurity.io/orgs/etherpad/projects/635f6185-35c6-4ed7-931a-0bc62758ece7/badge)](https://nodesecurity.io/orgs/etherpad/projects/635f6185-35c6-4ed7-931a-0bc62758ece7) + # A really-real time collaborative word processor for the web ![Demo Etherpad Animated Jif](https://i.imgur.com/zYrGkg3.gif "Etherpad in action on PrimaryPad") From f5aed706b79cab1d50c94bccd9e36d69dd70b24f Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Apr 2018 19:55:55 +0100 Subject: [PATCH 37/41] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f464a91db..3ab7e3584 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ ![Demo Etherpad Animated Jif](https://i.imgur.com/zYrGkg3.gif "Etherpad in action on PrimaryPad") # About -Etherpad is a really-real time collaborative editor scalable to thousands of simultanious real time users. Unlike all other collaborative tools Etherpad provides full fidelity data export and portability making it fully GDPR compliant. **Visit [beta.etherpad.org](http://beta.etherpad.org) to try it out.** +Etherpad is a really-real time collaborative editor scalable to thousands of simultanious real time users. Unlike all other collaborative tools Etherpad provides full fidelity data export and portability making it fully GDPR compliant. + +**[Try it out](http://beta.etherpad.org)** # Installation From 64a2e5b7a398589dc4a63d2a9caa6718f5794f50 Mon Sep 17 00:00:00 2001 From: Mikk Andresen Date: Wed, 4 Apr 2018 13:52:59 +0300 Subject: [PATCH 38/41] Upgrade Ueberdb2 to 0.3.7 to fix https://github.com/ether/etherpad-lite/issues/3348 --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index 039bfc7bb..67ac8a0e7 100644 --- a/src/package.json +++ b/src/package.json @@ -17,7 +17,7 @@ "etherpad-require-kernel" : "1.0.9", "resolve" : "1.1.7", "socket.io" : "1.7.3", - "ueberdb2" : "0.3.6", + "ueberdb2" : "0.3.7", "express" : "4.13.4", "express-session" : "1.13.0", "cookie-parser" : "1.3.4", From c9863f81ad8732918236ade7131852f86b6748fb Mon Sep 17 00:00:00 2001 From: ilmar Date: Wed, 2 May 2018 11:08:57 +0300 Subject: [PATCH 39/41] sync with ether/etherpad-lite --- CHANGELOG.md | 33 ++++-- CONTRIBUTING.md | 20 +++- README.md | 2 +- src/locales/pms.json | 83 ++++++++++++++- src/locales/zh-hant.json | 2 +- src/node/handler/PadMessageHandler.js | 95 +++++++++++++++++ src/node/hooks/express.js | 4 + src/node/hooks/express/apicalls.js | 10 +- src/node/hooks/express/importexport.js | 20 +++- src/node/hooks/express/isValidJSONPName.js | 83 +++++++++++++++ src/node/hooks/express/webaccess.js | 5 +- src/node/utils/ExportEtherpad.js | 27 ++--- src/node/utils/ExportHtml.js | 31 +++--- src/package.json | 15 ++- src/static/css/iframe_editor.css | 14 +-- src/static/css/pad.css | 6 +- src/static/js/admin/plugins.js | 11 +- src/static/js/collab_client.js | 113 ++++++++++++++++++--- src/static/js/pad.js | 11 +- src/templates/export_html.html | 1 - 20 files changed, 491 insertions(+), 95 deletions(-) create mode 100644 src/node/hooks/express/isValidJSONPName.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 74d06f453..df249c258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +# 1.6.5 + * SECURITY: Escape data when listing available plugins + * FIX: Fix typo in apicalls.js which prevented importing isValidJSONPName + * FIX: fixed plugin dependency issue + * FIX: Update iframe_editor.css + * FIX: unbreak Safari iOS line wrapping + +# 1.6.4 + * SECURITY: exploitable /admin access - CVE-2018-9845 + * SECURITY: DoS with pad exports - CVE-2018-9327 + * SECURITY: Remote Code Execution - CVE-2018-9326 + * SECURITY: Pad data leak - CVE-2018-9325 + * Fix: Admin redirect URL + * Fix: Various script Fixes + * Fix: Various CSS/Style/Layout fixes + * NEW: Improved Pad contents readability + * NEW: Hook: onAccessCheck + * NEW: SESSIONKEY and APIKey customizable path + * NEW: checkPads script + * NEW: Support "cluster mode" + # 1.6.3 * SECURITY: Update ejs * SECURITY: xss vulnerability when reading window.location.href @@ -56,7 +77,7 @@ * NEW: Allow LibreOffice to be used when exporting a pad * NEW: Create hook exportHtmlAdditionalTagsWithData * NEW: Improve DB migration performance - * NEW: allow settings to be applied from the filesystem + * NEW: allow settings to be applied from the filesystem * NEW: remove applySettings hook and allow credentials.json to be part of core * NEW: Use exec to switch to node process * NEW: Validate incoming color codes @@ -85,7 +106,7 @@ * Fix: switchToPad method * Fix: Dead keys * Fix: Preserve new lines in copy-pasted text - * Fix: Compatibility mode on IE + * Fix: Compatibility mode on IE * Fix: Content Collector to get the class of the DOM-node * Fix: Timeslider export links * Fix: Double prompt on file upload @@ -212,7 +233,7 @@ * Fix: Session Deletion error * Fix: Allow browser tabs to be cycled when focus is in editor * Fix: Various Editor issues with Easysync potentially entering forever loop on bad changeset - + # 1.4 * NEW: Disable toolbar items through settings.json * NEW: Internal stats/metrics engine @@ -244,7 +265,7 @@ # 1.3 * NEW: We now follow the semantic versioning scheme! * NEW: Option to disable IP logging - * NEW: Localisation updates from http://translatewiki.net. + * NEW: Localisation updates from http://translatewiki.net. * Fix: Fix readOnly group pads * Fix: don't fetch padList on every request @@ -337,7 +358,7 @@ * NEW: Add authorId to chat and userlist as a data attribute * NEW: Refactor and fix our frontend tests * NEW: Localisation updates - + # 1.2.81 * Fix: CtrlZ-Y for Undo Redo @@ -377,7 +398,7 @@ * Other: Change loading message asking user to please wait on first build * Other: Allow etherpad to use global npm installation (Safe since node 6.3) * Other: Better documentation for log rotation and log message handling - + # 1.2.7 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09ddc286d..669460801 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Developer Guidelines +# Contributor Guidelines (Please talk to people on the mailing list before you change this page, see our section on [how to get in touch](https://github.com/ether/etherpad-lite#get-in-touch)) ## How to write a bug report @@ -35,7 +35,7 @@ The logfile location is defined in startup script or the log is directly shown i To make sure everybody is going in the same direction: * easy to install for admins and easy to use for people * easy to integrate into other apps, but also usable as standalone -* using less resources on server side +* lightweight and scalable * extensible, as much functionality should be extendable with plugins so changes don't have to be done in core. Also, keep it maintainable. We don't wanna end up as the monster Etherpad was! @@ -92,3 +92,19 @@ You can build the docs e.g. produce html, using `make docs`. At some point in th ## Testing Front-end tests are found in the `tests/frontend/` folder in the repository. Run them by pointing your browser to `/tests/frontend`. + +## Things you can help with +Etherpad is much more than software. So if you aren't a developer then worry not, there is still a LOT you can do! A big part of what we do is community engagement. You can help in the following ways + * Triage bugs (applying labels) and confirming their existance + * Testing fixes (simply applying them and seeing if it fixes your issue or not) - Some git experience required + * Notifying large site admins of new releases + * Writing Changelogs for releases + * Creating Windows packages + * Creating releases + * Bumping dependencies periodically and checking they don't break anything + * Write proposals for grants + * Co-Author and Publish CVEs + * Work with SFC to maintain legal side of project + * Maintain TODO page - https://github.com/ether/etherpad-lite/wiki/TODO#IMPORTANT_TODOS + * Replying to messages on IRC / The Mailing list / Emails + diff --git a/README.md b/README.md index 3ab7e3584..d8d7b621e 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Etherpad is a really-real time collaborative editor scalable to thousands of sim ``` curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - sudo apt-get install -y nodejs -git clone git://github.com/ether/etherpad-lite.git && cd etherpad-lite && bin/run.sh +git clone https://github.com/ether/etherpad-lite.git && cd etherpad-lite && bin/run.sh ``` ## GNU/Linux and other UNIX-like systems diff --git a/src/locales/pms.json b/src/locales/pms.json index 80a857e39..cdc80bea3 100644 --- a/src/locales/pms.json +++ b/src/locales/pms.json @@ -44,5 +44,86 @@ "pad.importExport.import": "Carié n'archivi o document ëd test", "pad.importExport.importSuccessful": "Bele fàit!", "pad.importExport.export": "Esporté ël feuj atual coma:", - "pad.importExport.exportetherpad": "Etherpad" + "pad.importExport.exportetherpad": "Etherpad", + "pad.importExport.exporthtml": "HTML", + "pad.importExport.exportplain": "Mach test", + "pad.importExport.exportword": "Microsoft Word", + "pad.importExport.exportpdf": "PDF", + "pad.importExport.exportopen": "ODF (Open Document Format)", + "pad.importExport.abiword.innerHTML": "A peul mach amporté dij formà ëd test sempi o HTML. Për dle fonsionalità d'amportassion pi avansà, ch'a anstala AbiWord.", + "pad.modals.connected": "Colegà.", + "pad.modals.reconnecting": "Neuva conession a sò feuj...", + "pad.modals.forcereconnect": "Forsé la neuva conession", + "pad.modals.reconnecttimer": "Tentativ ëd neuva conession", + "pad.modals.cancel": "Anulé", + "pad.modals.userdup": "Duvertà an n'àutra fnestra", + "pad.modals.userdup.explanation": "Ës feuj a smija esse duvert an vàire fnestre ansima a st'ordinator.", + "pad.modals.userdup.advice": "Coleghesse torna për dovré costa fnestra.", + "pad.modals.unauth": "Nen autorisà", + "pad.modals.unauth.explanation": "Ij sò përmess a son cangià antramentre ch'a vëdìa costa pàgina. Ch'a sërca ëd coleghesse torna.", + "pad.modals.looping.explanation": "A-i é dij problema ëd comunicassion con ël servent ëd sincronisassion.", + "pad.modals.looping.cause": "Peul desse che chiel a l'é colegasse con un para-feu o un mandatari incompatìbil.", + "pad.modals.initsocketfail": "Ël servent a l'é introvàbil.", + "pad.modals.initsocketfail.explanation": "Impossìbil coleghesse al servent ëd sincronisassion.", + "pad.modals.initsocketfail.cause": "A l'é probàbil che sòn a sia dovù a sò navigador o a soa conession an sl'aragnà.", + "pad.modals.slowcommit.explanation": "Ël servent a rëspond nen.", + "pad.modals.slowcommit.cause": "Sòn a podrìa esse dovù a dij problema ëd conession a l'aragnà.", + "pad.modals.badChangeset.explanation": "Na modìfica ch'a l'ha fàit a l'é stàita cassificà tanme ilegal dal servent ëd sincronisassion.", + "pad.modals.badChangeset.cause": "Sòn a podrìa esse dovù a na bruta configurassion dël servent o a chèich àutr comportament nen ëspetà. Për piasì, ch'a contata l'aministrator dël servissi, s'a pensa ch'a sia n'eror. Ch'a preuva a rintré torna ant ël sistema për andé anans a modifiché.", + "pad.modals.corruptPad.explanation": "Ël feuj al qual a sërca d'acede a l'é corompù.", + "pad.modals.corruptPad.cause": "Sòn a podrìa esse dovù a na configurassion ësbalià dël servent o a chèich àutr comportament nen ëspetà. Për piasì, ch'a contata l'aministrator dël servissi.", + "pad.modals.deleted": "Dëscancelà.", + "pad.modals.deleted.explanation": "Ës feuj a l'é stàit eliminà.", + "pad.modals.disconnected": "A l'é stàit dëscolegà", + "pad.modals.disconnected.explanation": "La conession al servent a l'é perdusse", + "pad.modals.disconnected.cause": "Ël servent a podrìa esse indisponìbil. Për piasì, ch'a anforma l'aministrator dël servissi si ël problema a persist.", + "pad.share": "Partagé 's feuj", + "pad.share.readonly": "Mach letura", + "pad.share.link": "Liura", + "pad.share.emebdcode": "Ancorporé na liura", + "pad.chat": "Ciaciarada", + "pad.chat.title": "Duverté la ciaciarada për cost feuj.", + "pad.chat.loadmessages": "Carié pi 'd mëssagi", + "timeslider.pageTitle": "Stòria dinàmica ëd {{appTitle}}", + "timeslider.toolbar.returnbutton": "Torné al feuj", + "timeslider.toolbar.authors": "Autor:", + "timeslider.toolbar.authorsList": "Gnun autor", + "timeslider.toolbar.exportlink.title": "Esporté", + "timeslider.exportCurrent": "Esporté la version corenta tanme:", + "timeslider.version": "Version {{version}}", + "timeslider.saved": "Argistrà ai {{day}} {{month}} {{year}}", + "timeslider.playPause": "Letura / Pàusa dij contnù dël feuj", + "timeslider.backRevision": "Andé andaré ëd na revision ant ës feuj", + "timeslider.forwardRevision": "Andé anans ëd na revision ant ëd feuj", + "timeslider.dateformat": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}", + "timeslider.month.january": "Gené", + "timeslider.month.february": "Fërvé", + "timeslider.month.march": "Mars", + "timeslider.month.april": "Avril", + "timeslider.month.may": "Maj", + "timeslider.month.june": "Giugn", + "timeslider.month.july": "Luj", + "timeslider.month.august": "Ost", + "timeslider.month.september": "Stèmber", + "timeslider.month.october": "Otóber", + "timeslider.month.november": "Novèmber", + "timeslider.month.december": "Dzèmber", + "timeslider.unnamedauthors": "{{num}} {[plural(num) one: autor anònim, other: autor anònim ]}", + "pad.savedrevs.marked": "Sa revision a l'é adess marcà tanme revision argistrà", + "pad.savedrevs.timeslider": "A peul vëdde le revision argistrà an visitand la stòria", + "pad.userlist.entername": "Ch'a buta sò nòm", + "pad.userlist.unnamed": "anònim", + "pad.userlist.guest": "Anvità", + "pad.userlist.deny": "Arfudé", + "pad.userlist.approve": "Aprové", + "pad.editbar.clearcolors": "Dëscancelé ij color ëd paternità dj'autor an tut ël document?", + "pad.impexp.importbutton": "Amporté adess", + "pad.impexp.importing": "An camin ch'as ampòrta...", + "pad.impexp.confirmimport": "Amportand n'archivi as dëscancelërà ël test corent dël feuj. É-lo sigur ëd vorèj felo?", + "pad.impexp.convertFailed": "I l'oma nen podù amporté s'archivi. Për piasì, ch'a deuvra n'àutr formà ëd document o ch'a còpia e ancòla a man", + "pad.impexp.padHasData": "I l'oma nen podù amporté s'archivi përché 's feuj a l'ha già avù dle modìfiche; për piasì, ch'a ampòrta un feuj neuv", + "pad.impexp.uploadFailed": "Ël cariament a l'ha falì, për piasì ch'a preuva torna", + "pad.impexp.importfailed": "Amportassion falìa", + "pad.impexp.copypaste": "Për piasì, ch'a còpia e ancòla", + "pad.impexp.exportdisabled": "L'esportassion an formà {{type}} a l'é disativà. Për piasì, ch'a contata sò aministrator ëd sistema për ij detaj." } diff --git a/src/locales/zh-hant.json b/src/locales/zh-hant.json index 175918843..2a7d6d1ef 100644 --- a/src/locales/zh-hant.json +++ b/src/locales/zh-hant.json @@ -117,7 +117,7 @@ "timeslider.month.october": "10月", "timeslider.month.november": "11月", "timeslider.month.december": "12月", - "timeslider.unnamedauthors": "{{num}}匿名{[plural(num) 作者]}", + "timeslider.unnamedauthors": "{{num}} 個匿名{[plural(num) one:作者, other:作者]}", "pad.savedrevs.marked": "標記此修訂版本為已儲存修訂版本。", "pad.savedrevs.timeslider": "您可使用時段滑標來查看先前保存的版本內容", "pad.userlist.entername": "輸入您的姓名", diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 060bca7b9..b575125a2 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -1153,6 +1153,101 @@ function handleClientReady(client, message) client.join(padIds.padId); //Save the revision in sessioninfos, we take the revision from the info the client send to us sessioninfos[client.id].rev = message.client_rev; + + //During the client reconnect, client might miss some revisions from other clients. By using client revision, + //this below code sends all the revisions missed during the client reconnect + var revisionsNeeded = []; + var changesets = {}; + + var startNum = message.client_rev + 1; + var endNum = pad.getHeadRevisionNumber() + 1; + + async.series([ + //push all the revision numbers needed into revisionsNeeded array + function(callback) + { + var headNum = pad.getHeadRevisionNumber(); + if (endNum > headNum+1) + endNum = headNum+1; + if (startNum < 0) + startNum = 0; + + for(var r=startNum;r= lists.length)//means we are on a deeper level of indentation than the previous line { if(lists.length > 0){ @@ -381,14 +373,14 @@ function getHTMLFromAtext(pad, atext, authorColors) if(toOpen > 0){ pieces.push(new Array(toOpen + 1).join('
        ')) } - pieces.push('
        1. ', context.lineContent || '
          '); + pieces.push('
          1. ', lineContent || '
            '); } else { if(toOpen > 0){ pieces.push(new Array(toOpen + 1).join('
              ')) } - pieces.push('
              • ', context.lineContent || '
                '); + pieces.push('
                • ', lineContent || '
                  '); } } //the following code *seems* dead after my patch. @@ -424,16 +416,16 @@ function getHTMLFromAtext(pad, atext, authorColors) if(lists[lists.length - 1][1] == "number") { pieces.push(new Array(toClose+1).join('
          ')) - pieces.push('
        2. ', context.lineContent || '
          '); + pieces.push('
        3. ', lineContent || '
          '); } else { pieces.push(new Array(toClose+1).join('')) - pieces.push('
        4. ', context.lineContent || '
          '); + pieces.push('
        5. ', lineContent || '
          '); } lists = lists.slice(0,whichList+1) } else { - pieces.push('
        6. ', context.lineContent || '
          '); + pieces.push('
        7. ', lineContent || '
          '); } } } @@ -459,9 +451,16 @@ function getHTMLFromAtext(pad, atext, authorColors) padId: pad.id } - hooks.callAll("getLineHTMLForExport", context); + var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", context, " ", " ", ""); - pieces.push(context.lineContent, '
          '); + if (lineContentFromHook) + { + pieces.push(lineContentFromHook, ''); + } + else + { + pieces.push(lineContent, '
          '); + } } } diff --git a/src/package.json b/src/package.json index 67ac8a0e7..9813d6ab9 100644 --- a/src/package.json +++ b/src/package.json @@ -17,14 +17,14 @@ "etherpad-require-kernel" : "1.0.9", "resolve" : "1.1.7", "socket.io" : "1.7.3", - "ueberdb2" : "0.3.7", + "ueberdb2" : "0.3.8", "express" : "4.13.4", "express-session" : "1.13.0", "cookie-parser" : "1.3.4", "async" : "0.9.0", "clean-css" : "3.4.19", "uglify-js" : "2.6.2", - "formidable" : "1.0.17", + "formidable" : "1.2.1", "log4js" : "0.6.35", "cheerio" : "0.20.0", "async-stacktrace" : "0.0.2", @@ -42,13 +42,12 @@ "channels" : "0.0.4", "jsonminify" : "0.4.1", "measured" : "1.1.0", - "mocha" : "2.4.5", - "supertest" : "1.2.0", - "is-var-name" : "1.0.0" - }, + "mocha" : "5.0.5", + "supertest" : "3.0.0" + }, "bin": { "etherpad-lite": "./node/server.js" }, "devDependencies": { - "wd" : "0.3.11" + "wd" : "1.6.1" }, "engines" : { "node" : ">=0.10.0", "npm" : ">=1.0" @@ -56,6 +55,6 @@ "repository" : { "type" : "git", "url" : "http://github.com/ether/etherpad-lite.git" }, - "version" : "1.6.3", + "version" : "1.6.5", "license" : "Apache-2.0" } diff --git a/src/static/css/iframe_editor.css b/src/static/css/iframe_editor.css index 757bfa964..9aa003aaf 100644 --- a/src/static/css/iframe_editor.css +++ b/src/static/css/iframe_editor.css @@ -31,17 +31,13 @@ body { body.grayedout { background-color: #eee !important } #innerdocbody { - font-size: 16px; /* overridden by body.style */ + font-size: 12px; /* overridden by body.style */ font-family:Arial, sans-serif; /* overridden by body.style */ line-height: 16px; /* overridden by body.style */ background-color: white; color: black; } -.innerdocbody>div{ - padding: 1px; -} - body.doesWrap { /* white-space: pre-wrap; */ @@ -62,11 +58,9 @@ body.doesWrap { white-space: normal; } -@-moz-document url-prefix() { - body.doesWrap:not(.noprewrap) > div{ - /* Related to #1766 */ - white-space: pre-wrap; - } +body.doesWrap:not(.noprewrap) > div{ + /* Related to #1766 */ + white-space: pre-wrap; } #innerdocbody { diff --git a/src/static/css/pad.css b/src/static/css/pad.css index eb62a6f9b..484e6f2ab 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -1072,9 +1072,9 @@ input[type=checkbox] { overflow: auto; } #mycolorpicker { - left: -73px; - top:auto !important; - bottom:33px !important; + left: 0px; + top:37px !important; + position:fixed; /* #mycolorpicker: width -#users: width */; } #editorcontainer { diff --git a/src/static/js/admin/plugins.js b/src/static/js/admin/plugins.js index 3f88d9b11..c9a244871 100644 --- a/src/static/js/admin/plugins.js +++ b/src/static/js/admin/plugins.js @@ -79,12 +79,17 @@ $(document).ready(function () { for (attr in plugin) { if(attr == "name"){ // Hack to rewrite URLS into name - row.find(".name").html(""+plugin['name'].substr(3)+""); // remove 'ep_' - }else{ + var link = $(''); + link.attr('href', 'https://npmjs.org/package/'+plugin['name']); + link.attr('plugin', 'Plugin details'); + link.attr('target', '_blank'); + link.text(plugin['name'].substr(3)); + row.find('.name').append(link); + } else { row.find("." + attr).text(plugin[attr]); } } - row.find(".version").html( plugin.version ); + row.find(".version").text(plugin.version); row.addClass(plugin.name) row.data('plugin', plugin.name) container.append(row); diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index fd0d9d446..4bcc6ad2b 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -60,6 +60,8 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) var debugMessages = []; var msgQueue = []; + var isPendingRevision = false; + tellAceAboutHistoricalAuthors(serverVars.historicalAuthorData); tellAceActiveAuthorInfo(initialUserInfo); @@ -178,23 +180,36 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) editor.applyChangesToBase(changeset, author, apool); } } + if (isPendingRevision) { + setIsPendingRevision(false); + } } var sentMessage = false; - var userChangesData = editor.prepareUserChangeset(); - if (userChangesData.changeset) + // Check if there are any pending revisions to be received from server. + // Allow only if there are no pending revisions to be received from server + if (!isPendingRevision) { - lastCommitTime = t; - state = "COMMITTING"; - stateMessage = { - type: "USER_CHANGES", - baseRev: rev, - changeset: userChangesData.changeset, - apool: userChangesData.apool - }; - sendMessage(stateMessage); - sentMessage = true; - callbacks.onInternalAction("commitPerformed"); + var userChangesData = editor.prepareUserChangeset(); + if (userChangesData.changeset) + { + lastCommitTime = t; + state = "COMMITTING"; + stateMessage = { + type: "USER_CHANGES", + baseRev: rev, + changeset: userChangesData.changeset, + apool: userChangesData.apool + }; + sendMessage(stateMessage); + sentMessage = true; + callbacks.onInternalAction("commitPerformed"); + } + } + else + { + // run again in a few seconds, to check if there was a reconnection attempt + setTimeout(wrapRecordingErrors("setTimeout(handleUserChanges)", handleUserChanges), 3000); } if (sentMessage) @@ -330,6 +345,69 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) }); handleUserChanges(); } + else if (msg.type == 'CLIENT_RECONNECT') + { + // Server sends a CLIENT_RECONNECT message when there is a client reconnect. Server also returns + // all pending revisions along with this CLIENT_RECONNECT message + if (msg.noChanges) + { + // If no revisions are pending, just make everything normal + setIsPendingRevision(false); + return; + } + + var headRev = msg.headRev; + var newRev = msg.newRev; + var changeset = msg.changeset; + var author = (msg.author || ''); + var apool = msg.apool; + + if (msgQueue.length > 0) + { + if (newRev != (msgQueue[msgQueue.length - 1].newRev + 1)) + { + window.console.warn("bad message revision on CLIENT_RECONNECT: " + newRev + " not " + (msgQueue[msgQueue.length - 1][0] + 1)); + // setChannelState("DISCONNECTED", "badmessage_acceptcommit"); + return; + } + msg.type = "NEW_CHANGES"; + msgQueue.push(msg); + return; + } + + if (newRev != (rev + 1)) + { + window.console.warn("bad message revision on CLIENT_RECONNECT: " + newRev + " not " + (rev + 1)); + // setChannelState("DISCONNECTED", "badmessage_acceptcommit"); + return; + } + + rev = newRev; + if (author == pad.getUserId()) + { + editor.applyPreparedChangesetToBase(); + setStateIdle(); + callCatchingErrors("onInternalAction", function() + { + callbacks.onInternalAction("commitAcceptedByServer"); + }); + callCatchingErrors("onConnectionTrouble", function() + { + callbacks.onConnectionTrouble("OK"); + }); + handleUserChanges(); + } + else + { + editor.applyChangesToBase(changeset, author, apool); + } + + if (newRev == headRev) + { + // Once we have applied all pending revisions, make everything normal + setIsPendingRevision(false); + } + } else if (msg.type == "NO_COMMIT_PENDING") { if (state == "COMMITTING") @@ -591,6 +669,11 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) schedulePerhapsCallIdleFuncs(); } + function setIsPendingRevision(value) + { + isPendingRevision = value; + } + function callWhenNotCommitting(func) { idleFuncs.push(func); @@ -656,7 +739,9 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) getMissedChanges: getMissedChanges, callWhenNotCommitting: callWhenNotCommitting, addHistoricalAuthors: tellAceAboutHistoricalAuthors, - setChannelState: setChannelState + setChannelState: setChannelState, + setStateIdle: setStateIdle, + setIsPendingRevision: setIsPendingRevision }; $(document).ready(setUpSocket); diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 8fcec23f1..de613910d 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -206,10 +206,12 @@ function handshake() socket.on('reconnect', function () { pad.collabClient.setChannelState("CONNECTED"); - pad.sendClientReady(true); + pad.sendClientReady(receivedClientVars); }); socket.on('reconnecting', function() { + pad.collabClient.setStateIdle(); + pad.collabClient.setIsPendingRevision(true); pad.collabClient.setChannelState("RECONNECTING"); }); @@ -217,6 +219,11 @@ function handshake() pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout"); }); + socket.on('error', function(error) { + pad.collabClient.setStateIdle(); + pad.collabClient.setIsPendingRevision(true); + }); + var initalized = false; socket.on('message', function(obj) @@ -831,7 +838,7 @@ var pad = { $.ajax( { type: 'post', - url: '/ep/pad/connection-diagnostic-info', + url: 'ep/pad/connection-diagnostic-info', data: { diagnosticInfo: JSON.stringify(pad.diagnosticInfo) }, diff --git a/src/templates/export_html.html b/src/templates/export_html.html index b29941c9f..b8893b717 100644 --- a/src/templates/export_html.html +++ b/src/templates/export_html.html @@ -139,6 +139,5 @@ ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol { <%- body %> - From 6684f9bfe8267709a67a3e0976ff831750b3b067 Mon Sep 17 00:00:00 2001 From: ilmar Date: Wed, 2 May 2018 11:45:48 +0300 Subject: [PATCH 40/41] hook callAll to aCallAll --- src/node/utils/ExportHtml.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index bd0ad12c2..e53c7a8db 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -360,7 +360,7 @@ function getHTMLFromAtext(pad, atext, authorColors) { nextLine = _analyzeLine(textLines[i + 1], attribLines[i + 1], apool); } - hooks.callAll('getLineHTMLForExport', context); + hooks.aCallAll('getLineHTMLForExport', context); //To create list parent elements if ((!prevLine || prevLine.listLevel !== line.listLevel) || (prevLine && line.listTypeName !== prevLine.listTypeName)) { @@ -445,7 +445,7 @@ function getHTMLFromAtext(pad, atext, authorColors) padId: pad.id }; - hooks.callAll("getLineHTMLForExport", context); + hooks.aCallAll("getLineHTMLForExport", context); pieces.push(context.lineContent, "
          "); } } From 47e20a2f4902447dc91961feb1d58a6516233960 Mon Sep 17 00:00:00 2001 From: ilmar Date: Thu, 3 May 2018 00:07:07 +0300 Subject: [PATCH 41/41] line parsing fix --- src/node/utils/ExportHtml.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index e53c7a8db..f5caa8f6b 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -369,7 +369,10 @@ function getHTMLFromAtext(pad, atext, authorColors) return (item.level === line.listLevel && item.type === line.listTypeName); }); if (!exists) { - var prevLevel = prevLine.listLevel || 0; + var prevLevel = 0; + if (prevLine && prevLine.listLevel) { + prevlevel = prevLine.listLevel; + } if (prevLine && line.listTypeName !== prevLine.listTypeName) { prevLevel = 0; @@ -405,7 +408,10 @@ function getHTMLFromAtext(pad, atext, authorColors) } if ((!nextLine || !nextLine.listLevel || nextLine.listLevel < line.listLevel) || (nextLine && line.listTypeName !== nextLine.listTypeName)) { - var nextLevel = nextLine.listLevel || 0; + var nextLevel = 0; + if (nextLine && nextLine.listLevel) { + nextLevel = nextLine.listLevel; + } if (nextLine && line.listTypeName !== nextLine.listTypeName) { nextLevel = 0;