just a basic example, needs working on still

export-etherpad-hooks
John McLear 2020-11-03 22:25:05 +00:00
parent f2abbdb5d8
commit 73b375577b
1 changed files with 14 additions and 0 deletions

View File

@ -16,6 +16,7 @@
var log4js = require('log4js'); var log4js = require('log4js');
const db = require("../db/DB"); const db = require("../db/DB");
const hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
exports.setPadRaw = function(padId, records) exports.setPadRaw = function(padId, records)
{ {
@ -62,6 +63,19 @@ exports.setPadRaw = function(padId, records)
// and create the value // and create the value
newKey = oldPadId.join(":"); // create the new key 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 // Write the value to the server