export support

export-etherpad-hooks
John McLear 2020-11-03 22:04:01 +00:00
parent 91268e14b7
commit 55900b4c23
1 changed files with 14 additions and 0 deletions

View File

@ -16,6 +16,7 @@
let db = require("../db/DB"); let db = require("../db/DB");
let hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
exports.getPadRaw = async function(padId) { exports.getPadRaw = async function(padId) {
@ -23,6 +24,7 @@ exports.getPadRaw = async function(padId) {
let padcontent = await db.get(padKey); let padcontent = await db.get(padKey);
let records = [ padKey ]; let records = [ padKey ];
for (let i = 0; i <= padcontent.head; i++) { for (let i = 0; i <= padcontent.head; i++) {
records.push(padKey + ":revs:" + i); records.push(padKey + ":revs:" + i);
} }
@ -58,5 +60,17 @@ exports.getPadRaw = async function(padId) {
} }
} }
await Promise.all([
// get content that has a different prefix IE comments:padId:foo
// a plugin would return something likle ["comments", "cakes"]
hooks.aCallAll('exportEtherpadAdditionalContent').then((prefixes) => {
prefixes.forEach(async function(prefix) {
let pluginContent = await db.get(prefix + ":" + padId);
data[prefix] = pluginContent;
});
})
]);
return data; return data;
} }