mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
Plugin admin fixes
This commit is contained in:
parent
6f774bc6a5
commit
7ab7ee9f5e
3 changed files with 64 additions and 34 deletions
|
@ -55,7 +55,7 @@ exports.install = function(plugin_name, cb) {
|
|||
);
|
||||
};
|
||||
|
||||
exports.search = function(pattern, cb) {
|
||||
exports.search = function(query, cb) {
|
||||
withNpm(
|
||||
function (cb) {
|
||||
registry.get(
|
||||
|
@ -63,11 +63,18 @@ exports.search = function(pattern, cb) {
|
|||
function (er, data) {
|
||||
if (er) return cb(er);
|
||||
var res = {};
|
||||
var i = 0;
|
||||
for (key in data) {
|
||||
if (key.indexOf(plugins.prefix) == 0 && key.indexOf(pattern) != -1)
|
||||
res[key] = data[key];
|
||||
if (/* && key.indexOf(plugins.prefix) == 0 */
|
||||
key.indexOf(query.pattern) != -1) {
|
||||
i++;
|
||||
if (i > query.offset
|
||||
&& i <= query.offset + query.limit) {
|
||||
res[key] = data[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
cb(null, {results:res});
|
||||
cb(null, {results:res, query: query, total:i});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue