improve example plugin
This commit is contained in:
parent
64ed506baf
commit
d3207daf2b
1 changed files with 54 additions and 1 deletions
|
@ -1,9 +1,62 @@
|
||||||
|
const express = require('express')
|
||||||
|
const myPluginRouter = express.Router()
|
||||||
|
|
||||||
|
// this will answer at http://localhost:13120/api/plugin/Example/test
|
||||||
|
myPluginRouter.get('/test', (req, res) => {
|
||||||
|
return res.json('OK!')
|
||||||
|
})
|
||||||
|
|
||||||
const plugin = {
|
const plugin = {
|
||||||
|
routeAPI: myPluginRouter,
|
||||||
|
configuration: {
|
||||||
|
name: 'Example',
|
||||||
|
author: 'lesion',
|
||||||
|
url: 'https://framagit.org/les/gancio',
|
||||||
|
description: 'Example plugin',
|
||||||
|
settings: {
|
||||||
|
my_plugin_string_setting: {
|
||||||
|
type: 'TEXT',
|
||||||
|
description: 'My plugin string setting',
|
||||||
|
required: true,
|
||||||
|
hint: 'My plugin setting support <strong>html too</strong>'
|
||||||
|
},
|
||||||
|
enable_this_feature_in_my_plugin: {
|
||||||
|
type: 'CHECK',
|
||||||
|
description: 'My plugin best feature',
|
||||||
|
required: true,
|
||||||
|
hint: 'This feature is super dupe, enable it!'
|
||||||
|
},
|
||||||
|
min_post: {
|
||||||
|
type: 'NUMBER',
|
||||||
|
description: 'it supports number too'
|
||||||
|
},
|
||||||
|
my_default_language: {
|
||||||
|
description: 'My default language',
|
||||||
|
type: 'LIST',
|
||||||
|
items: ['it', 'en', 'fr']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
gancio: null,
|
gancio: null,
|
||||||
load (gancio) {
|
settings: null,
|
||||||
|
load (gancio, settings) {
|
||||||
console.error('Plugin GancioPluginExample loaded!')
|
console.error('Plugin GancioPluginExample loaded!')
|
||||||
|
console.error('Your settings are in ', settings)
|
||||||
|
console.error(`For example, you can access to your default language setting by using ${settings.my_default_language}`)
|
||||||
plugin.gancio = gancio
|
plugin.gancio = gancio
|
||||||
|
plugin.settings = settings
|
||||||
|
|
||||||
|
// gancio.db.models.event.findAll({ where: })
|
||||||
|
// gancio.db.query('CREATE TABLE IF NOT EXISTS ()... ')
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
unload () {
|
||||||
|
console.error('Unload this plugin!')
|
||||||
|
},
|
||||||
|
|
||||||
|
onTest () {
|
||||||
|
console.error('called on "TEST" button pressed in admin interface')
|
||||||
},
|
},
|
||||||
|
|
||||||
onEventCreate (event) {
|
onEventCreate (event) {
|
||||||
|
|
Loading…
Reference in a new issue