mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Documentation
This commit is contained in:
parent
88297a99ef
commit
f7b46f6e69
22 changed files with 368 additions and 447 deletions
|
@ -1,4 +1,12 @@
|
|||
/**
|
||||
* This code represents the Attribute Pool Object of the original Etherpad.
|
||||
* 90% of the code is still like in the original Etherpad
|
||||
* Look at https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2.js
|
||||
* You can find a explanation what a attribute pool is here:
|
||||
* https://github.com/Pita/etherpad-lite/blob/master/doc/easysync/easysync-notes.txt
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* The AuthorManager controlls all information about the Pad authors
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -14,18 +18,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The AuthorManager controlls all information about the Pad authors
|
||||
*/
|
||||
|
||||
var db = require("./db").db;
|
||||
var async = require("async");
|
||||
|
||||
/**
|
||||
* Returns the Author Id for a token. If the token is unkown,
|
||||
* it creates a author for the token
|
||||
* @param token The token
|
||||
* @param token {String} The token
|
||||
* @param callback {Function} callback (err, author)
|
||||
* The callback function that is called when the result is here
|
||||
*/
|
||||
exports.getAuthor4Token = function (token, callback)
|
||||
{
|
||||
|
@ -73,6 +74,8 @@ exports.getAuthor4Token = function (token, callback)
|
|||
|
||||
/**
|
||||
* Returns the color Id of the author
|
||||
* @param author {String} The id of the author
|
||||
* @param callback {Function} callback(err, colorId)
|
||||
*/
|
||||
exports.getAuthorColorId = function (author, callback)
|
||||
{
|
||||
|
@ -81,6 +84,8 @@ exports.getAuthorColorId = function (author, callback)
|
|||
|
||||
/**
|
||||
* Sets the color Id of the author
|
||||
* @param author {String} The id of the author
|
||||
* @param callback {Function} (optional)
|
||||
*/
|
||||
exports.setAuthorColorId = function (author, colorId, callback)
|
||||
{
|
||||
|
@ -89,6 +94,8 @@ exports.setAuthorColorId = function (author, colorId, callback)
|
|||
|
||||
/**
|
||||
* Returns the name of the author
|
||||
* @param author {String} The id of the author
|
||||
* @param callback {Function} callback(err, name)
|
||||
*/
|
||||
exports.getAuthorName = function (author, callback)
|
||||
{
|
||||
|
@ -97,6 +104,8 @@ exports.getAuthorName = function (author, callback)
|
|||
|
||||
/**
|
||||
* Sets the name of the author
|
||||
* @param author {String} The id of the author
|
||||
* @param callback {Function} (optional)
|
||||
*/
|
||||
exports.setAuthorName = function (author, name, callback)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/**
|
||||
/*
|
||||
* This is the Changeset library copied from the old Etherpad with some modifications to use it in node.js
|
||||
* Can be found in https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2.js
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* The MessageHandler handles all Messages that comes from Socket.IO and controls the sessions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/**
|
||||
* The pad object, defined with joose
|
||||
*/
|
||||
|
||||
var Changeset = require("../Changeset");
|
||||
var AttributePoolFactory = require("../AttributePoolFactory");
|
||||
var db = require("../db").db;
|
||||
|
@ -5,7 +9,7 @@ var async = require("async");
|
|||
var settings = require('../settings');
|
||||
|
||||
/**
|
||||
* Copied from the Etherpad source code, don't know what its good for
|
||||
* Copied from the Etherpad source code. It converts Windows line breaks to Unix line breaks and convert Tabs to spaces
|
||||
* @param txt
|
||||
*/
|
||||
exports.cleanText = function (txt) {
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* The Pad Manager is a Factory for pad Objects
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -14,11 +18,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
The Pad Module trys to simulate the pad object from EtherPad. You can find the original code in /etherpad/src/etherpad/pad/model.js
|
||||
see https://github.com/ether/pad/blob/master/etherpad/src/etherpad/pad/model.js
|
||||
*/
|
||||
|
||||
var Changeset = require("./Models/Pad");
|
||||
|
||||
/**
|
||||
|
@ -27,9 +26,9 @@ var Changeset = require("./Models/Pad");
|
|||
globalPads = [];
|
||||
|
||||
/**
|
||||
* Return a Function Wrapper to work with the Pad
|
||||
* Returns a Pad Object with the callback
|
||||
* @param id A String with the id of the pad
|
||||
* @param createIfNotExist A Boolean which says the function if it should create the Pad if it not exist
|
||||
* @param callback {Function}
|
||||
*/
|
||||
exports.getPad = function(id, callback)
|
||||
{
|
||||
|
|
13
node/db.js
13
node/db.js
|
@ -1,4 +1,9 @@
|
|||
/**
|
||||
* The DB Module provides a database initalized with the settings
|
||||
* provided by the settings module
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -20,9 +25,15 @@ var settings = require("./settings");
|
|||
//set database settings
|
||||
var db = new ueberDB.database(settings.dbType, settings.dbSettings);
|
||||
|
||||
//set the exported db to null, we will set it in intalize
|
||||
/**
|
||||
* The UeberDB Object that provides the database functions
|
||||
*/
|
||||
exports.db = null;
|
||||
|
||||
/**
|
||||
* Initalizes the database with the settings provided by the settings module
|
||||
* @param callback {Function}
|
||||
*/
|
||||
exports.init = function(callback)
|
||||
{
|
||||
//initalize the database async
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
/**
|
||||
* I found this tests in the old Etherpad and used it to test if the Changeset library can be run on node.js.
|
||||
* It has no use for ep-lite, but I thought I keep it cause it may help someone to understand the Changeset library
|
||||
* https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2_tests.js
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/**
|
||||
* This Module manages all /minified/* requests. It controls the
|
||||
* minification && compression of Javascript and CSS.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -27,6 +32,8 @@ var server = require('./server');
|
|||
|
||||
/**
|
||||
* Answers a http request for the pad javascript
|
||||
* @param req the Express request
|
||||
* @param res the Express response
|
||||
*/
|
||||
exports.padJS = function(req, res)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
/**
|
||||
* This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server.
|
||||
* Static file Requests are answered directly from this module, Socket.IO messages are passed
|
||||
* to MessageHandler and minfied requests are passed to minified.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/**
|
||||
* The Settings Modul reads the settings out of settings.json and provides
|
||||
* this information to the other modules
|
||||
*/
|
||||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -16,12 +21,29 @@
|
|||
|
||||
var fs = require("fs");
|
||||
|
||||
//default settings
|
||||
/**
|
||||
* The Port ep-lite should listen to
|
||||
*/
|
||||
exports.port = 9001;
|
||||
/*
|
||||
* The Type of the database
|
||||
*/
|
||||
exports.dbType = "sqlite";
|
||||
/**
|
||||
* This setting is passed with dbType to ueberDB to set up the database
|
||||
*/
|
||||
exports.dbSettings = { "filename" : "../var/sqlite.db" };
|
||||
/**
|
||||
* A flag that shows if http requests should be loged to stdout
|
||||
*/
|
||||
exports.logHTTP = true;
|
||||
/**
|
||||
* The default Text of a new pad
|
||||
*/
|
||||
exports.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";
|
||||
/**
|
||||
* A flag that shows if minification is enabled or not
|
||||
*/
|
||||
exports.minify = true;
|
||||
|
||||
//read the settings sync
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue