From 3d8452b1439fd24473fb68653cb2f7e3e0bbdb4b Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Thu, 5 Dec 2013 08:41:29 +0100 Subject: [PATCH] Replace tabs indentation with spaces indentation Some files are obviously external libraries, I didn't touch them --- bin/loadTesting/README | 14 +- bin/loadTesting/launcher.sh | 2 +- doc/easysync/easysync-notes.txt | 14 +- settings.json.template | 57 +- src/node/db/API.js | 4 +- src/node/db/Pad.js | 4 +- src/node/db/SecurityManager.js | 8 +- src/node/handler/PadMessageHandler.js | 6 +- src/node/handler/SocketIORouter.js | 10 +- src/node/hooks/express/padreadonly.js | 56 +- src/node/hooks/express/padurlsanitize.js | 22 +- src/node/hooks/express/specialpages.js | 6 +- src/node/utils/Abiword.js | 2 +- src/node/utils/ExportHtml.js | 20 +- src/static/css/iframe_editor.css | 2 +- src/static/js/Changeset.js | 6 +- src/static/js/ace2_inner.js | 4 +- src/static/js/broadcast_slider.js | 8 +- src/static/js/changesettracker.js | 4 +- src/static/js/chat.js | 14 +- src/static/js/contentcollector.js | 4 +- src/static/js/domline.js | 8 +- src/static/js/html10n.js | 20 +- src/static/js/linestylefilter.js | 2 +- src/static/js/pad_editbar.js | 2 +- src/static/js/pluginfw/hooks.js | 2 +- src/templates/index.html | 36 +- tests/frontend/lib/sendkeys.js | 606 +++++++++--------- tests/frontend/runner.js | 6 +- tests/frontend/specs/alphabet.js | 2 +- tests/frontend/specs/chat.js | 2 +- tests/frontend/specs/helper.js | 58 +- tests/frontend/specs/indentation.js | 4 +- tests/frontend/specs/urls_become_clickable.js | 2 +- tests/frontend/travis/remote_runner.js | 4 +- 35 files changed, 511 insertions(+), 510 deletions(-) diff --git a/bin/loadTesting/README b/bin/loadTesting/README index 2252b66c6..c8ecd71e4 100644 --- a/bin/loadTesting/README +++ b/bin/loadTesting/README @@ -17,19 +17,19 @@ Installed Xvfb and PhantomJS I installed Xvfb following (roughly) this guide: http://blog.martin-lyness.com/archives/installing-xvfb-on-ubuntu-9-10-karmic-koala - #sudo apt-get install xvfb - #sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic + #sudo apt-get install xvfb + #sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic Launched two instances of Xvfb directly from the terminal: - #Xvfb :0 -ac - #Xvfb :1 -ac + #Xvfb :0 -ac + #Xvfb :1 -ac I installed PhantomJS following this guide: http://code.google.com/p/phantomjs/wiki/Installation - #sudo add-apt-repository ppa:jerome-etienne/neoip - #sudo apt-get update - #sudo apt-get install phantomjs + #sudo add-apt-repository ppa:jerome-etienne/neoip + #sudo apt-get update + #sudo apt-get install phantomjs I created a small JavaScript file for PhatomJS to use to control the browser instances: diff --git a/bin/loadTesting/launcher.sh b/bin/loadTesting/launcher.sh index 375b15444..e940f8e0f 100755 --- a/bin/loadTesting/launcher.sh +++ b/bin/loadTesting/launcher.sh @@ -3,7 +3,7 @@ # connect 500 instances to display :0 for i in {1..500} do - echo $i + echo $i echo "Displaying Some shit" DISPLAY=:0 screen -d -m /home/phantomjs/bin/phantomjs loader.js http://10.0.0.55:9001/p/pad2 && sleep 2 done diff --git a/doc/easysync/easysync-notes.txt b/doc/easysync/easysync-notes.txt index d3b3dc558..72adadd2d 100644 --- a/doc/easysync/easysync-notes.txt +++ b/doc/easysync/easysync-notes.txt @@ -79,14 +79,14 @@ Here are descriptions of the operations, where capital letters are variables: kept MUST be a newline, and the final newline of the document is allowed. "*I" : Apply attribute I from the pool to the following +, =, |+, or |= command. In other words, any number of * ops can come before a +, =, or | but not - between a | and the corresponding + or =. + between a | and the corresponding + or =. If +, text is inserted having this attribute. If =, text is kept but with - the attribute applied as an attribute addition or removal. - Consecutive attributes must be sorted lexically by (key,value) with key - and value taken as strings. It's illegal to have duplicate keys - for (key,value) pairs that apply to the same text. It's illegal to - have an empty value for a key in the case of an insertion (+), the - pair should just be omitted. + the attribute applied as an attribute addition or removal. + Consecutive attributes must be sorted lexically by (key,value) with key + and value taken as strings. It's illegal to have duplicate keys + for (key,value) pairs that apply to the same text. It's illegal to + have an empty value for a key in the case of an insertion (+), the + pair should just be omitted. Characters from the source text that aren't accounted for are assumed to be kept with the same attributes. diff --git a/settings.json.template b/settings.json.template index 50e7e9d4b..43aa1613d 100644 --- a/settings.json.template +++ b/settings.json.template @@ -110,40 +110,41 @@ // https://github.com/nomiddlename/log4js-node // You can add as many appenders as you want here: "logconfig" : - { "appenders": [ - { "type": "console" - //, "category": "access"// only logs pad access - } + { "appenders": [ + { "type": "console" + //, "category": "access"// only logs pad access + } /* - , { "type": "file" + , { "type": "file" , "filename": "your-log-file-here.log" , "maxLogSize": 1024 , "backups": 3 // how many log files there're gonna be at max //, "category": "test" // only log a specific category - }*/ + }*/ /* - , { "type": "logLevelFilter" - , "level": "warn" // filters out all log messages that have a lower level than "error" - , "appender": - { Use whatever appender you want here } - }*/ + , { "type": "logLevelFilter" + , "level": "warn" // filters out all log messages that have a lower level than "error" + , "appender": + { Use whatever appender you want here } + }*/ /* - , { "type": "logLevelFilter" - , "level": "error" // filters out all log messages that have a lower level than "error" - , "appender": - { "type": "smtp" - , "subject": "An error occured in your EPL instance!" - , "recipients": "bar@blurdybloop.com, baz@blurdybloop.com" - , "sendInterval": 60*5 // in secs -- will buffer log messages; set to 0 to send a mail for every message - , "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods - "host": "smtp.example.com", "port": 465, - "secureConnection": true, - "auth": { - "user": "foo@example.com", - "pass": "bar_foo" + , { "type": "logLevelFilter" + , "level": "error" // filters out all log messages that have a lower level than "error" + , "appender": + { "type": "smtp" + , "subject": "An error occured in your EPL instance!" + , "recipients": "bar@blurdybloop.com, baz@blurdybloop.com" + , "sendInterval": 60*5 // in secs -- will buffer log messages; set to 0 to send a mail for every message + , "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods + "host": "smtp.example.com", "port": 465, + "secureConnection": true, + "auth": { + "user": "foo@example.com", + "pass": "bar_foo" + } } - } - } - }*/ - ] } + } + }*/ + ] + } } diff --git a/src/node/db/API.js b/src/node/db/API.js index e48c14015..349953cb2 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -554,7 +554,7 @@ exports.deletePad = function(padID, callback) /** copyPad(sourceID, destinationID[, force=false]) copies a pad. If force is true, - the destination will be overwritten if it exists. + the destination will be overwritten if it exists. Example returns: @@ -573,7 +573,7 @@ exports.copyPad = function(sourceID, destinationID, force, callback) /** movePad(sourceID, destinationID[, force=false]) moves a pad. If force is true, - the destination will be overwritten if it exists. + the destination will be overwritten if it exists. Example returns: diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index b6dee897f..180517d1f 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -463,7 +463,7 @@ Pad.prototype.copy = function copy(destinationID, force, callback) { if(exists == true) { - if (!force) + if (!force) { console.log("erroring out without force"); callback(new customError("destinationID already exists","apierror")); @@ -635,7 +635,7 @@ Pad.prototype.remove = function remove(callback) { authorIDs.forEach(function (authorID) { - authorManager.removePad(authorID, padID); + authorManager.removePad(authorID, padID); }); callback(); diff --git a/src/node/db/SecurityManager.js b/src/node/db/SecurityManager.js index 355603f32..66cfd292c 100644 --- a/src/node/db/SecurityManager.js +++ b/src/node/db/SecurityManager.js @@ -151,16 +151,16 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback) if(sessionInfo.groupID != groupID) { authLogger.debug("Auth failed: wrong group"); - callback(); - return; + callback(); + return; } //is validUntil still ok? if(sessionInfo.validUntil <= now) { authLogger.debug("Auth failed: validUntil"); - callback(); - return; + callback(); + return; } // There is a valid session diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 0b583661c..75ec6bd79 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -455,7 +455,7 @@ function handleGetChatMessages(client, message) pad.getChatMessages(start, end, function(err, chatMessages) { if(ERR(err, callback)) return; - + var infoMsg = { type: "COLLABROOM", data: { @@ -463,7 +463,7 @@ function handleGetChatMessages(client, message) messages: chatMessages } }; - + // send the messages back to the client client.json.send(infoMsg); }); @@ -1564,7 +1564,7 @@ exports.padUsers = function (padID, callback) { author.id = s.author; result.push(author); - callback(); + callback(); }); } }, function(err) { diff --git a/src/node/handler/SocketIORouter.js b/src/node/handler/SocketIORouter.js index 2ca0d80fe..b3e046d2c 100644 --- a/src/node/handler/SocketIORouter.js +++ b/src/node/handler/SocketIORouter.js @@ -57,11 +57,11 @@ exports.setSocketIO = function(_socket) { socket.sockets.on('connection', function(client) { if(settings.trustProxy && client.handshake.headers['x-forwarded-for'] !== undefined){ - client.set('remoteAddress', client.handshake.headers['x-forwarded-for']); - } - else{ - client.set('remoteAddress', client.handshake.address.address); - } + client.set('remoteAddress', client.handshake.headers['x-forwarded-for']); + } + else{ + client.set('remoteAddress', client.handshake.address.address); + } var clientAuthorized = false; //wrap the original send function to log the messages diff --git a/src/node/hooks/express/padreadonly.js b/src/node/hooks/express/padreadonly.js index af5cbed39..9a0a52bfb 100644 --- a/src/node/hooks/express/padreadonly.js +++ b/src/node/hooks/express/padreadonly.js @@ -16,50 +16,50 @@ exports.expressCreateServer = function (hook_name, args, cb) { //translate the read only pad to a padId function(callback) { - readOnlyManager.getPadId(req.params.id, function(err, _padId) - { - if(ERR(err, callback)) return; + readOnlyManager.getPadId(req.params.id, function(err, _padId) + { + if(ERR(err, callback)) return; - padId = _padId; + padId = _padId; - //we need that to tell hasPadAcess about the pad - req.params.pad = padId; + //we need that to tell hasPadAcess about the pad + req.params.pad = padId; - callback(); - }); + callback(); + }); }, //render the html document function(callback) { - //return if the there is no padId - if(padId == null) - { - callback("notfound"); - return; - } + //return if the there is no padId + if(padId == null) + { + callback("notfound"); + return; + } - hasPadAccess(req, res, function() - { - //render the html document - exporthtml.getPadHTMLDocument(padId, null, false, function(err, _html) - { - if(ERR(err, callback)) return; - html = _html; - callback(); - }); - }); + hasPadAccess(req, res, function() + { + //render the html document + exporthtml.getPadHTMLDocument(padId, null, false, function(err, _html) + { + if(ERR(err, callback)) return; + html = _html; + callback(); + }); + }); } ], function(err) { //throw any unexpected error if(err && err != "notfound") - ERR(err); + ERR(err); if(err == "notfound") - res.send(404, '404 - Not Found'); + res.send(404, '404 - Not Found'); else - res.send(html); + res.send(html); }); }); -} \ No newline at end of file +} diff --git a/src/node/hooks/express/padurlsanitize.js b/src/node/hooks/express/padurlsanitize.js index 29782b692..2aadccdc6 100644 --- a/src/node/hooks/express/padurlsanitize.js +++ b/src/node/hooks/express/padurlsanitize.js @@ -12,20 +12,20 @@ exports.expressCreateServer = function (hook_name, args, cb) { else { padManager.sanitizePadId(padId, function(sanitizedPadId) { - //the pad id was sanitized, so we redirect to the sanitized version - if(sanitizedPadId != padId) - { + //the pad id was sanitized, so we redirect to the sanitized version + if(sanitizedPadId != padId) + { var real_url = sanitizedPadId; var query = url.parse(req.url).query; if ( query ) real_url += '?' + query; - res.header('Location', real_url); - res.send(302, 'You should be redirected to ' + real_url + ''); - } - //the pad id was fine, so just render it - else - { - next(); - } + res.header('Location', real_url); + res.send(302, 'You should be redirected to ' + real_url + ''); + } + //the pad id was fine, so just render it + else + { + next(); + } }); } }); diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index 6701726e4..7d0519659 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -49,11 +49,11 @@ exports.expressCreateServer = function (hook_name, args, cb) { //there is no custom favicon, send the default favicon if(err) { - filePath = path.normalize(__dirname + "/../../../static/favicon.ico"); - res.sendfile(filePath); + filePath = path.normalize(__dirname + "/../../../static/favicon.ico"); + res.sendfile(filePath); } }); }); -} \ No newline at end of file +} diff --git a/src/node/utils/Abiword.js b/src/node/utils/Abiword.js index 2ef4f444c..5f12bd975 100644 --- a/src/node/utils/Abiword.js +++ b/src/node/utils/Abiword.js @@ -143,7 +143,7 @@ else //Queue with the converts we have to do var queue = async.queue(doConvertTask, 1); exports.convertFile = function(srcFile, destFile, type, callback) - { + { queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback}); }; } diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 7b94310a3..5179adf62 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -447,7 +447,7 @@ function getHTMLFromAtext(pad, atext, authorColors) pieces.push(''); } lists.length--; - } + } var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", { line: line, @@ -455,14 +455,14 @@ function getHTMLFromAtext(pad, atext, authorColors) attribLine: attribLines[i], text: textLines[i] }, " ", " ", ""); - if (lineContentFromHook) - { - pieces.push(lineContentFromHook, ''); - } - else - { - pieces.push(lineContent, '
'); - } + if (lineContentFromHook) + { + pieces.push(lineContentFromHook, ''); + } + else + { + pieces.push(lineContent, '
'); + } } } @@ -490,7 +490,7 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) var head = (noDocType ? '' : '\n') + '\n' + (noDocType ? '' : '\n' + - '' + Security.escapeHTML(padId) + '\n' + + '' + Security.escapeHTML(padId) + '\n' + '\n' + '