Skip to content

Commit

Permalink
Merge new release into master branch!
Browse files Browse the repository at this point in the history
  • Loading branch information
Gared committed Apr 24, 2016
2 parents 8359756 + ebe44b0 commit dcfb287
Show file tree
Hide file tree
Showing 97 changed files with 1,975 additions and 554 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ npm-debug.log
*.crt
*.key
bin/etherpad-1.deb
credentials.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 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 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.
Expand Down
23 changes: 11 additions & 12 deletions bin/buildForWindows.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

NODE_VERSION="0.12.2"
NODE_VERSION="4.4.3"

#Move to the folder where ep-lite is installed
cd `dirname $0`
Expand Down Expand Up @@ -29,11 +29,11 @@ hash unzip > /dev/null 2>&1 || {
}

START_FOLDER=$(pwd);
TMP_FOLDER=$(mktemp -d)

echo "create a clean environment in /tmp/etherpad-lite-win..."
rm -rf /tmp/etherpad-lite-win
cp -ar . /tmp/etherpad-lite-win
cd /tmp/etherpad-lite-win
echo "create a clean environment in $TMP_FOLDER..."
cp -ar . $TMP_FOLDER
cd $TMP_FOLDER
rm -rf node_modules
rm -f etherpad-lite-win.zip

Expand All @@ -50,21 +50,20 @@ mv node_modules_resolved node_modules

echo "download windows node..."
cd bin
wget "http://nodejs.org/dist/v$NODE_VERSION/node.exe" -O ../node.exe
wget "https://nodejs.org/dist/v$NODE_VERSION/win-x86/node.exe" -O ../node.exe

echo "remove git history to reduce folder size"
rm -rf .git/objects

echo "remove windows jsdom-nocontextify/test folder"
rm -rf /tmp/etherpad-lite-win/src/node_modules/wd/node_modules/request/node_modules/form-data/node_modules/combined-stream/test
rm -rf /tmp/etherpad-lite-win/src/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/encodings/tables
rm -rf $TMP_FOLDER/src/node_modules/wd/node_modules/request/node_modules/form-data/node_modules/combined-stream/test
rm -rf $TMP_FOLDER/src/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/encodings/tables

echo "create the zip..."
cd /tmp
zip -9 -r etherpad-lite-win.zip etherpad-lite-win
mv etherpad-lite-win.zip $START_FOLDER
cd $TMP_FOLDER
zip -9 -r $START_FOLDER/etherpad-lite-win.zip ./*

echo "clean up..."
rm -rf /tmp/etherpad-lite-win
rm -rf $TMP_FOLDER

echo "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"
14 changes: 5 additions & 9 deletions bin/installDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,11 @@ fi
#check node version
NODE_VERSION=$(node --version)
NODE_V_MINOR=$(echo $NODE_VERSION | cut -d "." -f 1-2)
#iojs version checking added
if hash iojs 2>/dev/null; then
IOJS_VERSION=$(iojs --version)
fi
if [ ! $NODE_V_MINOR = "v0.10" ] && [ ! $NODE_V_MINOR = "v0.11" ] && [ ! $NODE_V_MINOR = "v0.12" ]; then
if [ ! $IOJS_VERSION ]; then
echo "You're running a wrong version of node, or io.js is not installed. You're using $NODE_VERSION, we need v0.10.x, v0.11.x or v0.12.x" >&2
exit 1
fi
NODE_V_MAIN=$(echo $NODE_VERSION | cut -d "." -f 1)
NODE_V_MAIN=${NODE_V_MAIN#"v"}
if [ ! $NODE_V_MINOR = "v0.10" ] && [ ! $NODE_V_MINOR = "v0.11" ] && [ ! $NODE_V_MINOR = "v0.12" ] && [ ! $NODE_V_MAIN -ge 4 ]; then
echo "You're running a wrong version of node. You're using $NODE_VERSION, we need node v0.10.x or higher" >&2
exit 1
fi

#Get the name of the settings file
Expand Down
5 changes: 0 additions & 5 deletions bin/installOnWindows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ cd /D "%~dp0\.."
:: Is node installed?
cmd /C node -e "" || ( echo "Please install node.js ( http://nodejs.org )" && exit /B 1 )

echo _
echo Checking node version...
set check_version="if(['10','11','12'].indexOf(process.version.split('.')[1]) === -1 && process.version.split('.')[0] !== '1') { console.log('You are running a wrong version of Node. Etherpad requires v0.10+'); process.exit(1) }"
cmd /C node -e %check_version% || 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
Expand Down
18 changes: 0 additions & 18 deletions bin/migrateDirtyDBtoMySQL.js

This file was deleted.

38 changes: 38 additions & 0 deletions bin/migrateDirtyDBtoRealDB.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require("ep_etherpad-lite/node_modules/npm").load({}, function(er,npm) {

process.chdir(npm.root+'/..')

// This script requires that you have modified your settings.json file
// to work with a real database. Please make a backup of your dirty.db
// file before using this script, just to be safe.

var settings = require("ep_etherpad-lite/node/utils/Settings");
var dirty = require("dirty")('var/dirty.db');
var ueberDB = require("../src/node_modules/ueberDB");
var log4js = require("../src/node_modules/log4js");
var dbWrapperSettings = {
"cache": "0", // The cache slows things down when you're mostly writing.
};
var db = new ueberDB.database(settings.dbType, settings.dbSettings, dbWrapperSettings, log4js.getLogger("ueberDB"));

db.init(function() {
console.log("Waiting for dirtyDB to parse its file.");
dirty.on("load", function(length) {
console.log("Loaded " + length + " records, processing now.");
var remaining = length;
dirty.forEach(function(key, value) {
db.set(key, value, function(error) {
if (typeof error != 'undefined') {
console.log("Unexpected result handling: ", key, value, " was: ", error);
}
remaining -= 1;
var oldremaining = remaining;
if ((oldremaining % 100) == 0) {
console.log("Records not yet flushed to database: ", remaining);
}
});
});
console.log("Please wait for all records to flush to database, then kill this process.");
});
});
});
3 changes: 3 additions & 0 deletions bin/rebuildPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ async.series([
newPad.pool.numToAttrib = oldPad.pool.numToAttrib;
for(var curRevNum = 0; curRevNum <= newRevHead; curRevNum++) {
db.db.get("pad:" + padId + ":revs:" + curRevNum, function(err, rev) {
if (rev.meta) {
throw "The specified revision number could not be found.";
}
var newRevNum = ++newPad.head;
var newRevId = "pad:" + newPad.id + ":revs:" + newRevNum;
db.db.set(newRevId, rev);
Expand Down
2 changes: 1 addition & 1 deletion bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ bin/installDeps.sh $* || exit 1
echo "Started Etherpad..."

SCRIPTPATH=`pwd -P`
node $SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js $*
exec node $SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js $*

12 changes: 9 additions & 3 deletions doc/api/editorInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@ Returns the `rep` object.
## editorInfo.ace_isCaret(?)
## editorInfo.ace_getLineAndCharForPoint(?)
## editorInfo.ace_performDocumentApplyAttributesToCharRange(?)
## editorInfo.ace_setAttributeOnSelection(?)
## editorInfo.ace_setAttributeOnSelection(attribute, enabled)
Sets an attribute on current range.
Example: `call.editorInfo.ace_setAttributeOnSelection("turkey::balls", true); // turkey is the attribute here, balls is the value
Notes: to remove the attribute pass enabled as false
## editorInfo.ace_toggleAttributeOnSelection(?)
## editorInfo.ace_getAttributeOnSelection(attribute)
## editorInfo.ace_getAttributeOnSelection(attribute, prevChar)
Returns a boolean if an attribute exists on a selected range.
prevChar value should be true if you want to get the previous Character attribute instead of the current selection for example
if the caret is at position 0,1 (after first character) it's probable you want the attributes on the character at 0,0
The attribute should be the string name of the attribute applied to the selection IE subscript
Example usage: Apply the activeButton Class to a button if an attribute is on a highlighted/selected caret position or range.
Example: `call.editorInfo.ace_getAttributeOnSelection("subscript");` // call here is the callstack from aceEditEvent.
Example `var isItThere = documentAttributeManager.getAttributeOnSelection("turkey::balls", true);`

See the ep_subscript plugin for an example of this function in action.
Notes: Does not work on first or last character of a line. Suffers from a race condition if called with aceEditEvent.
## editorInfo.ace_performSelectionChange(?)
Expand Down
27 changes: 25 additions & 2 deletions doc/api/hooks_client-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Called from: src/static/js/ace.js

Things in context: None

This hook is provided to allow custom CSS files to be loaded. The return value should be an array of paths relative to the plugins directory.
This hook is provided to allow custom CSS files to be loaded. The return value should be an array of resource urls or paths relative to the plugins directory.

## aceInitInnerdocbodyHead
Called from: src/static/js/ace.js
Expand Down Expand Up @@ -160,7 +160,19 @@ Things in context:
1. ace - the ace object that is applied to this editor.
2. pad - the pad object of the current pad.

There doesn't appear to be any example available of this particular hook being used, but it gets fired after the editor is all set up.
## postToolbarInit
Called from: src/static/js/pad_editbar.js

Things in context:

1. ace - the ace object that is applied to this editor.
2. toolbar - Editbar instance. See below for the Editbar documentation.

Can be used to register custom actions to the toolbar.

Usage examples:

* [https://github.com/tiblu/ep_authorship_toggle]()

## postTimesliderInit
Called from: src/static/js/timeslider.js
Expand Down Expand Up @@ -339,3 +351,14 @@ Things in context:

This hook is provided to allow author highlight style to be modified.
Registered hooks should return 1 if the plugin handles highlighting. If no plugin returns 1, the core will use the default background-based highlighting.

## aceSelectionChanged
Called from: src/static/js/ace2_inner.js

Things in context:

1. rep - information about where the user's cursor is
2. documentAttributeManager - information about attributes in the document

This hook allows a plugin to react to a cursor or selection change,
perhaps to update a UI element based on the style at the cursor location.
49 changes: 44 additions & 5 deletions doc/api/hooks_server-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Available blocks in `pad.html` are:
* `modals` - Contains all connectivity messages
* `embedPopup` - the embed dropdown
* `scripts` - Add your script tags here, if you really have to (consider use client-side hooks instead)

`timeslider.html` blocks:

* `timesliderStyles`
Expand All @@ -90,9 +90,9 @@ Available blocks in `pad.html` are:
* `timesliderTop`
* `timesliderEditbarRight`
* `modals`

`index.html` blocks:

* `indexWrapper` - contains the form for creating new pads

## padInitToolbar
Expand All @@ -104,6 +104,10 @@ Things in context:

Here you can add custom toolbar items that will be available in the toolbar config in `settings.json`. For more about the toolbar controller see the API section.

Usage examples:

* [https://github.com/tiblu/ep_authorship_toggle]()

## padCreate
Called from: src/node/db/Pad.js

Expand Down Expand Up @@ -334,7 +338,7 @@ exports.aceAttribClasses = function(hook_name, attr, cb){
```

## exportFileName
Called from src/node/handler/ExportHandler.js
Called from src/node/handler/ExportHandler.js

Things in context:

Expand All @@ -357,7 +361,7 @@ Things in context:

1. Pad object

This hook will allow a plug-in developer to include more properties and attributes to support during HTML Export. An Array should be returned.
This hook will allow a plug-in developer to include more properties and attributes to support during HTML Export. If tags are stored as `['color', 'red']` on the attribute pool, use `exportHtmlAdditionalTagsWithData` instead. An Array should be returned.

Example:
```
Expand All @@ -368,6 +372,24 @@ exports.exportHtmlAdditionalTags = function(hook, pad, cb){
};
```

## exportHtmlAdditionalTagsWithData
Called from src/node/utils/ExportHtml.js

Things in context:

1. Pad object

Identical to `exportHtmlAdditionalTags`, but for tags that are stored with an specific value (not simply `true`) on the attribute pool. For example `['color', 'red']`, instead of `['bold', true]`. This hook will allow a plug-in developer to include more properties and attributes to support during HTML Export. An Array of arrays should be returned. The exported HTML will contain tags like `<span data-color="red">` for the content where attributes are `['color', 'red']`.

Example:
```
// Add the props to be supported in export
exports.exportHtmlAdditionalTagsWithData = function(hook, pad, cb){
var padId = pad.id;
cb([["color", "red"], ["color", "blue"]]);
};
```

## userLeave
Called from src/node/handler/PadMessageHandler.js

Expand All @@ -384,3 +406,20 @@ exports.userLeave = function(hook, session, callback) {
console.log('%s left pad %s', session.author, session.padId);
};
```

### clientReady
Called from src/node/handler/PadMessageHandler.js

This in context:

1. message

This hook gets called when handling a CLIENT_READY which is the first message from the client to the server.

Example:

```
exports.clientReady = function(hook, message) {
console.log('Client has entered the pad' + message.padId);
};
```
22 changes: 21 additions & 1 deletion doc/api/http_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Portal submits content into new blog post
## Usage

### API version
The latest version is `1.2.12`
The latest version is `1.2.13`

The current version can be queried via /api.

Expand Down Expand Up @@ -280,6 +280,16 @@ returns the text of a pad

sets the text of a pad

*Example returns:*
* `{code: 0, message:"ok", data: null}`
* `{code: 1, message:"padID does not exist", data: null}`
* `{code: 1, message:"text too long", data: null}`

#### appendText(padID, text)
* API >= 1.2.13

appends text to a pad

*Example returns:*
* `{code: 0, message:"ok", data: null}`
* `{code: 1, message:"padID does not exist", data: null}`
Expand Down Expand Up @@ -380,6 +390,16 @@ returns the chatHead (last number of the last chat-message) of the pad
* `{code: 0, message:"ok", data: {chatHead: 42}}`
* `{code: 1, message:"padID does not exist", data: null}`

#### appendChatMessage(padID, text, authorID [, time])
* API >= 1.2.12

creates a chat message, saves it to the database and sends it to all connected clients of this pad


*Example returns:*

* `{code: 0, message:"ok", data: null}`
* `{code: 1, message:"text is no string", data: null}`

### Pad
Group pads are normal pads, but with the name schema GROUPID$PADNAME. A security manager controls access of them and its forbidden for normal pads to include a $ in the name.
Expand Down
Loading

0 comments on commit dcfb287

Please sign in to comment.