mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 21:34:24 +00:00
various fixes
This commit is contained in:
@@ -11,11 +11,45 @@
|
||||
This is the plugin manager. It is responsible for installing, updating and uninstalling plugins.
|
||||
*/
|
||||
|
||||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
class PluginManager {
|
||||
constructor () {}
|
||||
constructor ( settings ) {
|
||||
this.paymentGateway = settings.payments;
|
||||
this.allPlugins = {};
|
||||
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;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
loadSettings ( plugin ) {
|
||||
getPlugins () {
|
||||
|
||||
}
|
||||
|
||||
getPluginDetails ( plugin ) {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
fs.readFile( path.join( __dirname + '/others/' + plugin + '/plugin.json' ), ( err, file ) => {
|
||||
resolve( file );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
loadPaymentGatewaySettings () {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
fs.readFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/configOptions.json' ), ( err, options ) => {
|
||||
fs.readFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/config.payments.json' ), ( err, config ) => {
|
||||
let f = options;
|
||||
for ( let s in f ) {
|
||||
f[ s ][ 'value' ] = config[ s ];
|
||||
}
|
||||
resolve( f );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
saveSettings ( plugin, settings ) {
|
||||
|
||||
Reference in New Issue
Block a user