mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
add plugin settings page
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
|
||||
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.
|
||||
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. The plugin.json file already contains a "mainPluginURL" parameter which currently is not in use.
|
||||
@@ -17,26 +17,17 @@ const path = require( 'path' );
|
||||
class PluginManager {
|
||||
constructor ( settings ) {
|
||||
this.paymentGateway = settings.payments;
|
||||
this.allPlugins = {};
|
||||
this.pluginDetails = {};
|
||||
fs.readdir( path.join( __dirname + '/others' ), ( err, ls ) => {
|
||||
for ( let file in ls ) {
|
||||
const pluginSettings = JSON.parse( fs.readFileSync( path.join( __dirname + '/others/' + ls[ file ] + '/plugin.json' ) ) );
|
||||
this.allPlugins[ ls[ file ] ] = pluginSettings;
|
||||
const pluginDetail = JSON.parse( fs.readFileSync( path.join( __dirname + '/others/' + ls[ file ] + '/plugin.json' ) ) );
|
||||
this.pluginDetails[ ls[ file ] ] = pluginDetail;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
getPlugins () {
|
||||
|
||||
}
|
||||
|
||||
getPluginDetails ( plugin ) {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
fs.readFile( path.join( __dirname + '/others/' + plugin + '/plugin.json' ), ( err, file ) => {
|
||||
if ( err ) reject( err );
|
||||
resolve( file );
|
||||
} );
|
||||
} );
|
||||
return this.pluginDetails;
|
||||
}
|
||||
|
||||
loadPaymentGatewaySettings () {
|
||||
@@ -63,15 +54,14 @@ class PluginManager {
|
||||
} );
|
||||
}
|
||||
|
||||
savePaymentGatewaySettings () {
|
||||
savePaymentGatewaySettings ( settings ) {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
|
||||
fs.writeFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/config.payments.json' ), JSON.stringify( settings ), {}, ( err ) => {
|
||||
if ( err ) reject( err );
|
||||
resolve( 'ok' );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
saveSettings ( plugin, settings ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PluginManager;
|
||||
@@ -6,7 +6,8 @@
|
||||
"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",
|
||||
"settingsURL": "/admin/plugins/newsletter",
|
||||
"mainPluginURL": "/admin/plugins/newsletter",
|
||||
"logo": "",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
@@ -8,5 +8,6 @@
|
||||
"gitURL": "https://github.com/simplePCBuilding/libreevent/tree/master/src/server/backend/plugins/others/poll",
|
||||
"settingsURL": "/admin/plugins/polls/settings",
|
||||
"mainPluginURL": "/polls",
|
||||
"logo": "",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
@@ -8,5 +8,6 @@
|
||||
"gitURL": "",
|
||||
"settingsURL": "",
|
||||
"mainPluginURL": "",
|
||||
"logo": "",
|
||||
"version": ""
|
||||
}
|
||||
Reference in New Issue
Block a user