Commit 74c00097 authored by marioromera's avatar marioromera
Browse files

start etherpad

parent a21a2083
......@@ -28,6 +28,8 @@ module.exports = io => {
subscriber.on('connect', () => {
logger.success('Redis connected');
subscriber.subscribe(`pad:${PAD_ID}`);
startEtherpad();
subscriber.on('message', (channel, message) => {
logger.warn('Pad updated');
(async () => {
......@@ -130,6 +132,21 @@ async function getRevisionText(revision) {
return etherpadJson.data.text;
}
async function startEtherpad() {
logger.warn('starting etherpad');
const response = await fetch(
`${etherpadUrl}/api/1/createPad?apikey=0ee96c0c21cab2c92d817414589f3f4ebf13af96bf54318f4ff72065cca93d27&padID=poc&text="Aesthetics promises a non-polemical, consensual framing of the common world."`
);
const etherpadJson = await response.json();
if (etherpadJson.messsage !== 'ok') {
logger.error('Pad not started, error', etherpadJson.message);
} else {
logger.success('Pad started');
}
return etherpadJson.data;
}
async function saveRevision() {
logger.warn('Saving revision');
const response = await fetch(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment