From 73b375577b47e5c986a135ec6a795d24d4711c79 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 3 Nov 2020 22:25:05 +0000 Subject: [PATCH] just a basic example, needs working on still --- src/node/utils/ImportEtherpad.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/node/utils/ImportEtherpad.js b/src/node/utils/ImportEtherpad.js index a5b1074e6..927eaa98a 100644 --- a/src/node/utils/ImportEtherpad.js +++ b/src/node/utils/ImportEtherpad.js @@ -16,6 +16,7 @@ var log4js = require('log4js'); const db = require("../db/DB"); +const hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks'); exports.setPadRaw = function(padId, records) { @@ -62,6 +63,19 @@ exports.setPadRaw = function(padId, records) // and create the value newKey = oldPadId.join(":"); // create the new key } + + // is this a key that is supported through a plugin? + 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) { + if(key.split(":")[0] === prefix){ + newKey = "comments:" + padId; + } + }); + }) + ]); } // Write the value to the server