mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
resolve merge conflict
This commit is contained in:
commit
3fac18f88a
22 changed files with 517 additions and 137 deletions
|
@ -278,6 +278,77 @@ exports.setHTML = function(padID, html, callback)
|
|||
});
|
||||
}
|
||||
|
||||
/******************/
|
||||
/**CHAT FUNCTIONS */
|
||||
/******************/
|
||||
|
||||
/**
|
||||
getChatHistory(padId, start, end), returns a part of or the whole chat-history of this pad
|
||||
|
||||
Example returns:
|
||||
|
||||
{"code":0,"message":"ok","data":{"messages":[{"text":"foo","userId":"a.foo","time":1359199533759,"userName":"test"},
|
||||
{"text":"bar","userId":"a.foo","time":1359199534622,"userName":"test"}]}}
|
||||
|
||||
{code: 1, message:"start is higher or equal to the current chatHead", data: null}
|
||||
|
||||
{code: 1, message:"padID does not exist", data: null}
|
||||
*/
|
||||
exports.getChatHistory = function(padID, start, end, callback)
|
||||
{
|
||||
if(start && end)
|
||||
{
|
||||
if(start < 0)
|
||||
{
|
||||
callback(new customError("start is below zero","apierror"));
|
||||
return;
|
||||
}
|
||||
if(end < 0)
|
||||
{
|
||||
callback(new customError("end is below zero","apierror"));
|
||||
return;
|
||||
}
|
||||
if(start > end)
|
||||
{
|
||||
callback(new customError("start is higher than end","apierror"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//get the pad
|
||||
getPadSafe(padID, true, function(err, pad)
|
||||
{
|
||||
if(ERR(err, callback)) return;
|
||||
var chatHead = pad.chatHead;
|
||||
|
||||
// fall back to getting the whole chat-history if a parameter is missing
|
||||
if(!start || !end)
|
||||
{
|
||||
start = 0;
|
||||
end = pad.chatHead - 1;
|
||||
}
|
||||
|
||||
if(start >= chatHead)
|
||||
{
|
||||
callback(new customError("start is higher or equal to the current chatHead","apierror"));
|
||||
return;
|
||||
}
|
||||
if(end >= chatHead)
|
||||
{
|
||||
callback(new customError("end is higher or equal to the current chatHead","apierror"));
|
||||
return;
|
||||
}
|
||||
|
||||
// the the whole message-log and return it to the client
|
||||
pad.getChatMessages(start, end,
|
||||
function(err, msgs)
|
||||
{
|
||||
if(ERR(err, callback)) return;
|
||||
callback(null, {messages: msgs});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*****************/
|
||||
/**PAD FUNCTIONS */
|
||||
/*****************/
|
||||
|
@ -568,6 +639,23 @@ exports.checkToken = function(callback)
|
|||
callback();
|
||||
}
|
||||
|
||||
/**
|
||||
getChatHead(padID) returns the chatHead (last number of the last chat-message) of the pad
|
||||
|
||||
Example returns:
|
||||
|
||||
{code: 0, message:"ok", data: {chatHead: 42}}
|
||||
{code: 1, message:"padID does not exist", data: null}
|
||||
*/
|
||||
exports.getChatHead = function(padID, callback)
|
||||
{
|
||||
//get the pad
|
||||
getPadSafe(padID, true, function(err, pad)
|
||||
{
|
||||
if(ERR(err, callback)) return;
|
||||
callback(null, {chatHead: pad.chatHead});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
createDiff(padID, startRev, endRev) returns an object of diffs from 2 points in a pad
|
||||
|
|
|
@ -174,13 +174,13 @@ var version =
|
|||
, "listAllGroups" : []
|
||||
, "checkToken" : []
|
||||
}
|
||||
, "1.2.2":
|
||||
, "1.2.7":
|
||||
{ "createGroup" : []
|
||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
||||
, "deleteGroup" : ["groupID"]
|
||||
, "listPads" : ["groupID"]
|
||||
, "listAllPads" : []
|
||||
, "createDiff" : ["padID", "startRev", "endRev"]
|
||||
, "createDiff" : ["padID", "startRev", "endRev"]
|
||||
, "createPad" : ["padID", "text"]
|
||||
, "createGroupPad" : ["groupID", "padName", "text"]
|
||||
, "createAuthor" : ["name"]
|
||||
|
@ -210,6 +210,9 @@ var version =
|
|||
, "sendClientsMessage" : ["padID", "msg"]
|
||||
, "listAllGroups" : []
|
||||
, "checkToken" : []
|
||||
, "getChatHistory" : ["padID"]
|
||||
, "getChatHistory" : ["padID", "start", "end"]
|
||||
, "getChatHead" : ["padID"]
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ exports.doImport = function(req, res, padId)
|
|||
ERR(err);
|
||||
|
||||
//close the connection
|
||||
res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script></head><script>$(window).load(function(){if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.require('/pad_impexp').padimpexp.handleFrameCall('" + status + "');})</script>", 200);
|
||||
res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script></head><script>$(window).load(function(){if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.padimpexp.handleFrameCall('" + status + "');})</script>", 200);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@ var path = require('path');
|
|||
var eejs = require('ep_etherpad-lite/node/eejs');
|
||||
var installer = require('ep_etherpad-lite/static/js/pluginfw/installer');
|
||||
var plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins');
|
||||
var _ = require('underscore');
|
||||
var semver = require('semver');
|
||||
var async = require('async');
|
||||
|
||||
exports.expressCreateServer = function (hook_name, args, cb) {
|
||||
args.app.get('/admin/plugins', function(req, res) {
|
||||
|
@ -25,8 +28,26 @@ exports.socketio = function (hook_name, args, cb) {
|
|||
if (!socket.handshake.session.user || !socket.handshake.session.user.is_admin) return;
|
||||
|
||||
socket.on("load", function (query) {
|
||||
// send currently installed plugins
|
||||
socket.emit("installed-results", {results: plugins.plugins});
|
||||
socket.emit("progress", {progress:1});
|
||||
});
|
||||
|
||||
socket.on("checkUpdates", function() {
|
||||
socket.emit("progress", {progress:0, message:'Checking for plugin updates...'});
|
||||
// Check plugins for updates
|
||||
installer.search({offset: 0, pattern: '', limit: 500}, /*useCache:*/true, function(data) { // hacky
|
||||
if (!data.results) return;
|
||||
var updatable = _(plugins.plugins).keys().filter(function(plugin) {
|
||||
if(!data.results[plugin]) return false;
|
||||
var latestVersion = data.results[plugin]['dist-tags'].latest
|
||||
var currentVersion = plugins.plugins[plugin].package.version
|
||||
return semver.gt(latestVersion, currentVersion)
|
||||
});
|
||||
socket.emit("updatable", {updatable: updatable});
|
||||
socket.emit("progress", {progress:1});
|
||||
});
|
||||
})
|
||||
|
||||
socket.on("search", function (query) {
|
||||
socket.emit("progress", {progress:0, message:'Fetching results...'});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue