mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
25 lines
710 B
JavaScript
25 lines
710 B
JavaScript
const { Request, Response } = require('express')
|
|
const PluginManager = require('../managers/PluginManager')
|
|
const Logger = require('../Logger')
|
|
|
|
class PluginController {
|
|
constructor() {}
|
|
|
|
/**
|
|
* POST: /api/plugins/action
|
|
*
|
|
* @param {Request} req
|
|
* @param {Response} res
|
|
*/
|
|
handleAction(req, res) {
|
|
const pluginSlug = req.body.pluginSlug
|
|
const actionName = req.body.pluginAction
|
|
const target = req.body.target
|
|
const data = req.body.data
|
|
Logger.info(`[PluginController] Handle plugin action ${pluginSlug} ${actionName} ${target}`, data)
|
|
PluginManager.onAction(pluginSlug, actionName, target, data)
|
|
res.sendStatus(200)
|
|
}
|
|
}
|
|
module.exports = new PluginController()
|