From 55900b4c2397374d9d51d2f2b3d76fce08b54eaf Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Nov 2020 22:04:01 +0000 Subject: [PATCH] export support --- src/node/utils/ExportEtherpad.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/node/utils/ExportEtherpad.js b/src/node/utils/ExportEtherpad.js index 0e8ef3bf1..6993346be 100644 --- a/src/node/utils/ExportEtherpad.js +++ b/src/node/utils/ExportEtherpad.js @@ -16,6 +16,7 @@ let db = require("../db/DB"); +let hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks'); exports.getPadRaw = async function(padId) { @@ -23,6 +24,7 @@ exports.getPadRaw = async function(padId) { let padcontent = await db.get(padKey); let records = [ padKey ]; + for (let i = 0; i <= padcontent.head; 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; }