mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
add plugin loader
This commit is contained in:
5
src/server/backend/plugins/README.md
Normal file
5
src/server/backend/plugins/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Plugins
|
||||
|
||||
If you want to create a new plugin for libreevent, please follow our guide and guidelines in the official documentation [here](https://libreevent.janishutz.com/docs/contributing/plugins)
|
||||
|
||||
Each plugin should have a plugin.json file that uses the layout of the plugin.json file in this directory. As future libreevent might change what is required by the plugin.json file, please follow this repository to get news when this is about to happen. To retain backwards compatibility, we will for as long as possible not remove anything from the plugin.json files as possible, which means you can already update your plugin.json file before the next version of libreevent is released.
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* libreevent - newsletterRoutes.js
|
||||
*
|
||||
* Created by Janis Hutz 08/13/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = ( app, settings ) => {};
|
||||
12
src/server/backend/plugins/others/newsletter/plugin.json
Normal file
12
src/server/backend/plugins/others/newsletter/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"pluginName": "Newsletter",
|
||||
"pluginDescription": "Send newsletters to your customers using a file editor",
|
||||
"creator": "Janis Hutz",
|
||||
"maintainer": "Janis Hutz",
|
||||
"pluginWebsite": "https://libreevent.janishutz.com/plugins/newsletter",
|
||||
"pluginDocs": "https://libreevent.janishutz.com/docs/plugins/newsletter",
|
||||
"gitURL": "https://github.com/simplePCBuilding/libreevent/tree/master/src/server/backend/plugins/others/newsletter",
|
||||
"settingsURL": "/admin/plugins/newsletter/settings",
|
||||
"mainPluginURL": "/admin/plugins/newsletter",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
12
src/server/backend/plugins/others/poll/plugin.json
Normal file
12
src/server/backend/plugins/others/poll/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"pluginName": "Polls",
|
||||
"pluginDescription": "Create polls to ask the customers questions about your event!",
|
||||
"creator": "Janis Hutz",
|
||||
"maintainer": "Janis Hutz",
|
||||
"pluginWebsite": "https://libreevent.janishutz.com/plugins/polls",
|
||||
"pluginDocs": "https://libreevent.janishutz.com/docs/plugins/polls",
|
||||
"gitURL": "https://github.com/simplePCBuilding/libreevent/tree/master/src/server/backend/plugins/others/poll",
|
||||
"settingsURL": "/admin/plugins/polls/settings",
|
||||
"mainPluginURL": "/polls",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
12
src/server/backend/plugins/others/poll/pollRoutes.js
Normal file
12
src/server/backend/plugins/others/poll/pollRoutes.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* libreevent - pollRoutes.js
|
||||
*
|
||||
* Created by Janis Hutz 08/13/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = ( app, settings ) => {
|
||||
|
||||
};
|
||||
@@ -13,10 +13,6 @@ The express.js routes it has to expose are the following:
|
||||
|
||||
It can contain any number of (not interfering) routes. Please always use the /payments/ route as a base to avoid running into problems.
|
||||
|
||||
|
||||
## The plugin.json file
|
||||
The plugin.json file should look as follows:
|
||||
|
||||
## configOption.json
|
||||
This file contains the settings that should be available in the settings page of libreevent. It should contain the following fields, as required by the settings.vue module.
|
||||
|
||||
|
||||
12
src/server/backend/plugins/plugin.json
Normal file
12
src/server/backend/plugins/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"pluginName": "",
|
||||
"pluginDescription": "",
|
||||
"creator": "",
|
||||
"maintainer": "",
|
||||
"pluginWebsite": "",
|
||||
"pluginDocs": "",
|
||||
"gitURL": "",
|
||||
"settingsURL": "",
|
||||
"mainPluginURL": "",
|
||||
"version": ""
|
||||
}
|
||||
23
src/server/backend/plugins/pluginLoader.js
Normal file
23
src/server/backend/plugins/pluginLoader.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* libreevent - pluginLoader.js
|
||||
*
|
||||
* Created by Janis Hutz 08/13/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
module.exports = ( app, settings ) => {
|
||||
let otherPlugins = fs.readdirSync( path.join( __dirname + '/others' ) );
|
||||
console.log( '\n\n' );
|
||||
for ( let plugin in otherPlugins ) {
|
||||
console.log( '[ Plugin Loader ] Loaded plugin "' + otherPlugins[ plugin ] + '"' );
|
||||
require( './others/' + otherPlugins[ plugin ] + '/' + otherPlugins[ plugin ] + 'Routes.js' )( app, settings );
|
||||
}
|
||||
|
||||
require( './payments/' + settings.payments + '/' + settings.payments + 'Routes.js' )( app, settings );
|
||||
console.log( '[ Plugin Loader ] Loaded ' + settings.payments + ' as payment gateway' );
|
||||
};
|
||||
Reference in New Issue
Block a user