mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-02 16:29:39 +00:00
Example of potential plugin implementation
This commit is contained in:
parent
71b943f434
commit
62bd7e73f4
15 changed files with 347 additions and 7 deletions
5
test/server/managers/PluginManager.test.js
Normal file
5
test/server/managers/PluginManager.test.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
describe('PluginManager', () => {
|
||||
it('should register a plugin', () => {
|
||||
// Test implementation
|
||||
})
|
||||
})
|
||||
18
test/server/managers/plugins/Example/index.js
Normal file
18
test/server/managers/plugins/Example/index.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const PluginAbstract = require('../../../../../server/PluginAbstract')
|
||||
|
||||
class ExamplePlugin extends PluginAbstract {
|
||||
constructor() {
|
||||
super()
|
||||
|
||||
this.name = 'Example'
|
||||
}
|
||||
|
||||
init(context) {
|
||||
context.Logger.info('[ExamplePlugin] Example plugin loaded successfully')
|
||||
}
|
||||
|
||||
async onAction(context, actionName, target, data) {
|
||||
context.Logger.info('[ExamplePlugin] Example plugin onAction', actionName, target, data)
|
||||
}
|
||||
}
|
||||
module.exports = new ExamplePlugin()
|
||||
52
test/server/managers/plugins/Example/manifest.json
Normal file
52
test/server/managers/plugins/Example/manifest.json
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "Example Plugin",
|
||||
"slug": "example",
|
||||
"version": "1.0.0",
|
||||
"description": "This is an example plugin",
|
||||
"extensions": [
|
||||
{
|
||||
"target": "item.detail.actions",
|
||||
"name": "itemActionExample",
|
||||
"label": "Item Example Action",
|
||||
"labelKey": "ItemExampleAction"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"title": "Example Plugin Configuration",
|
||||
"titleKey": "ExamplePluginConfiguration",
|
||||
"description": "This is an example plugin",
|
||||
"descriptionKey": "ExamplePluginConfigurationDescription",
|
||||
"formFields": [
|
||||
{
|
||||
"name": "apiKey",
|
||||
"label": "API Key",
|
||||
"labelKey": "LabelApiKey",
|
||||
"type": "text",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "requestAddress",
|
||||
"label": "Request Address",
|
||||
"labelKey": "LabelRequestAddress",
|
||||
"type": "text",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "enable",
|
||||
"label": "Enable",
|
||||
"labelKey": "LabelEnable",
|
||||
"type": "checkbox"
|
||||
}
|
||||
]
|
||||
},
|
||||
"localization": {
|
||||
"en-us": {
|
||||
"ItemExampleAction": "Item Example Action",
|
||||
"LabelApiKey": "API Key",
|
||||
"LabelEnable": "Enable",
|
||||
"ExamplePluginConfiguration": "Example Plugin Configuration",
|
||||
"ExamplePluginConfigurationDescription": "This is an example plugin",
|
||||
"LabelRequestAddress": "Request Address"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue