new backend plugin system!

This commit is contained in:
lesion
2021-12-02 12:39:55 +01:00
parent d43cfbd6f9
commit fcd4428c6b
3 changed files with 58 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
const events = require('events')
const mail = require('./api/mail')
const config = require('./config')
const log = require('./log')
const fediverseHelpers = require('./federation/helpers')
@@ -15,6 +16,8 @@ const settingsController = require('./api/controller/settings')
const notifier = {
emitter: new events.EventEmitter(),
sendNotification (notification, event) {
const promises = []
log.info(`Send ${notification.type} notification ${notification.action}`)
@@ -38,7 +41,8 @@ const notifier = {
const event = await Event.findByPk(eventId, {
include: [Tag, Place, Notification, User]
})
notifier.emitter.emit(action, event.get({ plain: true, raw: true }))
log.debug(action, event.title)
// insert notifications