mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-03 00:39:39 +00:00
Add minimal template plugin
This commit is contained in:
parent
e7e0056288
commit
c8682c8456
2 changed files with 56 additions and 0 deletions
36
test/server/managers/plugins/Template/index.js
Normal file
36
test/server/managers/plugins/Template/index.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Called on initialization of the plugin
|
||||
*
|
||||
* @param {import('../../../server/managers/PluginManager').PluginContext} context
|
||||
*/
|
||||
module.exports.init = async (context) => {
|
||||
context.Logger.info('[TemplatePlugin] plugin initialized')
|
||||
// Can be used to initialize plugin config and/or setup Database hooks
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an extension action is triggered
|
||||
*
|
||||
* @param {import('../../../server/managers/PluginManager').PluginContext} context
|
||||
* @param {string} actionName
|
||||
* @param {string} target
|
||||
* @param {Object} data
|
||||
* @returns {Promise<boolean|{error: string}>}
|
||||
*/
|
||||
module.exports.onAction = async (context, actionName, target, data) => {
|
||||
context.Logger.info('[TemplatePlugin] plugin onAction', actionName, target, data)
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the plugin config page is saved
|
||||
*
|
||||
* @param {import('../../../server/managers/PluginManager').PluginContext} context
|
||||
* @param {Object} config
|
||||
* @returns {Promise<boolean|{error: string}>}
|
||||
*/
|
||||
module.exports.onConfigSave = async (context, config) => {
|
||||
context.Logger.info('[TemplatePlugin] plugin onConfigSave', config)
|
||||
// Maintener is responsible for validating and saving the config to their `pluginInstance`
|
||||
return true
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue