Skip to content

Commit

Permalink
Merge pull request #2590 from ether/release/1.5.3
Browse files Browse the repository at this point in the history
Release/1.5.3
  • Loading branch information
JohnMcLear committed Apr 10, 2015
2 parents b9cdf43 + d47e201 commit b95395a
Show file tree
Hide file tree
Showing 41 changed files with 1,014 additions and 198 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 1.5.3
* NEW: Accessibility support for Screen readers, includes new fonts and keyboard shortcuts
* NEW: API endpoint for Append Chat Message and Chat Backend Tests
* NEW: Error messages displayed on load are included in Default Pad Text (can be supressed)
* NEW: Content Collector can handle key values
* NEW: getAttributesOnPosition Method
* FIX: Firefox keeps attributes (bold etc) on cut/copy -> paste
* Fix: showControls=false now works
* Fix: Cut and Paste works...
* SECURITY: Don't allow read files on directory traversal

# 1.5.2
* NEW: Support for node version 0.12.x
* NEW: API endpoint saveRevision, getSavedRevisionCount and listSavedRevisions
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Now, run `start.bat` and open <http://localhost:9001> in your browser.

Update to the latest version with `git pull origin`, then run `bin\installOnWindows.bat`, again.

If cloning to a subdirectory within another project, you may need to do the following:

1. Start the server manually (e.g. `node/node_modules/ep_etherpad-lite/node/server.js]`)
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
Expand Down
2 changes: 1 addition & 1 deletion bin/installDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ if [ $DOWNLOAD_JQUERY = "true" ]; then
fi

#Remove all minified data to force node creating it new
echo "Clear minfified cache..."
echo "Clearing minified cache..."
rm -f var/minified*

echo "Ensure custom css/js files are created..."
Expand Down
2 changes: 1 addition & 1 deletion bin/safeRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ do
TIME_SINCE_LAST_SEND=$(($TIME_NOW - $LAST_EMAIL_SEND))

if [ $TIME_SINCE_LAST_SEND -gt $TIME_BETWEEN_EMAILS ]; then
printf "Server was restared at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 ${LOG})" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS
printf "Server was restarted at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 ${LOG})" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS

LAST_EMAIL_SEND=$TIME_NOW
fi
Expand Down
7 changes: 7 additions & 0 deletions doc/api/hooks_client-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ Things in context:

This hook is called before the content of a node is collected by the usual methods. The cc object can be used to do a bunch of things that modify the content of the pad. See, for example, the heading1 plugin for etherpad original.

E.g. if you need to apply an attribute to newly inserted characters,
call cc.doAttrib(state, "attributeName") which results in an attribute attributeName=true.

If you want to specify also a value, call cc.doAttrib(state, "attributeName:value")
which results in an attribute attributeName=value.


## collectContentImage
Called from: src/static/js/contentcollector.js

Expand Down
3 changes: 3 additions & 0 deletions settings.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
//the default text of a pad
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",

/* Shoud we suppress errors from being visible in the default Pad Text? */
"suppressErrorsInPadText" : false,

/* Users must have a session to access pads. This effectively allows only group pads to be accessed. */
"requireSession" : false,

Expand Down
21 changes: 21 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,24 @@
"pad.settings.rtlcheck": "Read content from right to left?",
"pad.settings.fontType": "Font type:",
"pad.settings.fontType.normal": "Normal",
"pad.settings.fontType.opendyslexic": "Open Dyslexic",
"pad.settings.fontType.monospaced": "Monospace",
"pad.settings.fontType.comicsans": "Comic Sans",
"pad.settings.fontType.couriernew": "Courier New",
"pad.settings.fontType.georgia": "Georgia",
"pad.settings.fontType.impact": "Impact",
"pad.settings.fontType.lucida": "Lucida",
"pad.settings.fontType.lucidasans": "Lucida Sans",
"pad.settings.fontType.palatino": "Palatino",
"pad.settings.fontType.tahoma": "Tahoma",
"pad.settings.fontType.timesnewroman": "Times New Roman",
"pad.settings.fontType.trebuchet": "Trebuchet",
"pad.settings.fontType.verdana": "Verdana",
"pad.settings.fontType.symbol": "Symbol",
"pad.settings.fontType.webdings": "Webdings",
"pad.settings.fontType.wingdings": "Wingdings",
"pad.settings.fontType.sansserif": "Sans Serif",
"pad.settings.fontType.serif": "Serif",
"pad.settings.globalView": "Global View",
"pad.settings.language": "Language:",

Expand Down Expand Up @@ -105,6 +122,10 @@
"timeslider.version": "Version {{version}}",
"timeslider.saved": "Saved {{month}} {{day}}, {{year}}",

"timeslider.playPause": "Playback / Pause Pad Contents",
"timeslider.backRevision":"Go back a revision in this Pad",
"timeslider.forwardRevision":"Go forward a revision in this Pad",

"timeslider.dateformat": "{{month}}/{{day}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "January",
"timeslider.month.february": "February",
Expand Down
31 changes: 29 additions & 2 deletions src/node/db/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ getChatHistory(padId, start, end), returns a part of or the whole chat-history o
Example returns:
{"code":0,"message":"ok","data":{"messages":[{"text":"foo","userId":"a.foo","time":1359199533759,"userName":"test"},
{"text":"bar","userId":"a.foo","time":1359199534622,"userName":"test"}]}}
{"code":0,"message":"ok","data":{"messages":[{"text":"foo","authorID":"a.foo","time":1359199533759,"userName":"test"},
{"text":"bar","authorID":"a.foo","time":1359199534622,"userName":"test"}]}}
{code: 1, message:"start is higher or equal to the current chatHead", data: null}
Expand Down Expand Up @@ -494,6 +494,33 @@ exports.getChatHistory = function(padID, start, end, callback)
});
}

/**
appendChatMessage(padID, text, authorID, time), creates a chat message for the pad id, time is a timestamp
Example returns:
{code: 0, message:"ok", data: null
{code: 1, message:"padID does not exist", data: null}
*/
exports.appendChatMessage = function(padID, text, authorID, time, callback)
{
//text is required
if(typeof text != "string")
{
callback(new customError("text is no string","apierror"));
return;
}

//get the pad
getPadSafe(padID, true, function(err, pad)
{
if(ERR(err, callback)) return;

pad.appendChatMessage(text, authorID, parseInt(time));
callback();
});
}

/*****************/
/**PAD FUNCTIONS */
/*****************/
Expand Down
52 changes: 51 additions & 1 deletion src/node/handler/APIHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,60 @@ var version =
, "getChatHead" : ["padID"]
, "restoreRevision" : ["padID", "rev"]
}
, "1.2.12":
{ "createGroup" : []
, "createGroupIfNotExistsFor" : ["groupMapper"]
, "deleteGroup" : ["groupID"]
, "listPads" : ["groupID"]
, "listAllPads" : []
, "createDiffHTML" : ["padID", "startRev", "endRev"]
, "createPad" : ["padID", "text"]
, "createGroupPad" : ["groupID", "padName", "text"]
, "createAuthor" : ["name"]
, "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
, "listPadsOfAuthor" : ["authorID"]
, "createSession" : ["groupID", "authorID", "validUntil"]
, "deleteSession" : ["sessionID"]
, "getSessionInfo" : ["sessionID"]
, "listSessionsOfGroup" : ["groupID"]
, "listSessionsOfAuthor" : ["authorID"]
, "getText" : ["padID", "rev"]
, "setText" : ["padID", "text"]
, "getHTML" : ["padID", "rev"]
, "setHTML" : ["padID", "html"]
, "getAttributePool" : ["padID"]
, "getRevisionsCount" : ["padID"]
, "getSavedRevisionsCount" : ["padID"]
, "listSavedRevisions" : ["padID"]
, "saveRevision" : ["padID", "rev"]
, "getRevisionChangeset" : ["padID", "rev"]
, "getLastEdited" : ["padID"]
, "deletePad" : ["padID"]
, "copyPad" : ["sourceID", "destinationID", "force"]
, "movePad" : ["sourceID", "destinationID", "force"]
, "getReadOnlyID" : ["padID"]
, "getPadID" : ["roID"]
, "setPublicStatus" : ["padID", "publicStatus"]
, "getPublicStatus" : ["padID"]
, "setPassword" : ["padID", "password"]
, "isPasswordProtected" : ["padID"]
, "listAuthorsOfPad" : ["padID"]
, "padUsersCount" : ["padID"]
, "getAuthorName" : ["authorID"]
, "padUsers" : ["padID"]
, "sendClientsMessage" : ["padID", "msg"]
, "listAllGroups" : []
, "checkToken" : []
, "appendChatMessage" : ["padID", "text", "authorID", "time"]
, "getChatHistory" : ["padID"]
, "getChatHistory" : ["padID", "start", "end"]
, "getChatHead" : ["padID"]
, "restoreRevision" : ["padID", "rev"]
}
};

// set the latest available API version here
exports.latestApiVersion = '1.2.11';
exports.latestApiVersion = '1.2.12';

// exports the versions so it can be used by the new Swagger endpoint
exports.version = version;
Expand Down
6 changes: 4 additions & 2 deletions src/node/handler/ImportHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ exports.doImport = function(req, res, padId)
if(!importHandledByPlugin || !directDatabaseAccess){
var fileEnding = path.extname(srcFile).toLowerCase();
var fileIsHTML = (fileEnding === ".html" || fileEnding === ".htm");
var fileIsTXT = (fileEnding === ".txt");
if (fileIsTXT) abiword = false; // Don't use abiword for text files
// See https://github.com/ether/etherpad-lite/issues/2572
if (abiword && !fileIsHTML) {
abiword.convertFile(srcFile, destFile, "htm", function(err) {
//catch convert errors
Expand Down Expand Up @@ -213,7 +216,7 @@ exports.doImport = function(req, res, padId)
// Title needs to be stripped out else it appends it to the pad..
text = text.replace("<title>", "<!-- <title>");
text = text.replace("</title>","</title>-->");

//node on windows has a delay on releasing of the file lock.
//We add a 100ms delay to work around this
if(os.type().indexOf("Windows") > -1){
Expand Down Expand Up @@ -245,7 +248,6 @@ exports.doImport = function(req, res, padId)
padManager.getPad(padId, function(err, _pad){
var pad = _pad;
padManager.unloadPad(padId);

// direct Database Access means a pad user should perform a switchToPad
// and not attempt to recieve updated pad data..
if(!directDatabaseAccess){
Expand Down
22 changes: 16 additions & 6 deletions src/node/handler/PadMessageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,17 @@ function handleUserChanges(data, cb)
, op
while(iterator.hasNext()) {
op = iterator.next()
if(op.opcode != '+') continue;

//+ can add text with attribs
//= can change or add attribs
//- can have attribs, but they are discarded and don't show up in the attribs - but do show up in the pool

op.attribs.split('*').forEach(function(attr) {
if(!attr) return
attr = wireApool.getAttrib(attr)
if(!attr) return
if('author' == attr[0] && attr[1] != thisSession.author) throw new Error("Trying to submit changes as another author in changeset "+changeset);
//the empty author is used in the clearAuthorship functionality so this should be the only exception
if('author' == attr[0] && (attr[1] != thisSession.author && attr[1] != '')) throw new Error("Trying to submit changes as another author in changeset "+changeset);
})
}

Expand Down Expand Up @@ -1629,10 +1634,15 @@ function composePadChangesets(padId, startNum, endNum, callback)
changeset = changesets[startNum];
var pool = pad.apool();

for(var r=startNum+1;r<endNum;r++)
{
var cs = changesets[r];
changeset = Changeset.compose(changeset, cs, pool);
try {
for(var r=startNum+1;r<endNum;r++) {
var cs = changesets[r];
changeset = Changeset.compose(changeset, cs, pool);
}
} catch(e){
// r-1 indicates the rev that was build starting with startNum, applying startNum+1, +2, +3
console.warn("failed to compose cs in pad:",padId," startrev:",startNum," current rev:",r);
return callback(e);
}

callback(null);
Expand Down
2 changes: 2 additions & 0 deletions src/node/hooks/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ exports.createServer = function () {
console.log("Report bugs at https://github.com/ether/etherpad-lite/issues")

serverName = "Etherpad " + settings.getGitCommit() + " (http://etherpad.org)";

console.log("Your Etherpad version is " + settings.getEpVersion() + " (" + settings.getGitCommit() + ")");

exports.restartServer();

Expand Down
8 changes: 7 additions & 1 deletion src/node/hooks/express/adminplugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ exports.expressCreateServer = function (hook_name, args, cb) {
});
args.app.get('/admin/plugins/info', function(req, res) {
var gitCommit = settings.getGitCommit();
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins-info.html", {gitCommit:gitCommit}) );
var epVersion = settings.getEpVersion();
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins-info.html",
{
gitCommit: gitCommit,
epVersion: epVersion
})
);
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/node/hooks/express/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ var API = {
}
},
"response": {"chatHead":{"type":"Message"}}
},
"appendChatMessage": {
"func": "appendChatMessage",
"description": "appends a chat message"
}
}
};
Expand Down
1 change: 0 additions & 1 deletion src/node/utils/Minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ function minify(req, res, next)
filename = path.normalize(path.join(ROOT_DIR, filename));
if (filename.indexOf(ROOT_DIR) == 0) {
filename = filename.slice(ROOT_DIR.length);
filename = filename.replace(/\\/g, '/'); // Windows (safe generally?)
} else {
res.writeHead(404, {});
res.end();
Expand Down
Loading

0 comments on commit b95395a

Please sign in to comment.