diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..5810ed255
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,13 @@
+# v1.1
+* Introduced Plugin framework
+* Many bugfixes
+* Faster page loading
+* Various UI polishes
+* Saved Revisions
+* Read only Real time view
+* More API functionality
+
+# v 1.0.1
+
+* Updated MySQL driver, this fixes some problems with mysql
+* Fixed export,import and timeslider link when embed parameters are used
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..a35c25535
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2012 THE ETHERPAD FOUNDATION
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..01f30701b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,13 @@
+doc_dirs = doc $(wildcard doc/*/)
+outdoc_dirs = out $(addprefix out/,$(doc_dirs))
+doc_sources = $(wildcard doc/*/*.md) $(wildcard doc/*.md)
+outdoc_files = $(addprefix out/,$(doc_sources:.md=.html))
+
+docs: $(outdoc_files)
+
+out/doc/%.html: doc/%.md
+ mkdir -p $(@D)
+ node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
+
+clean:
+ rm -rf out/
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..6cdb623f3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,130 @@
+# Our goal is to make collaborative editing the standard on the web
+
+# About
+Etherpad lite is a really-real time collaborative editor spawned from the Hell fire of Etherpad.
+We're reusing the well tested Etherpad easysync library to make it really realtime. Etherpad Lite
+is based on node.js ergo is much lighter and more stable than the original Etherpad. Our hope
+is that this will encourage more users to use and install a realtime collaborative editor. A smaller, manageable and well
+documented codebase makes it easier for developers to improve the code and contribute towards the project.
+
+Etherpad Lite is optimized to be easy embeddable. It provides a [HTTP API](https://github.com/Pita/etherpad-lite/wiki/HTTP-API)
+that allows your web application to manage pads, users and groups.
+There are several clients in for this API:
+
+* [PHP](https://github.com/TomNomNom/etherpad-lite-client), thx to [TomNomNom](https://github.com/TomNomNom)
+* [.Net](https://github.com/ja-jo/EtherpadLiteDotNet), thx to [ja-jo](https://github.com/ja-jo)
+* [Node.js](https://github.com/tomassedovic/etherpad-lite-client-js), thx to [tomassedovic](https://github.com/tomassedovic)
+* [Ruby](https://github.com/jhollinger/ruby-etherpad-lite), thx to [jhollinger](https://github.com/jhollinger)
+* [Python](https://github.com/devjones/PyEtherpadLite), thx to [devjones](https://github.com/devjones)
+
+There is also a [jQuery plugin](https://github.com/johnyma22/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website
+
+**Online demo**
+Visit to test it live
+
+Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)**
+
+# Etherpad vs Etherpad Lite
+
+
+
Etherpad
Etherpad Lite
+
+
+
Size of the folder (without git history)
30 MB
1.5 MB
+
+
+
Languages used server side
Javascript (Rhino), Java, Scala
Javascript (node.js)
+
+
+
Lines of server side Javascript code
~101k
~9k
+
+
+
RAM Usage immediately after start
257 MB (grows to ~1GB)
16 MB (grows to ~30MB)
+
+
+
+# Installation
+
+## Windows
+
+1. Download
+2. Extract the file
+3. Open the extracted folder and double click `start.bat`
+4. Open your web browser and browse to . You like it? Look at the 'Next Steps' section below
+
+## Linux
+
+**As root:**
+
+
+
Install the dependencies. We need gzip, git, curl, libssl develop libraries, python and gcc. For Debian/Ubuntuapt-get install gzip git-core curl python libssl-dev pkg-config build-essential
+ For Fedora/CentOSyum install gzip git-core curl python openssl-devel && yum groupinstall "Development Tools"
+
Move into the node folder cd node-v0.6* and build node with ./configure && make && make install
+
+
+
+
+**As any user (we recommend creating a separate user called etherpad-lite):**
+
+
+
Move to a folder where you want to install Etherpad Lite. Clone the git repository git clone 'git://github.com/Pita/etherpad-lite.git'
+
Change into the directory containing the Etherpad Lite source code clone with cd etherpad-lite
+
Start it with bin/run.sh
+
Open your web browser and visit http://localhost:9001. You like it? Look at the 'Next Steps' section below
+
+
+## Next Steps
+You can modify the settings in the file `settings.json`
+
+If you have multiple settings files, you may pass one to `bin/run.sh` using the `-s|--settings` option. This allows you to run multiple Etherpad Lite instances from the same installation.
+
+You should use a dedicated database such as "mysql" if you are planning on using etherpad-lite in a production environment, the "dirty" database driver is only for testing and/or development purposes.
+
+You can update to the latest version with `git pull origin`. The next start with bin/run.sh will update the dependencies
+
+Look at this wiki pages:
+
+* [How to deploy Etherpad Lite as a service](https://github.com/Pita/etherpad-lite/wiki/How-to-deploy-Etherpad-Lite-as-a-service)
+* [How to put Etherpad Lite behind a reverse Proxy](https://github.com/Pita/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy)
+* [How to customize your Etherpad Lite installation](https://github.com/Pita/etherpad-lite/wiki/How-to-customize-your-Etherpad-Lite-installation)
+* [How to use Etherpad-Lite with jQuery](https://github.com/Pita/etherpad-lite/wiki/How-to-use-Etherpad-Lite-with-jQuery)
+* [How to use Etherpad Lite with MySQL](https://github.com/Pita/etherpad-lite/wiki/How-to-use-Etherpad-Lite-with-MySQL)
+* [Sites that run Etherpad Lite](https://github.com/Pita/etherpad-lite/wiki/Sites-that-run-Etherpad-Lite)
+* [How to migrate the database from Etherpad to Etherpad Lite](https://github.com/Pita/etherpad-lite/wiki/How-to-migrate-the-database-from-Etherpad-to-Etherpad-Lite)
+
+You can find more information in the [wiki](https://github.com/Pita/etherpad-lite/wiki). Feel free to improve these wiki pages
+
+# Develop
+If you're new to git and github, start by watching [this video](http://youtu.be/67-Q26YH97E) then read this [git guide](http://learn.github.com/p/intro.html).
+
+If you're new to node.js, start with this video .
+
+You can debug with `bin/debugRun.sh`
+
+If you want to find out how Etherpads Easysync works (the library that makes it really realtime), start with this [PDF](https://github.com/Pita/etherpad-lite/raw/master/doc/easysync/easysync-full-description.pdf) (complex, but worth reading).
+
+You know all this and just want to know how you can help? Look at the [TODO list](https://github.com/Pita/etherpad-lite/wiki/TODO).
+You can join the [mailinglist](http://groups.google.com/group/etherpad-lite-dev) or go to the freenode irc channel [#etherpad-lite-dev](http://webchat.freenode.net?channels=#etherpad-lite-dev)
+
+You also help the project, if you only host a Etherpad Lite instance and share your experience with us.
+
+Please consider using [jshint](http://www.jshint.com/about/) if you plan to
+contribute to Etherpad Lite.
+
+# Modules created for this project
+
+* [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"
+
+# Donations
+* [Etherpad Foundation Flattr] (http://flattr.com/thing/71378/Etherpad-Foundation)
+* [Paypal] (http://etherpad.org) <-- Click the donate button
+
+# License
+[Apache License v2](http://www.apache.org/licenses/LICENSE-2.0.html)
\ No newline at end of file
diff --git a/README.plugins b/README.plugins
new file mode 100644
index 000000000..72c456447
--- /dev/null
+++ b/README.plugins
@@ -0,0 +1,16 @@
+So, a plugin is an npm package whose name starts with ep_ and that contains a file ep.json
+require("ep_etherpad-lite/static/js/plugingfw/plugins").update() will use npm to list all installed modules and read their ep.json files. These will contain registrations for hooks which are loaded
+A hook registration is a pairs of a hook name and a function reference (filename for require() plus function name)
+require("ep_etherpad-lite/static/js/plugingfw/hooks").callAll("hook_name", {argname:value}) will call all hook functions registered for hook_name
+That is the basis.
+Ok, so that was a slight simplification: inside ep.json, hook registrations are grouped into groups called "parts". Parts from all plugins are ordered using a topological sort according to "pre" and "post" pointers to other plugins/parts (just like dependencies, but non-installed plugins are silently ignored).
+This ordering is honored when you do callAll(hook_name) - hook functions for that hook_name are called in that order
+Ordering between plugins is undefined, only parts are ordered.
+
+A plugin usually has one part, but it van have multiple.
+This is so that it can insert some hook registration before that of another plugin, and another one after.
+This is important for e.g. registering URL-handlers for the express webserver, if you have some very generic and some very specific url-regexps
+So, that's basically it... apart from client-side hooks
+which works the same way, but uses a separate member of the part (part.client_hooks vs part.hooks), and where the hook function must obviously reside in a file require():able from the client...
+One thing more: The main etherpad tree is actually a plugin itself, called ep_etherpad-lite, and it has it's own ep.json...
+was that clear?
\ No newline at end of file
diff --git a/available_plugins/ep_fintest/.npmignore b/available_plugins/ep_fintest/.npmignore
new file mode 100644
index 000000000..74bd365b4
--- /dev/null
+++ b/available_plugins/ep_fintest/.npmignore
@@ -0,0 +1,7 @@
+.git*
+docs/
+examples/
+support/
+test/
+testing.js
+.DS_Store
diff --git a/available_plugins/ep_fintest/ep.json b/available_plugins/ep_fintest/ep.json
new file mode 100644
index 000000000..4ec8e3924
--- /dev/null
+++ b/available_plugins/ep_fintest/ep.json
@@ -0,0 +1,36 @@
+{
+ "parts": [
+ {
+ "name": "somepart",
+ "pre": [],
+ "post": ["ep_onemoreplugin/partone"]
+ },
+ {
+ "name": "partlast",
+ "pre": ["ep_fintest/otherpart"],
+ "post": [],
+ "hooks": {
+ "somehookname": "ep_fintest/partlast:somehook"
+ }
+ },
+ {
+ "name": "partfirst",
+ "pre": [],
+ "post": ["ep_onemoreplugin/somepart"]
+ },
+ {
+ "name": "otherpart",
+ "pre": ["ep_fintest/somepart", "ep_otherplugin/main"],
+ "post": [],
+ "hooks": {
+ "somehookname": "ep_fintest/otherpart:somehook",
+ "morehook": "ep_fintest/otherpart:morehook",
+ "expressCreateServer": "ep_fintest/otherpart:expressServer",
+ "eejsBlock_editbarMenuLeft": "ep_fintest/otherpart:eejsBlock_editbarMenuLeft"
+ },
+ "client_hooks": {
+ "somehookname": "ep_fintest/static/js/test:bar"
+ }
+ }
+ ]
+}
diff --git a/available_plugins/ep_fintest/otherpart.js b/available_plugins/ep_fintest/otherpart.js
new file mode 100644
index 000000000..718fb095c
--- /dev/null
+++ b/available_plugins/ep_fintest/otherpart.js
@@ -0,0 +1,25 @@
+test = require("ep_fintest/static/js/test.js");
+console.log("FOOO:", test.foo);
+
+exports.somehook = function (hook_name, args, cb) {
+ return cb(["otherpart:somehook was here"]);
+}
+
+exports.morehook = function (hook_name, args, cb) {
+ return cb(["otherpart:morehook was here"]);
+}
+
+exports.expressServer = function (hook_name, args, cb) {
+ args.app.get('/otherpart', function(req, res) {
+ res.send("Abra cadabra");
+ });
+}
+
+exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) {
+ args.content = args.content + '\
+
\
+ \
+
\
+ ';
+ return cb();
+}
diff --git a/available_plugins/ep_fintest/package.json b/available_plugins/ep_fintest/package.json
new file mode 100644
index 000000000..e221b5c18
--- /dev/null
+++ b/available_plugins/ep_fintest/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "ep_fintest",
+ "description": "A test plugin",
+ "version": "0.0.1",
+ "author": "RedHog (Egil Moeller) ",
+ "contributors": [],
+ "dependencies": {},
+ "engines": { "node": ">= 0.4.1 < 0.7.0" }
+}
diff --git a/available_plugins/ep_fintest/partlast.js b/available_plugins/ep_fintest/partlast.js
new file mode 100644
index 000000000..c3f1fc3eb
--- /dev/null
+++ b/available_plugins/ep_fintest/partlast.js
@@ -0,0 +1,3 @@
+exports.somehook = function (hook_name, args, cb) {
+ return cb(["partlast:somehook was here"]);
+}
diff --git a/available_plugins/ep_fintest/static/js/test.js b/available_plugins/ep_fintest/static/js/test.js
new file mode 100644
index 000000000..22d58cc2f
--- /dev/null
+++ b/available_plugins/ep_fintest/static/js/test.js
@@ -0,0 +1,5 @@
+exports.foo = 42;
+
+exports.bar = function (hook_name, args, cb) {
+ return cb(["FOOOO"]);
+}
\ No newline at end of file
diff --git a/available_plugins/ep_fintest/static/test.html b/available_plugins/ep_fintest/static/test.html
new file mode 100644
index 000000000..9e7fc5511
--- /dev/null
+++ b/available_plugins/ep_fintest/static/test.html
@@ -0,0 +1 @@
+Test bla bla
diff --git a/bin/buildForWindows.sh b/bin/buildForWindows.sh
new file mode 100755
index 000000000..1d47bff1b
--- /dev/null
+++ b/bin/buildForWindows.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+NODE_VERSION="0.8.4"
+
+#Move to the folder where ep-lite is installed
+cd `dirname $0`
+
+#Was this script started in the bin folder? if yes move out
+if [ -d "../bin" ]; then
+ cd "../"
+fi
+
+#Is wget installed?
+hash wget > /dev/null 2>&1 || {
+ echo "Please install wget" >&2
+ exit 1
+}
+
+#Is zip installed?
+hash zip > /dev/null 2>&1 || {
+ echo "Please install zip" >&2
+ exit 1
+}
+
+#Is zip installed?
+hash unzip > /dev/null 2>&1 || {
+ echo "Please install unzip" >&2
+ exit 1
+}
+
+START_FOLDER=$(pwd);
+
+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
+rm -rf node_modules
+rm -f etherpad-lite-win.zip
+
+echo "do a normal unix install first..."
+bin/installDeps.sh || exit 1
+
+echo "copy the windows settings template..."
+cp settings.json.template settings.json
+
+echo "resolve symbolic links..."
+cp -rL node_modules node_modules_resolved
+rm -rf node_modules
+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
+
+echo "create the zip..."
+cd /tmp
+zip -9 -r etherpad-lite-win.zip etherpad-lite-win
+mv etherpad-lite-win.zip $START_FOLDER
+
+echo "clean up..."
+rm -rf /tmp/etherpad-lite-win
+
+echo "Finished. You can find the zip in the Etherpad Lite root folder, it's called etherpad-lite-win.zip"
diff --git a/bin/checkPad.js b/bin/checkPad.js
new file mode 100644
index 000000000..a46c18140
--- /dev/null
+++ b/bin/checkPad.js
@@ -0,0 +1,134 @@
+/*
+ This is a debug tool. It checks all revisions for data corruption
+*/
+
+if(process.argv.length != 3)
+{
+ console.error("Use: node bin/checkPad.js $PADID");
+ process.exit(1);
+}
+//get the padID
+var padId = process.argv[2];
+
+//initalize the database
+var log4js = require("../src/node_modules/log4js");
+log4js.setGlobalLogLevel("INFO");
+var async = require("../src/node_modules/async");
+var db = require('../src/node/db/DB');
+
+var Changeset = require("ep_etherpad-lite/static/js/Changeset");
+var padManager;
+
+async.series([
+ //intallize the database
+ function (callback)
+ {
+ db.init(callback);
+ },
+ //get the pad
+ function (callback)
+ {
+ padManager = require('../src/node/db/PadManager');
+
+ padManager.doesPadExists(padId, function(err, exists)
+ {
+ if(!exists)
+ {
+ console.error("Pad does not exist");
+ process.exit(1);
+ }
+
+ padManager.getPad(padId, function(err, _pad)
+ {
+ pad = _pad;
+ callback(err);
+ });
+ });
+ },
+ function (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 /dev/null 2>&1 || {
+ echo "You need to install node-inspector to run the tests!" >&2
+ echo "You can install it with npm" >&2
+ echo "Run: npm install -g node-inspector" >&2
+ exit 1
+}
+
+node-inspector &
+
+echo "If you are new to node-inspector, take a look at this video: http://youtu.be/AOnK3NVnxL8"
+
+node --debug node_modules/ep_etherpad-lite/node/server.js $*
+
+#kill node-inspector before ending
+kill $!
diff --git a/bin/extractPadData.js b/bin/extractPadData.js
new file mode 100644
index 000000000..061a2e3f9
--- /dev/null
+++ b/bin/extractPadData.js
@@ -0,0 +1,89 @@
+/*
+ This is a debug tool. It helps to extract all datas of a pad and move it from an productive enviroment and to a develop enviroment to reproduce bugs there. It outputs a dirtydb file
+*/
+
+if(process.argv.length != 3)
+{
+ console.error("Use: node extractPadData.js $PADID");
+ process.exit(1);
+}
+//get the padID
+var padId = process.argv[2];
+
+//initalize the database
+var log4js = require("log4js");
+log4js.setGlobalLogLevel("INFO");
+var async = require("async");
+var db = require('../node/db/DB');
+var dirty = require("dirty")(padId + ".db");
+var padManager;
+var pad;
+var neededDBValues = ["pad:"+padId];
+
+async.series([
+ //intallize the database
+ function (callback)
+ {
+ db.init(callback);
+ },
+ //get the pad
+ function (callback)
+ {
+ padManager = require('../node/db/PadManager');
+
+ padManager.getPad(padId, function(err, _pad)
+ {
+ pad = _pad;
+ callback(err);
+ });
+ },
+ function (callback)
+ {
+ //add all authors
+ var authors = pad.getAllAuthors();
+ for(var i=0;i /dev/null 2>&1 || {
+ echo "Please install curl" >&2
+ exit 1
+}
+
+#Is node installed?
+hash node > /dev/null 2>&1 || {
+ echo "Please install node.js ( http://nodejs.org )" >&2
+ exit 1
+}
+
+#Is npm installed?
+hash npm > /dev/null 2>&1 || {
+ echo "Please install npm ( http://npmjs.org )" >&2
+ exit 1
+}
+
+#check npm version
+NPM_VERSION=$(npm --version)
+if [ ! $(echo $NPM_VERSION | cut -d "." -f 1) = "1" ]; then
+ echo "You're running a wrong version of npm, you're using $NPM_VERSION, we need 1.x" >&2
+ exit 1
+fi
+
+#check node version
+NODE_VERSION=$(node --version)
+NODE_V_MINOR=$(echo $NODE_VERSION | cut -d "." -f 1-2)
+if [ ! $NODE_V_MINOR = "v0.8" ] && [ ! $NODE_V_MINOR = "v0.6" ]; then
+ echo "You're running a wrong version of node, you're using $NODE_VERSION, we need v0.6.x or v0.8.x" >&2
+ exit 1
+fi
+
+#Get the name of the settings file
+settings="settings.json"
+a='';
+for arg in $*; do
+ if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
+ a=$arg
+done
+
+#Does a $settings exist? if no copy the template
+if [ ! -f $settings ]; then
+ echo "Copy the settings template to $settings..."
+ cp -v settings.json.template $settings || exit 1
+fi
+
+echo "Ensure that all dependencies are up to date..."
+(
+ mkdir -p node_modules
+ cd node_modules
+ [ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite
+ cd ep_etherpad-lite
+ npm install
+) || {
+ rm -rf node_modules
+ exit 1
+}
+
+echo "Ensure jQuery is downloaded and up to date..."
+DOWNLOAD_JQUERY="true"
+NEEDED_VERSION="1.7.1"
+if [ -f "src/static/js/jquery.js" ]; then
+ VERSION=$(cat src/static/js/jquery.js | head -n 3 | grep -o "v[0-9]\.[0-9]\(\.[0-9]\)\?");
+
+ if [ ${VERSION#v} = $NEEDED_VERSION ]; then
+ DOWNLOAD_JQUERY="false"
+ fi
+fi
+
+if [ $DOWNLOAD_JQUERY = "true" ]; then
+ curl -lo src/static/js/jquery.js http://code.jquery.com/jquery-$NEEDED_VERSION.js || exit 1
+fi
+
+#Remove all minified data to force node creating it new
+echo "Clear minfified cache..."
+rm -f var/minified*
+
+echo "ensure custom css/js files are created..."
+
+for f in "index" "pad" "timeslider"
+do
+ if [ ! -f "src/static/custom/$f.js" ]; then
+ cp -v "src/static/custom/js.template" "src/static/custom/$f.js" || exit 1
+ fi
+
+ if [ ! -f "src/static/custom/$f.css" ]; then
+ cp -v "src/static/custom/css.template" "src/static/custom/$f.css" || exit 1
+ fi
+done
+
+exit 0
diff --git a/bin/installOnWindows.bat b/bin/installOnWindows.bat
new file mode 100644
index 000000000..c46ac0340
--- /dev/null
+++ b/bin/installOnWindows.bat
@@ -0,0 +1,39 @@
+@echo off
+
+:: change directory to etherpad-lite root
+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(['6','8'].indexOf(process.version.split('.')[1].toString()) === -1) { console.log('You are running a wrong version of Node. Etherpad Lite requires v0.6.x or v0.8.x'); process.exit(1) }"
+cmd /C node -e %check_version% || exit /B 1
+
+echo _
+echo Installing etherpad-lite and dependencies...
+cmd /C npm install src/ || exit /B 1
+
+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"
+)
+
+echo _
+echo Clearing cache...
+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 _
+echo Installed Etherpad-lite!
\ No newline at end of file
diff --git a/bin/jshint.sh b/bin/jshint.sh
new file mode 100755
index 000000000..4dea73961
--- /dev/null
+++ b/bin/jshint.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ -d "../bin" ]; then
+ cd "../"
+fi
+
+JSHINT=./node_modules/jshint/bin/hint
+
+$JSHINT ./node/
diff --git a/bin/loadTesting/README b/bin/loadTesting/README
new file mode 100644
index 000000000..297756f9d
--- /dev/null
+++ b/bin/loadTesting/README
@@ -0,0 +1,75 @@
+This load tester is extremely useful for testing how many dormant clients can connect to etherpad lite.
+
+TODO:
+Emulate characters being typed into a pad
+
+HOW TO USE (from @mjd75) proper formatting at: https://github.com/Pita/etherpad-lite/issues/360
+
+Server 1:
+Installed Node.js (etc), EtherPad Lite and MySQL
+
+Server 2:
+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
+
+Launched two instances of Xvfb directly from the terminal:
+
+ #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
+
+I created a small JavaScript file for PhatomJS to use to control the browser instances:
+
+### BEGIN JAVASCRIPT ###
+
+var page = new WebPage(),
+ t, address;
+
+if (phantom.args.length === 0) {
+ console.log('Usage: loader.js ');
+ phantom.exit();
+} else {
+ t = Date.now();
+ address = phantom.args[0];
+
+ var page = new WebPage();
+ page.onResourceRequested = function (request) {
+ console.log('Request ' + JSON.stringify(request, undefined, 4));
+ };
+ page.onResourceReceived = function (response) {
+ console.log('Receive ' + JSON.stringify(response, undefined, 4));
+ };
+ page.open(address);
+
+}
+
+### END JAVASCRIPT ###
+
+And finally a launcher script that uses screen to run 400 instances of PhantomJS with the above script:
+
+### BEGIN SHELL SCRIPT ###
+
+#!/bin/bash
+
+# connect 200 instances to display :0
+for i in {1..200}
+do
+ DISPLAY=:0 screen -d -m phantomjs loader.js http://ec2-50-17-168-xx.compute-1.amazonaws.com:9001/p/pad2 && sleep 2
+done
+
+# connect 200 instances to display :1
+for i in {1..200}
+do
+ DISPLAY=:1 screen -d -m phantomjs loader.js http://ec2-50-17-168-xx.compute-1.amazonaws.com:9001/p/pad2 && sleep 2
+done
+
+### END SHELL SCRIPT ###
diff --git a/bin/loadTesting/launcher.sh b/bin/loadTesting/launcher.sh
new file mode 100755
index 000000000..375b15444
--- /dev/null
+++ b/bin/loadTesting/launcher.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# connect 500 instances to display :0
+for i in {1..500}
+do
+ 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
+
+# connect 500 instances to display :1
+for i in {1..500}
+do
+ echo $i
+ DISPLAY=:1 screen -d -m /home/phantomjs/bin/phantomjs loader.js http://10.0.0.55:9001/p/pad2 && sleep 2
+done
diff --git a/bin/loadTesting/loader.js b/bin/loadTesting/loader.js
new file mode 100644
index 000000000..ddcd0572d
--- /dev/null
+++ b/bin/loadTesting/loader.js
@@ -0,0 +1,20 @@
+var page = new WebPage(),
+ t, address;
+
+if (phantom.args.length === 0) {
+ console.log('Usage: loader.js ');
+ phantom.exit();
+} else {
+ t = Date.now();
+ address = phantom.args[0];
+
+ var page = new WebPage();
+ page.onResourceRequested = function (request) {
+ console.log('Request ' + JSON.stringify(request, undefined, 4));
+ };
+ page.onResourceReceived = function (response) {
+ console.log('Receive ' + JSON.stringify(response, undefined, 4));
+ };
+ page.open(address);
+
+}
diff --git a/bin/run.sh b/bin/run.sh
new file mode 100755
index 000000000..82e89a946
--- /dev/null
+++ b/bin/run.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#Move to the folder where ep-lite is installed
+cd `dirname $0`
+
+#Was this script started in the bin folder? if yes move out
+if [ -d "../bin" ]; then
+ cd "../"
+fi
+
+#Stop the script if its started as root
+if [ "$(id -u)" -eq 0 ]; then
+ echo "You shouldn't start Etherpad-Lite as root!"
+ echo "Please type 'Etherpad Lite rocks my socks' if you still want to start it as root"
+ read rocks
+ if [ ! $rocks = "Etherpad Lite rocks my socks" ]
+ then
+ echo "Your input was incorrect"
+ exit 1
+ fi
+fi
+
+#prepare the enviroment
+bin/installDeps.sh $* || exit 1
+
+#Move to the node folder and start
+echo "start..."
+node node_modules/ep_etherpad-lite/node/server.js $*
diff --git a/bin/safeRun.sh b/bin/safeRun.sh
new file mode 100755
index 000000000..b060f5d19
--- /dev/null
+++ b/bin/safeRun.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+#This script ensures that ep-lite is automatically restarting after an error happens
+
+#Handling Errors
+# 0 silent
+# 1 email
+ERROR_HANDLING=0
+# Your email address which should recieve the error messages
+EMAIL_ADDRESS="no-reply@example.com"
+# Sets the minimun amount of time betweens the sending of error emails.
+# This ensures you not get spamed while a endless reboot loop
+# It's the time in seconds
+TIME_BETWEEN_EMAILS=600 # 10 minutes
+
+# DON'T EDIT AFTER THIS LINE
+
+LAST_EMAIL_SEND=0
+
+#Move to the folder where ep-lite is installed
+cd `dirname $0`
+
+#Was this script started in the bin folder? if yes move out
+if [ -d "../bin" ]; then
+ cd "../"
+fi
+
+#check if a logfile parameter is set
+if [ -z "$1" ]; then
+ echo "Set a logfile as the first parameter"
+ exit 1
+fi
+
+while [ 1 ]
+do
+ #try to touch the file if it doesn't exist
+ if [ ! -f $1 ]; then
+ touch $1 || ( echo "Logfile '$1' is not writeable" && exit 1 )
+ fi
+
+ #check if the file is writeable
+ if [ ! -w $1 ]; then
+ echo "Logfile '$1' is not writeable"
+ exit 1
+ fi
+
+ #start the application
+ bin/run.sh >>$1 2>>$1
+
+ #Send email
+ if [ $ERROR_HANDLING = 1 ]; then
+ TIME_NOW=$(date +%s)
+ 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 $1)" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS
+
+ LAST_EMAIL_SEND=$TIME_NOW
+ fi
+ fi
+
+ echo "RESTART!" >>$1
+
+ #Sleep 10 seconds before restart
+ sleep 10
+done
diff --git a/doc/all.md b/doc/all.md
new file mode 100644
index 000000000..c0cbf369f
--- /dev/null
+++ b/doc/all.md
@@ -0,0 +1,3 @@
+@include documentation
+@include api/api
+@include database
diff --git a/doc/api/api.md b/doc/api/api.md
new file mode 100644
index 000000000..830e5f4c4
--- /dev/null
+++ b/doc/api/api.md
@@ -0,0 +1,7 @@
+# API
+@include embed_parameters
+@include http_api
+@include hooks_client-side
+@include hooks_server-side
+@include editorInfo
+@include changeset_library
\ No newline at end of file
diff --git a/doc/api/changeset_library.md b/doc/api/changeset_library.md
new file mode 100644
index 000000000..2dce55aa3
--- /dev/null
+++ b/doc/api/changeset_library.md
@@ -0,0 +1,151 @@
+# Changeset Library
+
+```
+"Z:z>1|2=m=b*0|1+1$\n"
+```
+
+This is a Changeset. Its just a string and its very difficult to read in this form. But the Changeset Library gives us some tools to read it.
+
+A changeset describes the diff between two revisions of the document. The Browser sends changesets to the server and the server sends them to the clients to update them. This Changesets gets also saved into the history of a pad. Which allows us to go back to every revision from the past.
+
+## Changeset.unpack(changeset)
+
+ * `changeset` {String}
+
+This functions returns an object representaion of the changeset, similar to this:
+
+```
+{ oldLen: 35, newLen: 36, ops: '|2=m=b*0|1+1', charBank: '\n' }
+```
+
+ * `oldLen` {Number} the original length of the document.
+ * `newLen` {Number} the length of the document after the changeset is applied.
+ * `ops` {String} the actual changes, introduced by this changeset.
+ * `charBank` {String} All characters that are added by this changeset.
+
+## Changeset.opIterator(ops)
+
+ * `ops` {String} The operators, returned by `Changeset.unpack()`
+
+Returns an operator iterator. This iterator allows us to iterate over all operators that are in the changeset.
+
+You can iterate with an opIterator using its `next()` and `hasNext()` methods. Next returns the `next()` operator object and `hasNext()` indicates, whether there are any operators left.
+
+## The Operator object
+There are 3 types of operators: `+`,`-` and `=`. These operators describe different changes to the document, beginning with the first character of the document. A `=` operator doesn't change the text, but it may add or remove text attributes. A `-` operator removes text. And a `+` Operator adds text and optionally adds some attributes to it.
+
+ * `opcode` {String} the operator type
+ * `chars` {Number} the length of the text changed by this operator.
+ * `lines` {Number} the number of lines changed by this operator.
+ * `attribs` {attribs} attributes set on this text.
+
+### Example
+```
+{ opcode: '+',
+ chars: 1,
+ lines: 1,
+ attribs: '*0' }
+```
+
+## APool
+
+```
+> var AttributePoolFactory = require("./utils/AttributePoolFactory");
+> var apool = AttributePoolFactory.createAttributePool();
+> console.log(apool)
+{ numToAttrib: {},
+ attribToNum: {},
+ nextNum: 0,
+ putAttrib: [Function],
+ getAttrib: [Function],
+ getAttribKey: [Function],
+ getAttribValue: [Function],
+ eachAttrib: [Function],
+ toJsonable: [Function],
+ fromJsonable: [Function] }
+```
+
+This creates an empty apool. A apool saves which attributes were used during the history of a pad. There is one apool for each pad. It only saves the attributes that were really used, it doesn't save unused attributes. Lets fill this apool with some values
+
+```
+> apool.fromJsonable({"numToAttrib":{"0":["author","a.kVnWeomPADAT2pn9"],"1":["bold","true"],"2":["italic","true"]},"nextNum":3});
+> console.log(apool)
+{ numToAttrib:
+ { '0': [ 'author', 'a.kVnWeomPADAT2pn9' ],
+ '1': [ 'bold', 'true' ],
+ '2': [ 'italic', 'true' ] },
+ attribToNum:
+ { 'author,a.kVnWeomPADAT2pn9': 0,
+ 'bold,true': 1,
+ 'italic,true': 2 },
+ nextNum: 3,
+ putAttrib: [Function],
+ getAttrib: [Function],
+ getAttribKey: [Function],
+ getAttribValue: [Function],
+ eachAttrib: [Function],
+ toJsonable: [Function],
+ fromJsonable: [Function] }
+```
+
+We used the fromJsonable function to fill the empty apool with values. the fromJsonable and toJsonable functions are used to serialize and deserialize an apool. You can see that it stores the relation between numbers and attributes. So for example the attribute 1 is the attribute bold and vise versa. A attribute is always a key value pair. For stuff like bold and italic its just 'italic':'true'. For authors its author:$AUTHORID. So a character can be bold and italic. But it can't belong to multiple authors
+
+```
+> apool.getAttrib(1)
+[ 'bold', 'true' ]
+```
+
+Simple example of how to get the key value pair for the attribute 1
+
+## AText
+
+```
+> var atext = {"text":"bold text\nitalic text\nnormal text\n\n","attribs":"*0*1+9*0|1+1*0*1*2+b|1+1*0+b|2+2"};
+> console.log(atext)
+{ text: 'bold text\nitalic text\nnormal text\n\n',
+ attribs: '*0*1+9*0|1+1*0*1*2+b|1+1*0+b|2+2' }
+```
+
+This is an atext. An atext has two parts: text and attribs. The text is just the text of the pad as a string. We will look closer at the attribs at the next steps
+
+```
+> var opiterator = Changeset.opIterator(atext.attribs)
+> console.log(opiterator)
+{ next: [Function: next],
+ hasNext: [Function: hasNext],
+ lastIndex: [Function: lastIndex] }
+> opiterator.next()
+{ opcode: '+',
+ chars: 9,
+ lines: 0,
+ attribs: '*0*1' }
+> opiterator.next()
+{ opcode: '+',
+ chars: 1,
+ lines: 1,
+ attribs: '*0' }
+> opiterator.next()
+{ opcode: '+',
+ chars: 11,
+ lines: 0,
+ attribs: '*0*1*2' }
+> opiterator.next()
+{ opcode: '+',
+ chars: 1,
+ lines: 1,
+ attribs: '' }
+> opiterator.next()
+{ opcode: '+',
+ chars: 11,
+ lines: 0,
+ attribs: '*0' }
+> opiterator.next()
+{ opcode: '+',
+ chars: 2,
+ lines: 2,
+ attribs: '' }
+```
+
+The attribs are again a bunch of operators like .ops in the changeset was. But these operators are only + operators. They describe which part of the text has which attributes
+
+For more information see /doc/easysync/easysync-notes.txt in the source.
diff --git a/doc/api/editorInfo.md b/doc/api/editorInfo.md
new file mode 100644
index 000000000..e4322e9e1
--- /dev/null
+++ b/doc/api/editorInfo.md
@@ -0,0 +1,47 @@
+# editorInfo
+
+## editorInfo.ace_replaceRange(start, end, text)
+This function replaces a range (from `start` to `end`) with `text`.
+
+## editorInfo.ace_getRep()
+Returns the `rep` object.
+
+## editorInfo.ace_getAuthor()
+## editorInfo.ace_inCallStack()
+## editorInfo.ace_inCallStackIfNecessary(?)
+## editorInfo.ace_focus(?)
+## editorInfo.ace_importText(?)
+## editorInfo.ace_importAText(?)
+## editorInfo.ace_exportText(?)
+## editorInfo.ace_editorChangedSize(?)
+## editorInfo.ace_setOnKeyPress(?)
+## editorInfo.ace_setOnKeyDown(?)
+## editorInfo.ace_setNotifyDirty(?)
+## editorInfo.ace_dispose(?)
+## editorInfo.ace_getFormattedCode(?)
+## editorInfo.ace_setEditable(bool)
+## editorInfo.ace_execCommand(?)
+## editorInfo.ace_callWithAce(fn, callStack, normalize)
+## editorInfo.ace_setProperty(key, value)
+## editorInfo.ace_setBaseText(txt)
+## editorInfo.ace_setBaseAttributedText(atxt, apoolJsonObj)
+## editorInfo.ace_applyChangesToBase(c, optAuthor, apoolJsonObj)
+## editorInfo.ace_prepareUserChangeset()
+## editorInfo.ace_applyPreparedChangesetToBase()
+## editorInfo.ace_setUserChangeNotificationCallback(f)
+## editorInfo.ace_setAuthorInfo(author, info)
+## editorInfo.ace_setAuthorSelectionRange(author, start, end)
+## editorInfo.ace_getUnhandledErrors()
+## editorInfo.ace_getDebugProperty(prop)
+## editorInfo.ace_fastIncorp(?)
+## editorInfo.ace_isCaret(?)
+## editorInfo.ace_getLineAndCharForPoint(?)
+## editorInfo.ace_performDocumentApplyAttributesToCharRange(?)
+## editorInfo.ace_setAttributeOnSelection(?)
+## editorInfo.ace_toggleAttributeOnSelection(?)
+## editorInfo.ace_performSelectionChange(?)
+## editorInfo.ace_doIndentOutdent(?)
+## editorInfo.ace_doUndoRedo(?)
+## editorInfo.ace_doInsertUnorderedList(?)
+## editorInfo.ace_doInsertOrderedList(?)
+## editorInfo.ace_performDocumentApplyAttributesToRange()
diff --git a/doc/api/embed_parameters.md b/doc/api/embed_parameters.md
new file mode 100644
index 000000000..587305665
--- /dev/null
+++ b/doc/api/embed_parameters.md
@@ -0,0 +1,47 @@
+# Embed parameters
+You can easily embed your etherpad-lite into any webpage by using iframes. You can configure the embedded pad using embed paramters.
+
+Example:
+
+Cut and paste the following code into any webpage to embed a pad. The parameters below will hide the chat and the line numbers.
+
+```
+
+```
+
+## showLineNumbers
+ * Boolean
+
+Default: true
+
+## showControls
+ * Boolean
+
+Default: true
+
+## showChat
+ * Boolean
+
+Default: true
+
+## useMonospaceFont
+ * Boolean
+
+Default: false
+
+## userName
+ * String
+
+Default: "unnamed"
+
+Example: `userName=Etherpad%20User`
+
+## noColors
+ * Boolean
+
+Default: false
+
+## alwaysShowChat
+ * Boolean
+
+Default: false
diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md
new file mode 100644
index 000000000..50ec3f989
--- /dev/null
+++ b/doc/api/hooks_client-side.md
@@ -0,0 +1,181 @@
+# Client-side hooks
+Most of these hooks are called during or in order to set up the formatting process.
+
+All hooks registered to these events are called with two arguments:
+
+1. name - the name of the hook being called
+2. context - an object with some relevant information about the context of the call
+
+## documentReady
+Called from: src/templates/pad.html
+
+Things in context:
+
+nothing
+
+This hook proxies the functionality of jQuery's `$(document).ready` event.
+
+## aceDomLineProcessLineAttributes
+Called from: src/static/js/domline.js
+
+Things in context:
+
+1. domline - The current DOM line being processed
+2. cls - The class of the current block element (useful for styling)
+
+This hook is called for elements in the DOM that have the "lineMarkerAttribute" set. You can add elements into this category with the aceRegisterBlockElements hook above.
+
+The return value of this hook should have the following structure:
+
+`{ preHtml: String, postHtml: String, processedMarker: Boolean }`
+
+The preHtml and postHtml values will be added to the HTML display of the element, and if processedMarker is true, the engine won't try to process it any more.
+
+## aceCreateDomLine
+Called from: src/static/js/domline.js
+
+Things in context:
+
+1. domline - the current DOM line being processed
+2. cls - The class of the current element (useful for styling)
+
+This hook is called for any line being processed by the formatting engine, unless the aceDomLineProcessLineAttributes hook from above returned true, in which case this hook is skipped.
+
+The return value of this hook should have the following structure:
+
+`{ extraOpenTags: String, extraCloseTags: String, cls: String }`
+
+extraOpenTags and extraCloseTags will be added before and after the element in question, and cls will be the new class of the element going forward.
+
+## acePostWriteDomLineHTML
+Called from: src/static/js/domline.js
+
+Things in context:
+
+1. node - the DOM node that just got written to the page
+
+This hook is for right after a node has been fully formatted and written to the page.
+
+## aceAttribsToClasses
+Called from: src/static/js/linestylefilter.js
+
+Things in context:
+
+1. linestylefilter - the JavaScript object that's currently processing the ace attributes
+2. key - the current attribute being processed
+3. value - the value of the attribute being processed
+
+This hook is called during the attribute processing procedure, and should be used to translate key, value pairs into valid HTML classes that can be inserted into the DOM.
+
+The return value for this function should be a list of classes, which will then be parsed into a valid class string.
+
+## aceGetFilterStack
+Called from: src/static/js/linestylefilter.js
+
+Things in context:
+
+1. linestylefilter - the JavaScript object that's currently processing the ace attributes
+2. browser - an object indicating which browser is accessing the page
+
+This hook is called to apply custom regular expression filters to a set of styles. The one example available is the ep_linkify plugin, which adds internal links. They use it to find the telltale `[[ ]]` syntax that signifies internal links, and finding that syntax, they add in the internalHref attribute to be later used by the aceCreateDomLine hook (documented above).
+
+## aceEditorCSS
+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.
+
+## aceInitInnerdocbodyHead
+Called from: src/static/js/ace.js
+
+Things in context:
+
+1. iframeHTML - the HTML of the editor iframe up to this point, in array format
+
+This hook is called during the creation of the editor HTML. The array should have lines of HTML added to it, giving the plugin author a chance to add in meta, script, link, and other tags that go into the `` element of the editor HTML document.
+
+## aceEditEvent
+Called from: src/static/js/ace2_inner.js
+
+Things in context:
+
+1. callstack - a bunch of information about the current action
+2. editorInfo - information about the user who is making the change
+3. rep - information about where the change is being made
+4. documentAttributeManager - information about attributes in the document (this is a mystery to me)
+
+This hook is made available to edit the edit events that might occur when changes are made. Currently you can change the editor information, some of the meanings of the edit, and so on. You can also make internal changes (internal to your plugin) that use the information provided by the edit event.
+
+## aceRegisterBlockElements
+Called from: src/static/js/ace2_inner.js
+
+Things in context: None
+
+The return value of this hook will add elements into the "lineMarkerAttribute" category, making the aceDomLineProcessLineAttributes hook (documented below) call for those elements.
+
+## aceInitialized
+Called from: src/static/js/ace2_inner.js
+
+Things in context:
+
+1. editorInfo - information about the user who will be making changes through the interface, and a way to insert functions into the main ace object (see ep_headings)
+2. rep - information about where the user's cursor is
+3. documentAttributeManager - some kind of magic
+
+This hook is for inserting further information into the ace engine, for later use in formatting hooks.
+
+## postAceInit
+Called from: src/static/js/pad.js
+
+Things in context:
+
+1. ace - the ace object that is applied to this editor.
+
+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.
+
+## userJoinOrUpdate
+Called from: src/static/js/pad_userlist.js
+
+Things in context:
+
+1. info - the user information
+
+This hook is called on the client side whenever a user joins or changes. This can be used to create notifications or an alternate user list.
+
+## collectContentPre
+Called from: src/static/js/contentcollector.js
+
+Things in context:
+
+1. cc - the contentcollector object
+2. state - the current state of the change being made
+3. tname - the tag name of this node currently being processed
+4. style - the style applied to the node (probably CSS)
+5. cls - the HTML class string of the node
+
+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.
+
+## collectContentPost
+Called from: src/static/js/contentcollector.js
+
+Things in context:
+
+1. cc - the contentcollector object
+2. state - the current state of the change being made
+3. tname - the tag name of this node currently being processed
+4. style - the style applied to the node (probably CSS)
+5. cls - the HTML class string of the node
+
+This hook is called after 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.
+
+## handleClientMessage_`name`
+Called from: `src/static/js/collab_client.js`
+
+Things in context:
+
+1. payload - the data that got sent with the message (use it for custom message content)
+
+This hook gets called every time the client receives a message of type `name`. This can most notably be used with the new HTTP API call, "sendClientsMessage", which sends a custom message type to all clients connected to a pad. You can also use this to handle existing types.
+
+`collab_client.js` has a pretty extensive list of message types, if you want to take a look.
diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md
new file mode 100644
index 000000000..518e12130
--- /dev/null
+++ b/doc/api/hooks_server-side.md
@@ -0,0 +1,143 @@
+# Server-side hooks
+These hooks are called on server-side.
+
+All hooks registered to these events are called with two arguments:
+
+1. name - the name of the hook being called
+2. context - an object with some relevant information about the context of the call
+
+## loadSettings
+Called from: src/node/server.js
+
+Things in context:
+
+1. settings - the settings object
+
+Use this hook to receive the global settings in your plugin.
+
+## pluginUninstall
+Called from: src/static/js/pluginfw/installer.js
+
+Things in context:
+
+1. plugin_name - self-explanatory
+
+If this hook returns an error, the callback to the uninstall function gets an error as well. This mostly seems useful for handling additional features added in based on the installation of other plugins, which is pretty cool!
+
+## pluginInstall
+Called from: src/static/js/pluginfw/installer.js
+
+Things in context:
+
+1. plugin_name - self-explanatory
+
+If this hook returns an error, the callback to the install function gets an error, too. This seems useful for adding in features when a particular plugin is installed.
+
+## init_``
+Called from: src/static/js/pluginfw/plugins.js
+
+Things in context: None
+
+This function is called after a specific plugin is initialized. This would probably be more useful than the previous two functions if you only wanted to add in features to one specific plugin.
+
+## expressConfigure
+Called from: src/node/server.js
+
+Things in context:
+
+1. app - the main application object
+
+This is a helpful hook for changing the behavior and configuration of the application. It's called right after the application gets configured.
+
+## expressCreateServer
+Called from: src/node/server.js
+
+Things in context:
+
+1. app - the main application object (helpful for adding new paths and such)
+
+This hook gets called after the application object has been created, but before it starts listening. This is similar to the expressConfigure hook, but it's not guaranteed that the application object will have all relevant configuration variables.
+
+## eejsBlock_``
+Called from: src/node/eejs/index.js
+
+Things in context:
+
+1. content - the content of the block
+
+This hook gets called upon the rendering of an ejs template block. For any specific kind of block, you can change how that block gets rendered by modifying the content object passed in.
+
+Have a look at `src/templates/pad.html` and `src/templates/timeslider.html` to see which blocks are available.
+
+## socketio
+Called from: src/node/hooks/express/socketio.js
+
+Things in context:
+
+1. app - the application object
+2. io - the socketio object
+
+I have no idea what this is useful for, someone else will have to add this description.
+
+## authorize
+Called from: src/node/hooks/express/webaccess.js
+
+Things in context:
+
+1. req - the request object
+2. res - the response object
+3. next - ?
+4. resource - the path being accessed
+
+This is useful for modifying the way authentication is done, especially for specific paths.
+
+## authenticate
+Called from: src/node/hooks/express/webaccess.js
+
+Things in context:
+
+1. req - the request object
+2. res - the response object
+3. next - ?
+4. username - the username used (optional)
+5. password - the password used (optional)
+
+This is useful for modifying the way authentication is done.
+
+## authFailure
+Called from: src/node/hooks/express/webaccess.js
+
+Things in context:
+
+1. req - the request object
+2. res - the response object
+3. next - ?
+
+This is useful for modifying the way authentication is done.
+
+## handleMessage
+Called from: src/node/handler/PadMessageHandler.js
+
+Things in context:
+
+1. message - the message being handled
+2. client - the client object from socket.io
+
+This hook will be called once a message arrive. If a plugin calls `callback(null)` the message will be dropped. However it is not possible to modify the message.
+
+Plugins may also decide to implement custom behavior once a message arrives.
+
+**WARNING**: handleMessage will be called, even if the client is not authorized to send this message. It's up to the plugin to check permissions.
+
+Example:
+
+```
+function handleMessage ( hook, context, callback ) {
+ if ( context.message.type == 'USERINFO_UPDATE' ) {
+ // If the message type is USERINFO_UPDATE, drop the message
+ callback(null);
+ }else{
+ callback();
+ }
+};
+```
diff --git a/doc/api/http_api.md b/doc/api/http_api.md
new file mode 100644
index 000000000..058a2ba6c
--- /dev/null
+++ b/doc/api/http_api.md
@@ -0,0 +1,250 @@
+# HTTP API
+
+## What can I do with this API?
+The API gives another web application control of the pads. The basic functions are
+
+* create/delete pads
+* grant/forbid access to pads
+* get/set pad content
+
+The API is designed in a way, so you can reuse your existing user system with their permissions, and map it to etherpad lite. Means: Your web application still has to do authentication, but you can tell etherpad lite via the api, which visitors should get which permissions. This allows etherpad lite to fit into any web application and extend it with real-time functionality. You can embed the pads via an iframe into your website.
+
+Take a look at [HTTP API client libraries](https://github.com/Pita/etherpad-lite/wiki/HTTP-API-client-libraries) to see if a library in your favorite language.
+
+## Examples
+
+### Example 1
+
+A portal (such as WordPress) wants to give a user access to a new pad. Let's assume the user have the internal id 7 and his name is michael.
+
+Portal maps the internal userid to an etherpad author.
+
+> Request: `http://pad.domain/api/1/createAuthorIfNotExistsFor?apikey=secret&name=Michael&authorMapper=7`
+>
+> Response: `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}`
+
+Portal maps the internal userid to an etherpad group:
+
+> Request: `http://pad.domain/api/1/createGroupIfNotExistsFor?apikey=secret&groupMapper=7`
+>
+> Response: `{code: 0, message:"ok", data: {groupID: "g.s8oes9dhwrvt0zif"}}`
+
+Portal creates a pad in the userGroup
+
+> Request: `http://pad.domain/api/1/createGroupPad?apikey=secret&groupID=g.s8oes9dhwrvt0zif&padName=samplePad&text=This is the first sentence in the pad`
+>
+> Response: `{code: 0, message:"ok", data: null}`
+
+Portal starts the session for the user on the group:
+
+> Request: `http://pad.domain/api/1/createSession?apikey=secret&groupID=g.s8oes9dhwrvt0zif&authorID=a.s8oes9dhwrvt0zif&validUntil=1312201246`
+>
+> Response: `{"data":{"sessionID": "s.s8oes9dhwrvt0zif"}}`
+
+Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.
+
+### Example 2
+
+A portal (such as WordPress) wants to transform the contents of a pad that multiple admins edited into a blog post.
+
+Portal retrieves the contents of the pad for entry into the db as a blog post:
+
+> Request: `http://pad.domain/api/1/getText?apikey=secret&padID=g.s8oes9dhwrvt0zif$123`
+>
+> Response: `{code: 0, message:"ok", data: {text:"Welcome Text"}}`
+
+Portal submits content into new blog post
+
+> Portal.AddNewBlog(content)
+>
+
+## Usage
+
+### Request Format
+
+The API is accessible via HTTP. HTTP Requests are in the format /api/$APIVERSION/$FUNCTIONNAME. Parameters are transmitted via HTTP GET. $APIVERSION is 1
+
+### Response Format
+Responses are valid JSON in the following format:
+
+```js
+{
+ "code": number,
+ "message": string,
+ "data": obj
+}
+```
+
+* **code** a return code
+ * **0** everything ok
+ * **1** wrong parameters
+ * **2** internal error
+ * **3** no such function
+ * **4** no or wrong API Key
+* **message** a status message. Its ok if everything is fine, else it contains an error message
+* **data** the payload
+
+### Overview
+
+
+
+## Data Types
+
+* **groupID** a string, the unique id of a group. Format is g.16RANDOMCHARS, for example g.s8oes9dhwrvt0zif
+* **sessionID** a string, the unique id of a session. Format is s.16RANDOMCHARS, for example s.s8oes9dhwrvt0zif
+* **authorID** a string, the unique id of an author. Format is a.16RANDOMCHARS, for example a.s8oes9dhwrvt0zif
+* **readOnlyID** a string, the unique id of an readonly relation to a pad. Format is r.16RANDOMCHARS, for example r.s8oes9dhwrvt0zif
+* **padID** a string, format is GROUPID$PADNAME, for example the pad test of group g.s8oes9dhwrvt0zif has padID g.s8oes9dhwrvt0zif$test
+
+### Authentication
+
+Authentication works via a token that is sent with each request as a post parameter. There is a single token per Etherpad-Lite deployment. This token will be random string, generated by Etherpad-Lite at the first start. It will be saved in APIKEY.txt in the root folder of Etherpad Lite. Only Etherpad Lite and the requesting application knows this key. Token management will not be exposed through this API.
+
+### Node Interoperability
+
+All functions will also be available through a node module accessable from other node.js applications.
+
+### JSONP
+
+The API provides _JSONP_ support to allow requests from a server in a different domain.
+Simply add `&jsonp=?` to the API call.
+
+Example usage: http://api.jquery.com/jQuery.getJSON/
+
+## API Methods
+
+### Groups
+Pads can belong to a group. The padID of grouppads is starting with a groupID like g.asdfasdfasdfasdf$test
+
+* **createGroup()** creates a new group
*Example returns:*
+ * `{code: 0, message:"ok", data: {groupID: g.s8oes9dhwrvt0zif}}`
+
+* **createGroupIfNotExistsFor(groupMapper)** this functions helps you to map your application group ids to etherpad lite group ids
*Example returns:*
+ * `{code: 0, message:"ok", data: {groupID: g.s8oes9dhwrvt0zif}}`
+
+* **deleteGroup(groupID)** deletes a group
*Example returns:*
+ * `{code: 0, message:"ok", data: null}`
+ * `{code: 1, message:"groupID does not exist", data: null}`
+
+* **listPads(groupID)** returns all pads of this group
*Example returns:*
+ * `{code: 0, message:"ok", data: {padIDs : ["g.s8oes9dhwrvt0zif$test", "g.s8oes9dhwrvt0zif$test2"]}`
+ * `{code: 1, message:"groupID does not exist", data: null}`
+
+* **createGroupPad(groupID, padName [, text])** creates a new pad in this group
*Example returns:*
+ * `{code: 0, message:"ok", data: null}`
+ * `{code: 1, message:"pad does already exist", data: null}`
+ * `{code: 1, message:"groupID does not exist", data: null}`
+
+### Author
+These authors are bound to the attributes the users choose (color and name).
+
+* **createAuthor([name])** creates a new author
*Example returns:*
+ * `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}`
+
+* **createAuthorIfNotExistsFor(authorMapper [, name])** this functions helps you to map your application author ids to etherpad lite author ids
*Example returns:*
+ * `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif"}}`
+
+* **listPadsOfAuthor(authorID)** returns an array of all pads this author contributed to
*Example returns:*
+ * `{code: 0, message:"ok", data: {padIDs: ["g.s8oes9dhwrvt0zif$test", "g.s8oejklhwrvt0zif$foo"]}}`
+ * `{code: 1, message:"authorID does not exist", data: null}`
+
+* **getAuthorName(authorID)** Returns the Author Name of the author
*Example returns:*
+ * `{code: 0, message:"ok", data: {authorName: "John McLear"}}`
+
+-> can't be deleted cause this would involve scanning all the pads where this author was
+
+### Session
+Sessions can be created between a group and an author. This allows an author to access more than one group. The sessionID will be set as a cookie to the client and is valid until a certain date. The session cookie can also contain multiple comma-seperated sessionIDs, allowing a user to edit pads in different groups at the same time. Only users with a valid session for this group, can access group pads. You can create a session after you authenticated the user at your web application, to give them access to the pads. You should save the sessionID of this session and delete it after the user logged out.
+
+* **createSession(groupID, authorID, validUntil)** creates a new session. validUntil is an unix timestamp in seconds
*Example returns:*
+ * `{code: 1, message:"ok", data: null}`
+ * `{code: 1, message:"sessionID does not exist", data: null}`
+
+* **getSessionInfo(sessionID)** returns informations about a session
*Example returns:*
+ * `{code: 0, message:"ok", data: {authorID: "a.s8oes9dhwrvt0zif", groupID: g.s8oes9dhwrvt0zif, validUntil: 1312201246}}`
+ * `{code: 1, message:"sessionID does not exist", data: null}`
+
+* **listSessionsOfGroup(groupID)** returns all sessions of a group
*Example returns:*
+ * `{"code":0,"message":"ok","data":{"s.oxf2ras6lvhv2132":{"groupID":"g.s8oes9dhwrvt0zif","authorID":"a.akf8finncvomlqva","validUntil":2312905480}}}`
+ * `{code: 1, message:"groupID does not exist", data: null}`
+
+* **listSessionsOfAuthor(authorID)** returns all sessions of an author
*Example returns:*
+ * `{"code":0,"message":"ok","data":{"s.oxf2ras6lvhv2132":{"groupID":"g.s8oes9dhwrvt0zif","authorID":"a.akf8finncvomlqva","validUntil":2312905480}}}`
+ * `{code: 1, message:"authorID does not exist", data: null}`
+
+### Pad Content
+
+Pad content can be updated and retrieved through the API
+
+* **getText(padID, [rev])** returns the text of a pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {text:"Welcome Text"}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **setText(padID, text)** 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}`
+
+* **getHTML(padID, [rev])** returns the text of a pad formatted as HTML
*Example returns:*
+ * `{code: 0, message:"ok", data: {html:"Welcome Text More Text"}}`
+ * `{code: 1, message:"padID does not exist", 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.
+
+* **createPad(padID [, text])** creates a new (non-group) pad. Note that if you need to create a group Pad, you should call **createGroupPad**.
*Example returns:*
+ * `{code: 0, message:"ok", data: null}`
+ * `{code: 1, message:"pad does already exist", data: null}`
+
+* **getRevisionsCount(padID)** returns the number of revisions of this pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {revisions: 56}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **padUsersCount(padID)** returns the number of user that are currently editing this pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {padUsersCount: 5}}`
+
+* **padUsers(padID)** returns the list of users that are currently editing this pad
*Example returns:*
+ * `{code: 0, message:"ok", data: null}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **getReadOnlyID(padID)** returns the read only link of a pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {readOnlyID: "r.s8oes9dhwrvt0zif"}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **setPublicStatus(padID, publicStatus)** sets a boolean for the public status of a pad
*Example returns:*
+ * `{code: 0, message:"ok", data: null}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **getPublicStatus(padID)** return true of false
*Example returns:*
+ * `{code: 0, message:"ok", data: {publicStatus: true}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **setPassword(padID, password)** returns ok or a error message
*Example returns:*
+ * `{code: 0, message:"ok", data: null}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **isPasswordProtected(padID)** returns true or false
*Example returns:*
+ * `{code: 0, message:"ok", data: {passwordProtection: true}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **listAuthorsOfPad(padID)** returns an array of authors who contributed to this pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {authorIDs : ["a.s8oes9dhwrvt0zif", "a.akf8finncvomlqva"]}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **getLastEdited(padID)** returns the timestamp of the last revision of the pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {lastEdited: 1340815946602}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
+
+* **sendClientsMessage(padID, msg)** sends a custom message of type `msg` to the pad
*Example returns:*
+ * `{code: 0, message:"ok", data: {}}`
+ * `{code: 1, message:"padID does not exist", data: null}`
diff --git a/doc/database.md b/doc/database.md
new file mode 100644
index 000000000..2e06e2064
--- /dev/null
+++ b/doc/database.md
@@ -0,0 +1,64 @@
+# Database structure
+
+## Keys and their values
+
+### pad:$PADID
+Saves all informations about pads
+
+* **atext** - the latest attributed text
+* **pool** - the attribute pool
+* **head** - the number of the latest revision
+* **chatHead** - the number of the latest chat entry
+* **public** - flag that disables security for this pad
+* **passwordHash** - string that contains a bcrypt hashed password for this pad
+
+### pad:$PADID:revs:$REVNUM
+Saves a revision $REVNUM of pad $PADID
+
+* **meta**
+ * **author** - the autorID of this revision
+ * **timestamp** - the timestamp of when this revision was created
+* **changeset** - the changeset of this revision
+
+### pad:$PADID:chat:$CHATNUM
+Saves a chatentry with num $CHATNUM of pad $PADID
+
+* **text** - the text of this chat entry
+* **userId** - the autorID of this chat entry
+* **time** - the timestamp of this chat entry
+
+### pad2readonly:$PADID
+Translates a padID to a readonlyID
+### readonly2pad:$READONLYID
+Translates a readonlyID to a padID
+### token2author:$TOKENID
+Translates a token to an authorID
+### globalAuthor:$AUTHORID
+Information about an author
+
+* **name** - the name of this author as shown in the pad
+* **colorID** - the colorID of this author as shown in the pad
+
+### mapper2group:$MAPPER
+Maps an external application identifier to an internal group
+### mapper2author:$MAPPER
+Maps an external application identifier to an internal author
+### group:$GROUPID
+a group of pads
+
+* **pads** - object with pad names in it, values are 1
+### session:$SESSIONID
+a session between an author and a group
+
+* **groupID** - the groupID the session belongs too
+* **authorID** - the authorID the session belongs too
+* **validUntil** - the timestamp until this session is valid
+
+### author2sessions:$AUTHORID
+saves the sessions of an author
+
+* **sessionsIDs** - object with sessionIDs in it, values are 1
+
+### group2sessions:$GROUPID
+
+* **sessionsIDs** - object with sessionIDs in it, values are 1
diff --git a/doc/documentation.md b/doc/documentation.md
new file mode 100644
index 000000000..0542c4360
--- /dev/null
+++ b/doc/documentation.md
@@ -0,0 +1,15 @@
+# About this Documentation
+
+
+
+The goal of this documentation is to comprehensively explain Etherpad-Lite,
+both from a reference as well as a conceptual point of view.
+
+Where appropriate, property types, method arguments, and the arguments
+provided to event handlers are detailed in a list underneath the topic
+heading.
+
+Every `.html` file is generated based on the corresponding
+`.markdown` file in the `doc/api/` folder in the source tree. The
+documentation is generated using the `tools/doc/generate.js` program.
+The HTML template is located at `doc/template.html`.
\ No newline at end of file
diff --git a/doc/easysync/README.md b/doc/easysync/README.md
new file mode 100644
index 000000000..551487544
--- /dev/null
+++ b/doc/easysync/README.md
@@ -0,0 +1,2 @@
+# About this folder
+We put all documentations we found about the old Etherpad together in this folder. Most of this is still valid for Etherpad Lite
\ No newline at end of file
diff --git a/doc/easysync/easysync-full-description.pdf b/doc/easysync/easysync-full-description.pdf
new file mode 100644
index 000000000..170b6ccd4
Binary files /dev/null and b/doc/easysync/easysync-full-description.pdf differ
diff --git a/doc/easysync/easysync-full-description.tex b/doc/easysync/easysync-full-description.tex
new file mode 100644
index 000000000..a831da647
--- /dev/null
+++ b/doc/easysync/easysync-full-description.tex
@@ -0,0 +1,372 @@
+\documentclass{article}
+\usepackage{hyperref}
+
+\begin{document}
+
+\title{Etherpad and EasySync Technical Manual}
+\author{AppJet, Inc., with modifications by the Etherpad Foundation}
+\date{\today}
+
+\maketitle
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\tableofcontents
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Documents}
+\begin{itemize}
+\item A document is a list of characters, or a string.
+\item A document can also be represented as a list of \emph{changesets}.
+\end{itemize}
+
+\section{Changesets}
+
+\begin{itemize}
+\item A changeset represents a change to a document.
+\item A changeset can be applied to a document to produce a new document.
+\item When a document is represented as a list of changesets, it is assumed that the first changeset applies to the empty document, [].
+\end{itemize}
+
+
+\section{Changeset representation} \label{representation}
+
+$$(\ell \rightarrow \ell')[c_1,c_2,c_3,...]$$
+
+where
+
+\begin{itemize}
+\item[] $\ell$ is the length of the document before the change,
+\item[] $\ell'$ is the length of the document after the change,
+\item[] $[c_1,c_2,c_3,...]$ is an array of $\ell'$ characters that described the document after the change.
+\end{itemize}
+
+Note that $\forall c_i : 0 \leq i \leq \ell'$ is either an integer or a character.
+
+\begin{itemize}
+\item Integers represent retained characters in the original document.
+\item Characters represent insertions.
+\end{itemize}
+
+\section{Constraints on Changesets}
+
+\begin{itemize}
+\item Changesets are canonical and therefor comparable. When represented in computer memory, we always use the same representation for the same changeset. If the memory representation of two changesets differ, they must be different changesets.
+\item Changesets are compact. Thus, if there are two ways to represent a changeset in computer memory, then we always use the representation that takes up the fewest bytes.
+\end{itemize}
+
+Later we will discuss optimizations to changeset
+representation (using ``strips'' and other such
+techniques). The two constraints must apply to any
+representation of changesets.
+
+\section{Notation}
+
+\begin{itemize}
+\item We use the algebraic multiplication notation to represent changeset application.
+\item While changesets are defined as operations on documents, documents themselves are represented as a list of changesets, initially applying to the empty document.
+\end{itemize}
+
+\paragraph{Example}
+$A=(0\rightarrow 5)[``hello"]$
+$B=(5\rightarrow 11)[0-4, ``\ world"]$
+
+We can write the document ``hello world'' as $A\cdot B$ or
+just $AB$. Note that the ``initial document'' can be made
+into the changeset $(0\rightarrow
+N)[``<\mathit{the\ document\ text}>"]$.
+
+When $A$ and $B$ are changesets, we can also refer to $(AB)$ as ``the composition'' of $A$ and $B$. Changesets are closed under composition.
+
+\section{Composition of Changesets}
+
+For any two changesets $A$, $B$ such that
+
+\begin{itemize}
+\item[] $A=(n_1\rightarrow n_2)[\cdots]$
+\item[] $A=(n_2\rightarrow n_3)[\cdots]$
+\end{itemize}
+it is clear that there is a third changeset $C=(n_1\rightarrow n_3)[\cdots]$ such that applying $C$ to a document $X$ yeilds the same resulting document as does applying $A$ and then $B$. In this case, we write $AB=C$.
+
+Given the representation from Section \ref{representation}, it is straightforward to compute the composition of two changesets.
+
+\section{Changeset Merging}
+
+Now we come to realtime document editing. Suppose two different users make two different changes to the same document at the same time. It is impossible to compose these changes. For example, if we have the document $X$ of length $n$, we may have $A=(n\rightarrow n_a)[\ldots n_a \mathrm{characters}]$, $B=(n\rightarrow n_b)[\ldots n_b \mathrm{characters}]$ where $n\neq n_a\neq n_b$.
+
+It is impossible to compute $(XA)B$ because $B$ can only be applied to a document of length $n$, and $(XA)$ has length $n_a$. Similarly, $A$ cannot be appliet to $(XB)$ because $(XB)$ has length $n_b$.
+
+This is where \emph{merging} comes in. Merging takes two changesets that apply to the same initial document (and that cannot be composed), and computes a single new changeset that presevers the intent of both changes. The merge of $A$ and $B$ is written as $m(A,B)$. For the Etherpad system to work, we require that $m(A,B)=m(B,A)$.
+
+Aside from what we have said so far about merging, there aremany different implementations that will lead to a workable system. We have created one implementation for text that has the following constraints.
+
+\section{Follows} \label{follows}
+
+When users $A$ and $B$ have the same document $X$ on their screen, and they proceed to make respective changesets $A$ and $B$, it is no use to compute $m(A,B)$, because $m(A,B)$ applies to document $X$, but the users are already looking at document $XA$ and $XB$. What we really want is to compute $B'$ and $A'$ such that
+$$XAB' = XBA' = Xm(A,B)$$
+
+``Following'' computes these $B'$ and $A'$ changesets. The definition of the ``follow'' function $f$ is such that $Af(A,B)=Bf(B,A)=m(A,B)=m(B,A)$. When we computer $f(A,B)$.
+\begin{itemize}
+\item Insertions in $A$ become retained characters in $f(A,B)$
+\item Insertions in $B$ become insertions in $f(A,B)$
+\item Retain whatever characters are retained in \emph{both} $A$ and $B$
+\end{itemize}
+
+\paragraph{Example}
+
+Suppose we have the initial document $X=(0\rightarrow 8)[``\mathit{baseball}"]$ and user $A$ changes it to ``basil'' with changeset $A$, and user $B$ changes it to ``below'' with changeset $B$.
+
+We have
+$X=(0\rightarrow 8)[``\mathit{baseball}"]$ \\
+$A=(8\rightarrow 5)[0-1, ``\mathit{si}", 7]$ \\
+$B=(8\rightarrow 5)[0, ``\mathit{e}", 6, ``\mathit{ow}"]$ \\
+
+First we compute the merge $m(A,B)=m(B,A)$ according to the constraints
+
+$$m(A,B)=(8\rightarrow 6)[0, "e", "si", "ow"] = (8\rightarrow 6)[0, ``\mathit{esiow}"]$$
+
+Then we need to compute the follows $B'=f(A,B)$ and $A'=f(B,A)$.
+
+$$B'=f(A,B)=(5\rightarrow 6)[0,``\mathit{e}",2,3,``\mathit{ow}"]$$
+
+Note that the numbers $0$, $2$, and $3$ are indices into $A=(8\rightarrow 5)[0,1,``\mathit{si}",7]$
+
+\begin{tabular}{ccccc}
+0 & 1 & 2 & 3 & 4 \\
+0 & 1 & s & i & 7
+\end{tabular}
+
+$A'=f(B,A)=(5\rightarrow 6)[0,1,"si",3,4]$
+
+We can now double check that $AB'=BA'=m(A,B)=(8\rightarrow 6)[0,``\mathit{esiow}"]$.
+
+Now that we have made the mathematical meaning of the
+preceding pages complete, we can build a client/server
+system to support realtime editing by multiple users.
+
+\section{System Overview}
+
+There is a server that holds the current state of a
+document. Clients (users) can connect to the server from
+their web browsers. The clients and server maintain state
+and can send messages to one another in real-time, but
+because we are in a web browser scenario, clients cannot
+send each other messages directly, and must go through the
+server always. (This may distinguish from prior art?)
+
+The other critical design feature of the system is that
+\emph{A client must always be able to edit their local
+ copy of the document, so the user is never blocked from
+ typing because of waiting to to send or receive data.}
+
+\section{Client State}
+
+At any moment in time, a client maintains its state in the
+form of 3 changesets. The client document looks like
+$A\cdot X \cdot Y$, where
+
+$A$ is the latest server version, the composition of all
+changesets committed to the server, from this client or
+from others, that the server has informed this client
+about. Initially $A=(0\rightarrow N)[<\mathit{initial\ document\ text}>]$.
+
+$X$ is the composition of all changesets this client has
+submitted to the server but has not heard back about yet.
+Initially $X=(N\rightarrow N)[0,1,2,\ldots, N-1]$, in
+other words, the identity, henceforth denoted $I_N$.
+
+$Y$ is the composition of all changesets this client has
+made but has not yet submitted to the server yet.
+Initially $Y=(N\rightarrow N)[0,1,2,\ldots, N-1]$.
+
+\section{Client Operations}
+
+A client can do 5 things.
+
+\begin{enumerate}
+\item Incorporate new typing into local state
+\item Submit a changeset to the server
+\item Hear back acknowledgement of a submitted changeset
+\item Hear from the server about other clients' changesets
+\item Connect to the server and request the initial document
+\end{enumerate}
+
+As these 5 events happen, the client updates its
+representation $A\cdot X \cdot Y$ according to the
+relations that follow. Changes ``move left'' as time goes
+by: into $Y$ when the user types, into $X$ when change
+sets are submitted to the server, and into $A$ when the
+server acknowledges changesets.
+
+\subsection{New local typing}
+
+When a user makes an edit $E$ to the document, the client
+computes the composition $(Y\cdot E)$ and updates its local
+state, i.e. $Y \leftarrow Y\cdot E$. I.e., if $Y$ is the
+variable holding local unsubmitted changes, it will be
+assigned the new value $(Y\cdot E)$.
+
+\subsection{Submitting changesets to server}
+
+When a client submit its local changes to the server, it
+transmits a copy of $Y$ and then assigns $Y$ to $X$, and
+assigns the identity to $Y$. I.e.,
+
+\begin{enumerate}
+\item Send $Y$ to server,
+\item $X \leftarrow Y$
+\item $Y \leftarrow I_N$
+ (the identity).
+\end{enumerate}
+
+This happens every 500ms as long as it receives an
+acknowledgement. Must receive ACK before submitting
+again. Note that $X$ is always equal to the identity
+before the second step occurs, so no information is lost.
+
+\subsection{Hear ACK from server}
+
+When the client hears ACK from server,
+
+$A \leftarrow A\cdot X$ \\
+$X \leftarrow I_N$
+
+\subsection{Hear about another client's changeset}
+
+When a client hears about another client's changeset $B$,
+it computes a new $A$, $X$, and $Y$, which we will call
+$A'$, $X'$, and $Y'$ respectively. It also computes a
+changeset $D$ which is applied to the current text view on
+the client, $V$. Because $AXY$ must always equal the
+current view, $AXY=V$ before the client hears about $B$,
+and $A'X'Y'=VD$ after the computation is performed.
+
+The steps are:
+
+\begin{enumerate}
+\item Compute $A' = AB$
+\item Compute $X' = f(B,X)$
+\item Compute $Y' = f(f(X,B), Y)$
+\item Compute $D=f(Y,f(X,B))$
+\item Assign $A \leftarrow A'$, $X \leftarrow X'$, $Y \leftarrow Y'$.
+\item Apply $D$ to the current view of the document
+ displayed on the user's screen.
+\end{enumerate}
+
+In steps 2,3, and 4, $f$ is the follow operation described
+in Section \ref{follows}.
+
+\paragraph{Proof that $\mathbf{AXY=V \Rightarrow A'X'Y'=VD}$.}
+Substituting $A'X'Y'=(AB)(f(B,X))(f(f(X,B),Y))$, we
+recall that merges are commutative. So for any two
+changesets $P$ and $Q$,
+$$m(P,Q)=m(Q,P)=Qf(Q,P)=Pf(P,Q)$$
+
+Applying this to the relation above, we see
+\begin{eqnarray*}
+A'X'Y'&=& AB f(B,X) f(f(X,B),Y) \\
+ &=&AX f(X,B) f(f(X,B),Y) \\
+ &=&A X Y f(Y, f(X,B)) \\
+ &=&A X Y D \\
+ &=&V D
+\end{eqnarray*}
+As claimed.
+
+\subsection{Connect to server}
+
+When a client connects to the server for the first time,
+it first generates a random unique ID and sends this to
+the server. The client remembers this ID and sends it
+with each changeset to the server.
+
+The client receives the latest version of the document
+from the server, called HEADTEXT. The client then sets
+
+\begin{itemize}
+\item[] $A \leftarrow \mathrm{HEADTEXT}$
+\item[] $X \leftarrow I_N$
+\item[] $Y \leftarrow I_N$
+\end{itemize}
+
+And finally, the client displays HEADTEXT on the screen.
+
+\section{Server Overview}
+
+Like the client(s), the server has state and performs
+operations. Operations are only performed in response to
+messages from clients.
+
+\section{Server State}
+
+The server maintains a document as an ordered list of
+\emph{revision records}. A revision record is a data
+structure that contains a changeset and authorship
+information.
+
+\begin{verbatim}
+RevisionRecord = {
+ ChangeSet,
+ Source (unique ID),
+ Revision Number (consecutive order, starting at 0)
+}
+\end{verbatim}
+
+For efficiency, the server may also store a variable
+called HEADTEXT, which is the composition of all
+changesets in the list of revision records. This is an
+optimization, because clearly this can be computed from
+the set of revision records.
+
+\section{Server Operations Overview}
+
+The server does two things in addition to maintaining
+state representing the set of connected clients and
+remembering what revision number each client is up to date
+with:
+
+\begin{enumerate}
+\item Respond to a client's connection requesting the initial document.
+\item Respond to a client's submission of a new changeset.
+\end{enumerate}
+
+\subsection{Respond to client connect}
+When a server recieves a connection request from a client,
+it receives the client's unique ID and stores that in the
+server's set of connected clients. It then sends the
+client the contents of HEADTEXT, and the corresponding
+revision number. Finally the server notes that this
+client is up to date with that revision number.
+
+\subsection{Respond to client changeset}
+
+When the server receives information from a client about
+the client's changeset $C$, it does five things:
+
+\begin{enumerate}
+\item Notes that this change applies to revision number
+ $r_c$ (the client's latest revision).
+\item Creates a new changeset $C'$ that is relative to the
+ server's most recent revision number, which we call
+ $r_H$ ($H$ for HEAD). $C'$ can be computed using
+ follows (Section \ref{follows}). Remember that the server has a series of
+ changesets,
+$$S_0\rightarrow S_1\rightarrow \ldots S_{r_c}\rightarrow S_{r_c+1} \rightarrow \ldots \rightarrow S_{r_H} $$
+$C$ is relative to $S_{r_c}$, but we need to compute $C'$ relative to $S_{r_H}$.
+We can compute a new $C$ relative to $S_{r_c+1}$ by computing $f(S_{r_c+1},C)$. Similarly we can repeat for
+$S_{r_c+2}$ and so forth until we have $C'$ represented relative to $S_{r_H}$.
+\item Send $C'$ to all other clients
+\item Send ACK back to original client
+\item Add $C'$ to the server's list of revision records by creating a new revision record out of this and the client's ID.
+
+\appendix
+
+\section*{Additional topics}
+\begin{enumerate}
+\item Optimizations (strips, more caching, etc.)
+\item Pseudocode for composition, merge, and follow
+\item How authorship information is used to color-code the document based on who typed what
+\item How persistent connections are maintained between client and server
+\end{enumerate}
+\end{enumerate}
+
+
+\end{document}
diff --git a/doc/easysync/easysync-notes.pdf b/doc/easysync/easysync-notes.pdf
new file mode 100644
index 000000000..d0af379d1
Binary files /dev/null and b/doc/easysync/easysync-notes.pdf differ
diff --git a/doc/easysync/easysync-notes.tex b/doc/easysync/easysync-notes.tex
new file mode 100644
index 000000000..b2c432073
--- /dev/null
+++ b/doc/easysync/easysync-notes.tex
@@ -0,0 +1,200 @@
+\documentclass[12pt]{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[USenglish]{babel}
+
+
+\begin{document}
+
+\title{Easysync Protocol}
+\author{AppJet, Inc., with modifications by the Etherpad Foundation}
+\date{\today}
+
+\maketitle
+
+\section{Attributes}
+
+An ``attribute'' is a (key,value) pair such as
+\verb|(author,abc123)| or \verb|(bold,true)|.
+Sometimes an attribute is treated as an instruction to add
+that attribute, in which case an empty value means to
+remove it. So \verb|(bold,)| removes the ``bold''
+attribute. Attributes are interned and given numeric IDs,
+so the number ``\verb|6|'' could represent
+``\verb|(bold,true)|'', for example. This mapping is
+stored in an attribute pool which may be shared by
+multiple changesets.
+
+Entries in the pool must be unique, so that attributes can
+be compared by their IDs. Attribute names cannot contain
+commas.
+
+A changeset looks something like the following:
+
+\begin{verbatim}
+Z:5g>1|5=2p=v*4*5+1$x
+\end{verbatim}
+
+With the corresponding pool containing these entries (among others):
+
+\begin{itemize}
+\item[] \verb|4| $\rightarrow$ \verb|(author,1059348573)|
+\item[] \verb|5| $\rightarrow$ \verb|(bold,true)|
+\end{itemize}
+
+This changeset, together with the attribute pool,
+represents inserting a bold letter ``x'' into the middle
+of a line.
+
+The string consists of:
+
+\begin{itemize}
+\item a letter \verb|Z| (the ``magic character'' and
+ format version identifier)
+\item a series punctuation marks (operation codes or
+ ``opcodes'' for short), together with alphanumerics
+ (numeric values in base 36).
+\item a dollar sign (\verb|$|)
+\item a string of characters used for insertion operations
+ (the ``char bank'')
+\end{itemize}
+
+In the example above, if we separate out the operations
+and convert the numbers to base 10, then we get:
+\begin{verbatim}
+Z :196 >1 |5=97 =31 *4 *5 +1 $x
+\end{verbatim}
+Here are descriptions of the operations, where capital
+letters are variables:
+
+\begin{description}
+\item{{\bf :N}} \quad \\
+Source text has length $N$ (must be first op)
+\item{{\bf >N}} \quad \\
+Final text is $N$ (positive) characters longer than source
+text (must be second op)
+\item{{\bf 0 }} \quad \\
+Final text is same length as source text
+\item{{\bf +N }} \quad \\
+Insert $N$ characters from the bank, none of them newlines
+\item{{\bf -N}} \quad \\
+Skip over (delete) $N$ characters from the source text,
+none of them newlines
+\item{{\bf =N}} \quad \\
+Keep $N$ characters from the source text, none of them newlines
+\item{{\bf |L+N}} \quad \\
+Insert $N$ characters from the source text, containing $L$
+newlines. The last character inserted MUST be a newline,
+but not the (new) document's final newline.
+\item{{\bf |L-N}} \quad \\
+Delete $N$ characters from the source text, containing $L$
+newlines. The last character inserted MUST be a newline,
+but not the (old) document's final newline.
+\item{{\bf |L=N}} \quad \\
+Keep $N$ characters from the source text, containing L
+newlines. The last character kept MUST be a newline, and
+the final newline of the document is allowed.
+\item{{\bf *I}} \quad \\
+Apply attribute $I$ from the pool to the following
+\verb|+|, \verb|=|, \verb_|+_, or \verb_|=_ command. In
+other words, any number of \verb|*| ops can come before a
+\verb_+_, \verb_=_, or \verb_|_ but not between a \verb_|_
+and the corresponding \verb_+_ or \verb_=_. If \verb_+_,
+text is inserted having this attribute. If \verb_=_, 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 (\verb_+_), the pair should just be omitted.
+\end{description}
+
+Characters from the source text that aren't accounted for
+are assumed to be kept with the same attributes.
+
+\paragraph{Additional Constraints}
+
+\begin{itemize}
+\item Consecutive \verb_+_, \verb_-_, and \verb_=_ ops of
+ the same type that could be combined are not allowed.
+ Whether combination is possible depends on the
+ attributes of the ops and whether each is multiline or
+ not. For example, two multiline deletions can never be
+ consecutive, nor can any insertion come after a
+ non-multiline insertion with the same attributes.
+\item ``No-op'' ops are not allowed, such as deleting 0
+ characters. However, attribute applications that don't
+ have any effect are allowed.
+\item Characters at the end of the source text cannot be
+ explicitly kept with no changes; if the change doesn't
+ affect the last $N$ characters, those ``keep'' ops must
+ be left off.
+\item In any consecutive sequence of insertions (\verb_+_)
+ and deletions (\verb_-_) with no keeps (\verb_=_), the
+ deletions must come before the insertions.
+\item The document text before and after will always end
+ with a newline. This policy avoids a lot of
+ special-casing of the end of the document. If a final
+ newline is always added when importing text and removed
+ when exporting text, then the changeset representation
+ can be used to process text files that may or may not
+ have a final newline.
+\end{itemize}
+
+\paragraph{Attribution string}
+
+An \emph{attribution string} is a series of inserts with
+no deletions or keeps. For example, ``\verb_*3+8|1+5_''
+describes the attributes of a string of length 13, where
+the first 8 chars have attribute 3 and the next 5 chars
+have no attributes, with the last of these 5 chars being a
+newline. Constraints apply similar to those affecting
+changesets, but the restriction about the final newline of
+the new document being added doesn't apply.
+
+Attributes in an attribution string cannot be empty, like
+``\verb|(bold,)|'', they should instead be absent.
+
+
+\section{Further Considerations}
+
+\begin{itemize}
+\item composing changesets/attributions with different
+ pools.
+\item generalizing ``applyToAttribution'' to make
+ ``mutateAttributionLines'' and ``compose''
+\end{itemize}
+
+\section{Using Unicode?}
+
+\begin{itemize}
+\item no unicode (for efficient escaping, sightliness)
+\item efficient operations for ACE and collab (attributed text, etc.)
+\item good for time-slider
+\item good for API
+\item line-ending aware
+X more coherent (deleting or styling text merging with insertion)
+\item server-side syntax highlighting?
+\item unify author map with attribute pool
+\item unify attributed text with changeset rep
+\item not: reversible
+\item force final newline of document to be preserved
+\end{itemize}
+
+\paragraph{Unicode bad!}
+
+\begin{itemize}
+\item ugly (hard to read)
+\item more complex to parse
+\item harder to store and transmit correctly
+\item doesn't save all that much space anyway
+\item blows up in size when string-escaped
+\item embarrassing for API
+\end{itemize}
+
+
+\end{document}
diff --git a/doc/easysync/easysync-notes.txt b/doc/easysync/easysync-notes.txt
new file mode 100644
index 000000000..d3b3dc558
--- /dev/null
+++ b/doc/easysync/easysync-notes.txt
@@ -0,0 +1,133 @@
+
+
+Copied from the old Etherpad. Found in /infrastructure/ace/
+
+Goals:
+
+- no unicode (for efficient escaping, sightliness)
+- efficient operations for ACE and collab (attributed text, etc.)
+- good for time-slider
+- good for API
+- line-ending aware
+X more coherent (deleting or styling text merging with insertion)
+- server-side syntax highlighting?
+- unify author map with attribute pool
+- unify attributed text with changeset rep
+- not: reversible
+- force final newline of document to be preserved
+
+- Unicode bad:
+ - ugly (hard to read)
+ - more complex to parse
+ - harder to store and transmit correctly
+ - doesn't save all that much space anyway
+ - blows up in size when string-escaped
+ - embarrassing for API
+
+
+# Attributes:
+
+An "attribute" is a (key,value) pair such as (author,abc123456) or
+(bold,true). Sometimes an attribute is treated as an instruction to
+add that attribute, in which case an empty value means to remove it.
+So (bold,) removes the "bold" attribute. Attributes are interned and
+given numeric IDs, so the number "6" could represent "(bold,true)",
+for example. This mapping is stored in an attribute "pool" which may
+be shared by multiple changesets.
+
+Entries in the pool must be unique, so that attributes can be compared
+by their IDs. Attribute names cannot contain commas.
+
+A changeset looks something like the following:
+
+Z:5g>1|5=2p=v*4*5+1$x
+
+With the corresponding pool containing these entries:
+
+...
+4 -> (author,1059348573)
+5 -> (bold,true)
+...
+
+This changeset, together with the pool, represents inserting
+a bold letter "x" into the middle of a line. The string consists of:
+
+- a letter Z (the "magic character" and format version identifier)
+- a series of opcodes (punctuation) and numeric values in base 36 (the
+ alphanumerics)
+- a dollar sign ($)
+- a string of characters used by insertion operations (the "char bank")
+
+If we separate out the operations and convert the numbers to base 10, we get:
+
+Z :196 >1 |5=97 =31 *4 *5 +1 $"x"
+
+Here are descriptions of the operations, where capital letters are variables:
+
+":N" : Source text has length N (must be first op)
+">N" : Final text is N (positive) characters longer than source text (must be second op)
+"0" : Final text is same length as source text
+"+N" : Insert N characters from the bank, none of them newlines
+"-N" : Skip over (delete) N characters from the source text, none of them newlines
+"=N" : Keep N characters from the source text, none of them newlines
+"|L+N" : Insert N characters from the source text, containing L newlines. The last
+ character inserted MUST be a newline, but not the (new) document's final newline.
+"|L-N" : Delete N characters from the source text, containing L newlines. The last
+ character inserted MUST be a newline, but not the (old) document's final newline.
+"|L=N" : Keep N characters from the source text, containing L newlines. The last character
+ 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 =.
+ 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.
+
+Characters from the source text that aren't accounted for are assumed to be kept
+with the same attributes.
+
+Additional Constraints:
+
+- Consecutive +, -, and = ops of the same type that could be combined are not allowed.
+ Whether combination is possible depends on the attributes of the ops and whether
+ each is multiline or not. For example, two multiline deletions can never be
+ consecutive, nor can any insertion come after a non-multiline insertion with the
+ same attributes.
+- "No-op" ops are not allowed, such as deleting 0 characters. However, attribute
+ applications that don't have any effect are allowed.
+- Characters at the end of the source text cannot be explicitly kept with no changes;
+ if the change doesn't affect the last N characters, those "keep" ops must be left off.
+- In any consecutive sequence of insertions (+) and deletions (-) with no keeps (=),
+ the deletions must come before the insertions.
+- The document text before and after will always end with a newline. This policy avoids
+ a lot of special-casing of the end of the document. If a final newline is
+ always added when importing text and removed when exporting text, then the
+ changeset representation can be used to process text files that may or may not
+ have a final newline.
+
+Attribution string:
+
+An "attribution string" is a series of inserts with no deletions or keeps.
+For example, "*3+8|1+5" describes the attributes of a string of length 13,
+where the first 8 chars have attribute 3 and the next 5 chars have no
+attributes, with the last of these 5 chars being a newline. Constraints
+apply similar to those affecting changesets, but the restriction about
+the final newline of the new document being added doesn't apply.
+
+Attributes in an attribution string cannot be empty, like "(bold,)", they should
+instead be absent.
+
+
+
+
+
+-------
+Considerations:
+
+- composing changesets/attributions with different pools
+- generalizing "applyToAttribution" to make "mutateAttributionLines" and "compose"
diff --git a/doc/template.html b/doc/template.html
new file mode 100644
index 000000000..2eb939872
--- /dev/null
+++ b/doc/template.html
@@ -0,0 +1,23 @@
+
+
+
+
+ __SECTION__ Etherpad-Lite Manual & Documentation
+
+
+
+
+
Etherpad-Lite Manual & Documentation
+
+
+
+
Table of Contents
+ __TOC__
+
+
+
+ __CONTENT__
+
+
+
+
diff --git a/settings.json.template b/settings.json.template
new file mode 100644
index 000000000..7d175a34e
--- /dev/null
+++ b/settings.json.template
@@ -0,0 +1,74 @@
+/*
+ This file must be valid JSON. But comments are allowed
+
+ Please edit settings.json, not settings.json.template
+*/
+{
+ //Ip and port which etherpad should bind at
+ "ip": "0.0.0.0",
+ "port" : 9001,
+
+ //The Type of the database. You can choose between dirty, postgres, sqlite and mysql
+ //You shouldn't use "dirty" for for anything else than testing or development
+ "dbType" : "dirty",
+ //the database specific settings
+ "dbSettings" : {
+ "filename" : "var/dirty.db"
+ },
+
+ /* An Example of MySQL Configuration
+ "dbType" : "mysql",
+ "dbSettings" : {
+ "user" : "root",
+ "host" : "localhost",
+ "password": "",
+ "database": "store"
+ },
+ */
+
+ //the default text of a pad
+ "defaultPadText" : "Welcome to Etherpad Lite!\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\nEtherpad Lite on Github: http:\/\/j.mp/ep-lite\n",
+
+ /* Users must have a session to access pads. This effectively allows only group pads to be accessed. */
+ "requireSession" : false,
+
+ /* Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads. */
+ "editOnly" : false,
+
+ /* if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
+ but makes it impossible to debug the javascript/css */
+ "minify" : true,
+
+ /* How long may clients use served javascript code (in seconds)? Without versioning this
+ may cause problems during deployment. Set to 0 to disable caching */
+ "maxAge" : 21600, // 60 * 60 * 6 = 6 hours
+
+ /* This is the path to the Abiword executable. Setting it to null, disables abiword.
+ Abiword is needed to enable the import/export of pads*/
+ "abiword" : null,
+
+ /* This setting is used if you require authentication of all users.
+ Note: /admin always requires authentication. */
+ "requireAuthentication": false,
+
+ /* Require authorization by a module, or a user with is_admin set, see below. */
+ "requireAuthorization": false,
+
+ /* Users for basic authentication. is_admin = true gives access to /admin.
+ If you do not uncomment this, /admin will not be available! */
+ /*
+ "users": {
+ "admin": {
+ "password": "changeme1",
+ "is_admin": true
+ },
+ "user": {
+ "password": "changeme1",
+ "is_admin": false
+ }
+ },
+ */
+
+ /* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
+ "loglevel": "INFO"
+}
diff --git a/src/ep.json b/src/ep.json
new file mode 100644
index 000000000..ce6d3a00f
--- /dev/null
+++ b/src/ep.json
@@ -0,0 +1,20 @@
+{
+ "parts": [
+ { "name": "express", "hooks": {
+ "createServer": "ep_etherpad-lite/node/hooks/express:createServer",
+ "restartServer": "ep_etherpad-lite/node/hooks/express:restartServer"
+ } },
+ { "name": "static", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/static:expressCreateServer" } },
+ { "name": "specialpages", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/specialpages:expressCreateServer" } },
+ { "name": "padurlsanitize", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/padurlsanitize:expressCreateServer" } },
+ { "name": "padreadonly", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/padreadonly:expressCreateServer" } },
+ { "name": "webaccess", "hooks": { "expressConfigure": "ep_etherpad-lite/node/hooks/express/webaccess:expressConfigure" } },
+ { "name": "apicalls", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/apicalls:expressCreateServer" } },
+ { "name": "importexport", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/importexport:expressCreateServer" } },
+ { "name": "errorhandling", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/errorhandling:expressCreateServer" } },
+ { "name": "socketio", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/socketio:expressCreateServer" } },
+ { "name": "adminplugins", "hooks": {
+ "expressCreateServer": "ep_etherpad-lite/node/hooks/express/adminplugins:expressCreateServer",
+ "socketio": "ep_etherpad-lite/node/hooks/express/adminplugins:socketio" } }
+ ]
+}
diff --git a/src/node/README.md b/src/node/README.md
new file mode 100644
index 000000000..4b443289e
--- /dev/null
+++ b/src/node/README.md
@@ -0,0 +1,13 @@
+# About the folder structure
+
+* **db** - all modules that are accesing the data structure and are communicating directly to the database
+* **handler** - all modules that responds directly to requests/messages of the browser
+* **utils** - helper modules
+
+# Module name conventions
+
+Module file names start with a capital letter and uses camelCase
+
+# Where does it start?
+
+server.js is started directly
diff --git a/src/node/db/API.js b/src/node/db/API.js
new file mode 100644
index 000000000..c5caae0be
--- /dev/null
+++ b/src/node/db/API.js
@@ -0,0 +1,605 @@
+/**
+ * This module provides all API functions
+ */
+
+/*
+ * 2011 Peter 'Pita' Martischka (Primary Technology Ltd)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS-IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var ERR = require("async-stacktrace");
+var customError = require("../utils/customError");
+var padManager = require("./PadManager");
+var padMessageHandler = require("../handler/PadMessageHandler");
+var readOnlyManager = require("./ReadOnlyManager");
+var groupManager = require("./GroupManager");
+var authorManager = require("./AuthorManager");
+var sessionManager = require("./SessionManager");
+var async = require("async");
+var exportHtml = require("../utils/ExportHtml");
+var importHtml = require("../utils/ImportHtml");
+var cleanText = require("./Pad").cleanText;
+
+/**********************/
+/**GROUP FUNCTIONS*****/
+/**********************/
+
+exports.createGroup = groupManager.createGroup;
+exports.createGroupIfNotExistsFor = groupManager.createGroupIfNotExistsFor;
+exports.deleteGroup = groupManager.deleteGroup;
+exports.listPads = groupManager.listPads;
+exports.createGroupPad = groupManager.createGroupPad;
+
+/**********************/
+/**AUTHOR FUNCTIONS****/
+/**********************/
+
+exports.createAuthor = authorManager.createAuthor;
+exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor;
+exports.getAuthorName = authorManager.getAuthorName;
+exports.listPadsOfAuthor = authorManager.listPadsOfAuthor;
+exports.padUsers = padMessageHandler.padUsers;
+exports.padUsersCount = padMessageHandler.padUsersCount;
+
+/**********************/
+/**SESSION FUNCTIONS***/
+/**********************/
+
+exports.createSession = sessionManager.createSession;
+exports.deleteSession = sessionManager.deleteSession;
+exports.getSessionInfo = sessionManager.getSessionInfo;
+exports.listSessionsOfGroup = sessionManager.listSessionsOfGroup;
+exports.listSessionsOfAuthor = sessionManager.listSessionsOfAuthor;
+
+/************************/
+/**PAD CONTENT FUNCTIONS*/
+/************************/
+
+/**
+getText(padID, [rev]) returns the text of a pad
+
+Example returns:
+
+{code: 0, message:"ok", data: {text:"Welcome Text"}}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.getText = function(padID, rev, callback)
+{
+ //check if rev is set
+ if(typeof rev == "function")
+ {
+ callback = rev;
+ rev = undefined;
+ }
+
+ //check if rev is a number
+ if(rev !== undefined && typeof rev != "number")
+ {
+ //try to parse the number
+ if(!isNaN(parseInt(rev)))
+ {
+ rev = parseInt(rev);
+ }
+ else
+ {
+ callback(new customError("rev is not a number", "apierror"));
+ return;
+ }
+ }
+
+ //ensure this is not a negativ number
+ if(rev !== undefined && rev < 0)
+ {
+ callback(new customError("rev is a negativ number","apierror"));
+ return;
+ }
+
+ //ensure this is not a float value
+ if(rev !== undefined && !is_int(rev))
+ {
+ callback(new customError("rev is a float value","apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ //the client asked for a special revision
+ if(rev !== undefined)
+ {
+ //check if this is a valid revision
+ if(rev > pad.getHeadRevisionNumber())
+ {
+ callback(new customError("rev is higher than the head revision of the pad","apierror"));
+ return;
+ }
+
+ //get the text of this revision
+ pad.getInternalRevisionAText(rev, function(err, atext)
+ {
+ if(ERR(err, callback)) return;
+
+ data = {text: atext.text};
+
+ callback(null, data);
+ })
+ }
+ //the client wants the latest text, lets return it to him
+ else
+ {
+ callback(null, {"text": pad.text()});
+ }
+ });
+}
+
+/**
+setText(padID, text) 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}
+*/
+exports.setText = function(padID, text, 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;
+
+ //set the text
+ pad.setText(text);
+
+ //update the clients on the pad
+ padMessageHandler.updatePadClients(pad, callback);
+ });
+}
+
+/**
+getHTML(padID, [rev]) returns the html of a pad
+
+Example returns:
+
+{code: 0, message:"ok", data: {text:"Welcome Text"}}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.getHTML = function(padID, rev, callback)
+{
+ if(typeof rev == "function")
+ {
+ callback = rev;
+ rev = undefined;
+ }
+
+ if (rev !== undefined && typeof rev != "number")
+ {
+ if (!isNaN(parseInt(rev)))
+ {
+ rev = parseInt(rev);
+ }
+ else
+ {
+ callback(new customError("rev is not a number","apierror"));
+ return;
+ }
+ }
+
+ if(rev !== undefined && rev < 0)
+ {
+ callback(new customError("rev is a negative number","apierror"));
+ return;
+ }
+
+ if(rev !== undefined && !is_int(rev))
+ {
+ callback(new customError("rev is a float value","apierror"));
+ return;
+ }
+
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ //the client asked for a special revision
+ if(rev !== undefined)
+ {
+ //check if this is a valid revision
+ if(rev > pad.getHeadRevisionNumber())
+ {
+ callback(new customError("rev is higher than the head revision of the pad","apierror"));
+ return;
+ }
+
+ //get the html of this revision
+ exportHtml.getPadHTML(pad, rev, function(err, html)
+ {
+ if(ERR(err, callback)) return;
+ data = {html: html};
+ callback(null, data);
+ });
+ }
+ //the client wants the latest text, lets return it to him
+ else
+ {
+ exportHtml.getPadHTML(pad, undefined, function (err, html)
+ {
+ if(ERR(err, callback)) return;
+
+ data = {html: html};
+
+ callback(null, data);
+ });
+ }
+ });
+}
+
+exports.setHTML = function(padID, html, callback)
+{
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ // add a new changeset with the new html to the pad
+ importHtml.setPadHTML(pad, cleanText(html));
+
+ //update the clients on the pad
+ padMessageHandler.updatePadClients(pad, callback);
+
+ });
+}
+
+/*****************/
+/**PAD FUNCTIONS */
+/*****************/
+
+/**
+getRevisionsCount(padID) returns the number of revisions of this pad
+
+Example returns:
+
+{code: 0, message:"ok", data: {revisions: 56}}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.getRevisionsCount = function(padID, callback)
+{
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ callback(null, {revisions: pad.getHeadRevisionNumber()});
+ });
+}
+
+/**
+getLastEdited(padID) returns the timestamp of the last revision of the pad
+
+Example returns:
+
+{code: 0, message:"ok", data: {lastEdited: 1340815946602}}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.getLastEdited = function(padID, callback)
+{
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+ pad.getLastEdit(function(err, value) {
+ if(ERR(err, callback)) return;
+ callback(null, {lastEdited: value});
+ });
+ });
+}
+
+/**
+createPad(padName [, text]) creates a new pad in this group
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"pad does already exist", data: null}
+*/
+exports.createPad = function(padID, text, callback)
+{
+ //ensure there is no $ in the padID
+ if(padID && padID.indexOf("$") != -1)
+ {
+ callback(new customError("createPad can't create group pads","apierror"));
+ return;
+ }
+
+ //create pad
+ getPadSafe(padID, false, text, function(err)
+ {
+ if(ERR(err, callback)) return;
+ callback();
+ });
+}
+
+/**
+deletePad(padID) deletes a pad
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.deletePad = function(padID, callback)
+{
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ pad.remove(callback);
+ });
+}
+
+/**
+getReadOnlyLink(padID) returns the read only link of a pad
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.getReadOnlyID = function(padID, callback)
+{
+ //we don't need the pad object, but this function does all the security stuff for us
+ getPadSafe(padID, true, function(err)
+ {
+ if(ERR(err, callback)) return;
+
+ //get the readonlyId
+ readOnlyManager.getReadOnlyId(padID, function(err, readOnlyId)
+ {
+ if(ERR(err, callback)) return;
+ callback(null, {readOnlyID: readOnlyId});
+ });
+ });
+}
+
+/**
+setPublicStatus(padID, publicStatus) sets a boolean for the public status of a pad
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.setPublicStatus = function(padID, publicStatus, callback)
+{
+ //ensure this is a group pad
+ if(padID && padID.indexOf("$") == -1)
+ {
+ callback(new customError("You can only get/set the publicStatus of pads that belong to a group","apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ //convert string to boolean
+ if(typeof publicStatus == "string")
+ publicStatus = publicStatus == "true" ? true : false;
+
+ //set the password
+ pad.setPublicStatus(publicStatus);
+
+ callback();
+ });
+}
+
+/**
+getPublicStatus(padID) return true of false
+
+Example returns:
+
+{code: 0, message:"ok", data: {publicStatus: true}}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.getPublicStatus = function(padID, callback)
+{
+ //ensure this is a group pad
+ if(padID && padID.indexOf("$") == -1)
+ {
+ callback(new customError("You can only get/set the publicStatus of pads that belong to a group","apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ callback(null, {publicStatus: pad.getPublicStatus()});
+ });
+}
+
+/**
+setPassword(padID, password) returns ok or a error message
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.setPassword = function(padID, password, callback)
+{
+ //ensure this is a group pad
+ if(padID && padID.indexOf("$") == -1)
+ {
+ callback(new customError("You can only get/set the password of pads that belong to a group","apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ //set the password
+ pad.setPassword(password == "" ? null : password);
+
+ callback();
+ });
+}
+
+/**
+isPasswordProtected(padID) returns true or false
+
+Example returns:
+
+{code: 0, message:"ok", data: {passwordProtection: true}}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.isPasswordProtected = function(padID, callback)
+{
+ //ensure this is a group pad
+ if(padID && padID.indexOf("$") == -1)
+ {
+ callback(new customError("You can only get/set the password of pads that belong to a group","apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ callback(null, {isPasswordProtected: pad.isPasswordProtected()});
+ });
+}
+
+/**
+listAuthorsOfPad(padID) returns an array of authors who contributed to this pad
+
+Example returns:
+
+{code: 0, message:"ok", data: {authorIDs : ["a.s8oes9dhwrvt0zif", "a.akf8finncvomlqva"]}
+{code: 1, message:"padID does not exist", data: null}
+*/
+exports.listAuthorsOfPad = function(padID, callback)
+{
+ //get the pad
+ getPadSafe(padID, true, function(err, pad)
+ {
+ if(ERR(err, callback)) return;
+
+ callback(null, {authorIDs: pad.getAllAuthors()});
+ });
+}
+
+/**
+sendClientsMessage(padID, msg) sends a message to all clients connected to the
+pad, possibly for the purpose of signalling a plugin.
+
+Note, this will only accept strings from the HTTP API, so sending bogus changes
+or chat messages will probably not be possible.
+
+The resulting message will be structured like so:
+
+{
+ type: 'COLLABROOM',
+ data: {
+ type: ,
+ time: