mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-15 03:26:53 -04:00
adds missing semicolons in src/node/db
This commit is contained in:
parent
35e4891217
commit
046dad97a6
8 changed files with 70 additions and 70 deletions
|
@ -143,7 +143,7 @@ exports.getText = function(padID, rev, callback)
|
|||
data = {text: atext.text};
|
||||
|
||||
callback(null, data);
|
||||
})
|
||||
});
|
||||
}
|
||||
//the client wants the latest text, lets return it to him
|
||||
else
|
||||
|
@ -151,7 +151,7 @@ exports.getText = function(padID, rev, callback)
|
|||
callback(null, {"text": pad.text()});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
setText(padID, text) sets the text of a pad
|
||||
|
@ -182,7 +182,7 @@ exports.setText = function(padID, text, callback)
|
|||
//update the clients on the pad
|
||||
padMessageHandler.updatePadClients(pad, callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getHTML(padID, [rev]) returns the html of a pad
|
||||
|
@ -258,7 +258,7 @@ exports.getHTML = function(padID, rev, callback)
|
|||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.setHTML = function(padID, html, callback)
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ exports.setHTML = function(padID, html, callback)
|
|||
padMessageHandler.updatePadClients(pad, callback);
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/******************/
|
||||
/**CHAT FUNCTIONS */
|
||||
|
@ -345,7 +345,7 @@ exports.getChatHistory = function(padID, start, end, callback)
|
|||
callback(null, {messages: msgs});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*****************/
|
||||
/**PAD FUNCTIONS */
|
||||
|
@ -368,7 +368,7 @@ exports.getRevisionsCount = function(padID, callback)
|
|||
|
||||
callback(null, {revisions: pad.getHeadRevisionNumber()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getLastEdited(padID) returns the timestamp of the last revision of the pad
|
||||
|
@ -389,7 +389,7 @@ exports.getLastEdited = function(padID, callback)
|
|||
callback(null, {lastEdited: value});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
createPad(padName [, text]) creates a new pad in this group
|
||||
|
@ -414,7 +414,7 @@ exports.createPad = function(padID, text, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
deletePad(padID) deletes a pad
|
||||
|
@ -432,7 +432,7 @@ exports.deletePad = function(padID, callback)
|
|||
|
||||
pad.remove(callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getReadOnlyLink(padID) returns the read only link of a pad
|
||||
|
@ -456,7 +456,7 @@ exports.getReadOnlyID = function(padID, callback)
|
|||
callback(null, {readOnlyID: readOnlyId});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
setPublicStatus(padID, publicStatus) sets a boolean for the public status of a pad
|
||||
|
@ -489,7 +489,7 @@ exports.setPublicStatus = function(padID, publicStatus, callback)
|
|||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getPublicStatus(padID) return true of false
|
||||
|
@ -515,7 +515,7 @@ exports.getPublicStatus = function(padID, callback)
|
|||
|
||||
callback(null, {publicStatus: pad.getPublicStatus()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
setPassword(padID, password) returns ok or a error message
|
||||
|
@ -544,7 +544,7 @@ exports.setPassword = function(padID, password, callback)
|
|||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
isPasswordProtected(padID) returns true or false
|
||||
|
@ -570,7 +570,7 @@ exports.isPasswordProtected = function(padID, callback)
|
|||
|
||||
callback(null, {isPasswordProtected: pad.isPasswordProtected()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
listAuthorsOfPad(padID) returns an array of authors who contributed to this pad
|
||||
|
@ -589,7 +589,7 @@ exports.listAuthorsOfPad = function(padID, callback)
|
|||
|
||||
callback(null, {authorIDs: pad.getAllAuthors()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
sendClientsMessage(padID, msg) sends a message to all clients connected to the
|
||||
|
@ -622,7 +622,7 @@ exports.sendClientsMessage = function (padID, msg, callback) {
|
|||
padMessageHandler.handleCustomMessage(padID, msg, callback);
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
checkToken() returns ok when the current api token is valid
|
||||
|
@ -635,7 +635,7 @@ Example returns:
|
|||
exports.checkToken = function(callback)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getChatHead(padID) returns the chatHead (last number of the last chat-message) of the pad
|
||||
|
@ -653,7 +653,7 @@ exports.getChatHead = function(padID, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback(null, {chatHead: pad.chatHead});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
createDiffHTML(padID, startRev, endRev) returns an object of diffs from 2 points in a pad
|
||||
|
@ -730,10 +730,10 @@ exports.createDiffHTML = function(padID, startRev, endRev, callback){
|
|||
});
|
||||
}
|
||||
], function(err){
|
||||
callback(err, {html: html, authors: authors})
|
||||
callback(err, {html: html, authors: authors});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/******************************/
|
||||
/** INTERNAL HELPER FUNCTIONS */
|
||||
|
@ -742,7 +742,7 @@ exports.createDiffHTML = function(padID, startRev, endRev, callback){
|
|||
//checks if a number is an int
|
||||
function is_int(value)
|
||||
{
|
||||
return (parseFloat(value) == parseInt(value)) && !isNaN(value)
|
||||
return (parseFloat(value) == parseInt(value)) && !isNaN(value);
|
||||
}
|
||||
|
||||
//gets a pad safe
|
||||
|
|
|
@ -39,7 +39,7 @@ exports.doesAuthorExists = function (authorID, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback(null, author != null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the AuthorID for a token.
|
||||
|
@ -54,7 +54,7 @@ exports.getAuthor4Token = function (token, callback)
|
|||
//return only the sub value authorID
|
||||
callback(null, author ? author.authorID : author);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the AuthorID for a mapper.
|
||||
|
@ -75,7 +75,7 @@ exports.createAuthorIfNotExistsFor = function (authorMapper, name, callback)
|
|||
//return the authorID
|
||||
callback(null, author);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the AuthorID for a mapper. We can map using a mapperkey,
|
||||
|
@ -133,7 +133,7 @@ exports.createAuthor = function(name, callback)
|
|||
db.set("globalAuthor:" + author, authorObj);
|
||||
|
||||
callback(null, {authorID: author});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the Author Obj of the author
|
||||
|
@ -143,7 +143,7 @@ exports.createAuthor = function(name, callback)
|
|||
exports.getAuthor = function (author, callback)
|
||||
{
|
||||
db.get("globalAuthor:" + author, callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ exports.getAuthor = function (author, callback)
|
|||
exports.getAuthorColorId = function (author, callback)
|
||||
{
|
||||
db.getSub("globalAuthor:" + author, ["colorId"], callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the color Id of the author
|
||||
|
@ -166,7 +166,7 @@ exports.getAuthorColorId = function (author, callback)
|
|||
exports.setAuthorColorId = function (author, colorId, callback)
|
||||
{
|
||||
db.setSub("globalAuthor:" + author, ["colorId"], colorId, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the name of the author
|
||||
|
@ -176,7 +176,7 @@ exports.setAuthorColorId = function (author, colorId, callback)
|
|||
exports.getAuthorName = function (author, callback)
|
||||
{
|
||||
db.getSub("globalAuthor:" + author, ["name"], callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the name of the author
|
||||
|
@ -187,7 +187,7 @@ exports.getAuthorName = function (author, callback)
|
|||
exports.setAuthorName = function (author, name, callback)
|
||||
{
|
||||
db.setSub("globalAuthor:" + author, ["name"], name, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an array of all pads this author contributed to
|
||||
|
@ -208,7 +208,7 @@ exports.listPadsOfAuthor = function (authorID, callback)
|
|||
//author does not exists
|
||||
if(author == null)
|
||||
{
|
||||
callback(new customError("authorID does not exist","apierror"))
|
||||
callback(new customError("authorID does not exist","apierror"));
|
||||
}
|
||||
//everything is fine, return the pad IDs
|
||||
else
|
||||
|
@ -224,7 +224,7 @@ exports.listPadsOfAuthor = function (authorID, callback)
|
|||
callback(null, {padIDs: pads});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a new pad to the list of contributions
|
||||
|
@ -251,7 +251,7 @@ exports.addPad = function (authorID, padID)
|
|||
//save the new element back
|
||||
db.set("globalAuthor:" + authorID, author);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a pad from the list of contributions
|
||||
|
@ -272,4 +272,4 @@ exports.removePad = function (authorID, padID)
|
|||
db.set("globalAuthor:" + authorID, author);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -54,4 +54,4 @@ exports.init = function(callback)
|
|||
callback(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@ exports.listAllGroups = function(callback) {
|
|||
}
|
||||
callback(null, {groupIDs: groupIDs});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.deleteGroup = function(groupID, callback)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ exports.deleteGroup = function(groupID, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
|
||||
//skip if there is no group2sessions entry
|
||||
if(group2sessions == null) {callback(); return}
|
||||
if(group2sessions == null) {callback(); return;}
|
||||
|
||||
//collect all sessions in an array, that allows us to use async.forEach
|
||||
var sessions = [];
|
||||
|
@ -162,7 +162,7 @@ exports.deleteGroup = function(groupID, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.doesGroupExist = function(groupID, callback)
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ exports.doesGroupExist = function(groupID, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback(null, group != null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.createGroup = function(callback)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ exports.createGroup = function(callback)
|
|||
callback(null, {groupID: groupID});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.createGroupIfNotExistsFor = function(groupMapper, callback)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ exports.createGroupIfNotExistsFor = function(groupMapper, callback)
|
|||
callback(null, {groupID: groupID});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.createGroupPad = function(groupID, padName, text, callback)
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ exports.createGroupPad = function(groupID, padName, text, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback(null, {padID: padID});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.listPads = function(groupID, callback)
|
||||
{
|
||||
|
@ -328,4 +328,4 @@ exports.listPads = function(groupID, callback)
|
|||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -111,13 +111,13 @@ Pad.prototype.saveToDatabase = function saveToDatabase(){
|
|||
}
|
||||
|
||||
db.set("pad:"+this.id, dbObject);
|
||||
}
|
||||
};
|
||||
|
||||
// get time of last edit (changeset application)
|
||||
Pad.prototype.getLastEdit = function getLastEdit(callback){
|
||||
var revNum = this.getHeadRevisionNumber();
|
||||
db.getSub("pad:"+this.id+":revs:"+revNum, ["meta", "timestamp"], callback);
|
||||
}
|
||||
};
|
||||
|
||||
Pad.prototype.getRevisionChangeset = function getRevisionChangeset(revNum, callback) {
|
||||
db.getSub("pad:"+this.id+":revs:"+revNum, ["changeset"], callback);
|
||||
|
@ -250,7 +250,7 @@ Pad.prototype.getValidRevisionRange = function getValidRevisionRange(startRev, e
|
|||
endRev = head;
|
||||
}
|
||||
if(startRev !== null && endRev !== null) {
|
||||
return { startRev: startRev , endRev: endRev }
|
||||
return { startRev: startRev , endRev: endRev };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -155,7 +155,7 @@ exports.getPad = function(id, text, callback)
|
|||
callback(null, pad);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.listAllPads = function(callback)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ exports.listAllPads = function(callback)
|
|||
}else{
|
||||
return {padIDs: padList.getPads()};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//checks if a pad exists
|
||||
exports.doesPadExists = function(padId, callback)
|
||||
|
@ -180,7 +180,7 @@ exports.doesPadExists = function(padId, callback)
|
|||
callback(null, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//returns a sanitized padId, respecting legacy pad id formats
|
||||
exports.sanitizePadId = function(padId, callback) {
|
||||
|
@ -213,12 +213,12 @@ exports.sanitizePadId = function(padId, callback) {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.isValidPadId = function(padId)
|
||||
{
|
||||
return /^(g.[a-zA-Z0-9]{16}\$)?[^$]{1,50}$/.test(padId);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the pad from database and unloads it.
|
||||
|
@ -227,11 +227,11 @@ exports.removePad = function(padId){
|
|||
db.remove("pad:"+padId);
|
||||
exports.unloadPad(padId);
|
||||
padList.removePad(padId);
|
||||
}
|
||||
};
|
||||
|
||||
//removes a pad from the array
|
||||
exports.unloadPad = function(padId)
|
||||
{
|
||||
if(globalPads.get(padId))
|
||||
globalPads.remove(padId);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -61,8 +61,8 @@ exports.getReadOnlyId = function (padId, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
//return the results
|
||||
callback(null, readOnlyId);
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* returns a the padId for a read only id
|
||||
|
@ -71,7 +71,7 @@ exports.getReadOnlyId = function (padId, callback)
|
|||
exports.getPadId = function(readOnlyId, callback)
|
||||
{
|
||||
db.get("readonly2pad:" + readOnlyId, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* returns a the padId and readonlyPadId in an object for any id
|
||||
|
@ -86,7 +86,7 @@ exports.getIds = function(padIdOrReadonlyPadId, callback) {
|
|||
readonly: false
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (padIdOrReadonlyPadId.indexOf("r.") != 0)
|
||||
return handleRealPadId();
|
||||
|
@ -101,4 +101,4 @@ exports.getIds = function(padIdOrReadonlyPadId, callback) {
|
|||
readonly: true
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ exports.doesSessionExist = function(sessionID, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback(null, session != null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new session between an author and a group
|
||||
|
@ -182,8 +182,8 @@ exports.createSession = function(groupID, authorID, validUntil, callback)
|
|||
|
||||
//return error and sessionID
|
||||
callback(null, {sessionID: sessionID});
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.getSessionInfo = function(sessionID, callback)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ exports.getSessionInfo = function(sessionID, callback)
|
|||
//session does not exists
|
||||
if(session == null)
|
||||
{
|
||||
callback(new customError("sessionID does not exist","apierror"))
|
||||
callback(new customError("sessionID does not exist","apierror"));
|
||||
}
|
||||
//everything is fine, return the sessioninfos
|
||||
else
|
||||
|
@ -203,7 +203,7 @@ exports.getSessionInfo = function(sessionID, callback)
|
|||
callback(null, session);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Deletes a session
|
||||
|
@ -224,7 +224,7 @@ exports.deleteSession = function(sessionID, callback)
|
|||
//session does not exists
|
||||
if(session == null)
|
||||
{
|
||||
callback(new customError("sessionID does not exist","apierror"))
|
||||
callback(new customError("sessionID does not exist","apierror"));
|
||||
}
|
||||
//everything is fine, return the sessioninfos
|
||||
else
|
||||
|
@ -276,8 +276,8 @@ exports.deleteSession = function(sessionID, callback)
|
|||
{
|
||||
if(ERR(err, callback)) return;
|
||||
callback();
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.listSessionsOfGroup = function(groupID, callback)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ exports.listSessionsOfGroup = function(groupID, callback)
|
|||
listSessionsWithDBKey("group2sessions:" + groupID, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.listSessionsOfAuthor = function(authorID, callback)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ exports.listSessionsOfAuthor = function(authorID, callback)
|
|||
listSessionsWithDBKey("author2sessions:" + authorID, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//this function is basicly the code listSessionsOfAuthor and listSessionsOfGroup has in common
|
||||
function listSessionsWithDBKey (dbkey, callback)
|
||||
|
@ -363,5 +363,5 @@ function listSessionsWithDBKey (dbkey, callback)
|
|||
//checks if a number is an int
|
||||
function is_int(value)
|
||||
{
|
||||
return (parseFloat(value) == parseInt(value)) && !isNaN(value)
|
||||
return (parseFloat(value) == parseInt(value)) && !isNaN(value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue