mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
my version plus recent
This commit is contained in:
commit
e1052a6a5d
7 changed files with 102 additions and 19 deletions
|
@ -20,13 +20,6 @@ hash node > /dev/null 2>&1 || {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#check node version
|
|
||||||
NODE_VERSION=$(node --version)
|
|
||||||
if [ ! $(echo $NODE_VERSION | cut -d "." -f 1-2) = "v0.4" ]; then
|
|
||||||
echo "You're running a wrong version of node, you're using $NODE_VERSION, we need v0.4.x" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Is npm installed?
|
#Is npm installed?
|
||||||
hash npm > /dev/null 2>&1 || {
|
hash npm > /dev/null 2>&1 || {
|
||||||
echo "Please install npm ( http://npmjs.org )" >&2
|
echo "Please install npm ( http://npmjs.org )" >&2
|
||||||
|
|
|
@ -25,6 +25,7 @@ var groupManager = require("./GroupManager");
|
||||||
var authorManager = require("./AuthorManager");
|
var authorManager = require("./AuthorManager");
|
||||||
var sessionManager = require("./SessionManager");
|
var sessionManager = require("./SessionManager");
|
||||||
var async = require("async");
|
var async = require("async");
|
||||||
|
var exportHtml = require("../utils/ExportHtml");
|
||||||
|
|
||||||
/**********************/
|
/**********************/
|
||||||
/**GROUP FUNCTIONS*****/
|
/**GROUP FUNCTIONS*****/
|
||||||
|
@ -169,6 +170,90 @@ exports.setText = function(padID, text, callback)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
getHTML(padID, [rev]) returns the html of a pad
|
||||||
|
|
||||||
|
Example returns:
|
||||||
|
|
||||||
|
{code: 0, message:"ok", data: {text:"Welcome <strong>Text</strong>"}}
|
||||||
|
{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({stop: "rev is not a number"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rev !== undefined && rev < 0)
|
||||||
|
{
|
||||||
|
callback({stop: "rev is a negative number"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rev !== undefined && !is_int(rev))
|
||||||
|
{
|
||||||
|
callback({stop: "rev is a float value"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPadSafe(padID, true, function(err, pad)
|
||||||
|
{
|
||||||
|
if(err)
|
||||||
|
{
|
||||||
|
callback(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//the client asked for a special revision
|
||||||
|
if(rev !== undefined)
|
||||||
|
{
|
||||||
|
//check if this is a valid revision
|
||||||
|
if(rev > pad.getHeadRevisionNumber())
|
||||||
|
{
|
||||||
|
callback({stop: "rev is higher than the head revision of the pad"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get the html of this revision
|
||||||
|
exportHtml.getPadHTML(pad, rev, function(err, html)
|
||||||
|
{
|
||||||
|
if(!err)
|
||||||
|
{
|
||||||
|
data = {html: html};
|
||||||
|
}
|
||||||
|
callback(err, data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//the client wants the latest text, lets return it to him
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exportHtml.getPadHTML(pad, undefined, function (err, html)
|
||||||
|
{
|
||||||
|
if(!err)
|
||||||
|
{
|
||||||
|
data = {html: html};
|
||||||
|
}
|
||||||
|
callback(err, data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
/**PAD FUNCTIONS */
|
/**PAD FUNCTIONS */
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
|
@ -50,6 +50,7 @@ var functions = {
|
||||||
"listSessionsOfAuthor" : ["authorID"],
|
"listSessionsOfAuthor" : ["authorID"],
|
||||||
"getText" : ["padID", "rev"],
|
"getText" : ["padID", "rev"],
|
||||||
"setText" : ["padID", "text"],
|
"setText" : ["padID", "text"],
|
||||||
|
"getHTML" : ["padID", "rev"],
|
||||||
"getRevisionsCount" : ["padID"],
|
"getRevisionsCount" : ["padID"],
|
||||||
"deletePad" : ["padID"],
|
"deletePad" : ["padID"],
|
||||||
"getReadOnlyID" : ["padID"],
|
"getReadOnlyID" : ["padID"],
|
||||||
|
|
|
@ -193,7 +193,7 @@ exports.handleMessage = function(client, message)
|
||||||
//if the message type is unkown, throw an exception
|
//if the message type is unkown, throw an exception
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
messageLogger.warn("Dropped message, unkown Message Type " + message.type);
|
messageLogger.warn("Dropped message, unkown Message Type " + message.type + ": " + JSON.stringify(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ function getPadHTML(pad, revNum, callback)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.getPadHTML = getPadHTML;
|
||||||
|
|
||||||
function getHTMLFromAtext(pad, atext)
|
function getHTMLFromAtext(pad, atext)
|
||||||
{
|
{
|
||||||
var apool = pad.apool();
|
var apool = pad.apool();
|
||||||
|
|
16
package.json
16
package.json
|
@ -10,16 +10,16 @@
|
||||||
"name": "Robin Buse"}
|
"name": "Robin Buse"}
|
||||||
],
|
],
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"socket.io" : "0.7.9",
|
"socket.io" : "0.8.7",
|
||||||
"ueberDB" : "0.1.2",
|
"ueberDB" : "0.1.3",
|
||||||
"async" : "0.1.9",
|
"async" : "0.1.15",
|
||||||
"joose" : "3.18.0",
|
"joose" : "3.50.0",
|
||||||
"express" : "2.4.5",
|
"express" : "2.5.0",
|
||||||
"clean-css" : "0.2.4",
|
"clean-css" : "0.2.4",
|
||||||
"uglify-js" : "1.0.7",
|
"uglify-js" : "1.1.1",
|
||||||
"gzip" : "0.1.0",
|
"gzip" : "0.1.0",
|
||||||
"formidable" : "1.0.2",
|
"formidable" : "1.0.7",
|
||||||
"log4js" : "0.3.8"
|
"log4js" : "0.3.9"
|
||||||
},
|
},
|
||||||
"version" : "1.0.0"
|
"version" : "1.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,11 +116,13 @@
|
||||||
//start the costum js
|
//start the costum js
|
||||||
if(typeof costumStart == "function") costumStart();
|
if(typeof costumStart == "function") costumStart();
|
||||||
</script>
|
</script>
|
||||||
|
<body onload= "document.mainform.padname.focus();" >
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<div id="button" onclick="go2Random()" title="open a new pad with a generated random name like 'B3GYd74mn2yBH6'">create new random pad</div><br><div id="label">open an existing pad or create a new pad with the name</div>
|
<div id="button" onclick="go2Random()" title="open a new pad with a generated random name like 'B3GYd74mn2yBH6'">create new random pad</div><br><div id="label">open an existing pad or create a new pad with the name</div>
|
||||||
<form action="#" onsubmit="go2Name();return false;">
|
<form action="#" name="mainform" onsubmit="go2Name();return false;">
|
||||||
<input type="text" id="padname" autofocus>
|
<input type="text" name="padname" id="padname" autofocus>
|
||||||
<input type="submit" value="OK">
|
<input type="submit" value="OK">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue