prs help, why is it dying on me
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
import * as Logger from 'log4js'
|
||||
import { Plugin, socketioRPC } from 'frontblock-generic/Plugin';
|
||||
import { ErrorResponse, SuccessResponse } from 'frontblock-generic/Types';
|
||||
import { FrontblockApiConf } from "frontblock/FrontblockApiClient"
|
||||
//import { FrontblockApiConf } from "frontblock/FrontblockApiClient"
|
||||
import {PluginManager} from "live-plugin-manager";
|
||||
|
||||
type pluginEntry = {pluginPath:string, conf?:any}
|
||||
type pluginEntry = {pluginName:string}
|
||||
const pluginList:pluginEntry[] = [
|
||||
{pluginName: 'frontblock'}
|
||||
//{ pluginPath: '../../paymentmanager/static/Plugin', conf:<FrontblockApiConf>{ apiHost: 'localhost' /*/ 'api.testnet.frontblock.me' */, apiPort: 10001 } },
|
||||
//{ pluginPath: '../../htmlsupplier/static/Plugin' },
|
||||
{ pluginPath: 'frontblock/FrontblockApiClient', conf:<FrontblockApiConf>{ apiHost: /*/ 'localhost' */ 'api.testnet.frontblock.me' , apiPort: 10001 } }
|
||||
// { pluginPath: 'frontblock/FrontblockApiClient', conf:<FrontblockApiConf>{ apiHost: /*/ 'localhost' */ 'api.testnet.frontblock.me' , apiPort: 10001 } }
|
||||
]
|
||||
|
||||
const express = require('express')
|
||||
@@ -27,6 +29,8 @@ Logger.configure({
|
||||
})
|
||||
const logger = Logger.getLogger("admin")
|
||||
|
||||
const manager = new PluginManager();
|
||||
|
||||
type hookRPC = { type: 'hook', generator: (socket) => Function, unhook:(uid:string)=>Promise<ErrorResponse|SuccessResponse>}
|
||||
type unhookRPC = { type: 'unhook', fn: Function}
|
||||
type callRPC = { type: 'call', fn: Function}
|
||||
@@ -74,11 +78,19 @@ export class FrontblockAdmin{
|
||||
|
||||
private async loadPlugins(){
|
||||
this.plugins = []
|
||||
|
||||
pluginList.forEach(async (entry:pluginEntry) => {
|
||||
const clazz = await import(entry.pluginPath)
|
||||
let obj = new clazz.default(entry.conf)
|
||||
this.plugins.push(obj)
|
||||
|
||||
logger.info("installing plugin " + entry.pluginName)
|
||||
const info = await manager.installFromNpm(entry.pluginName);
|
||||
|
||||
logger.info("loading plugin " + info)
|
||||
const clazz = manager.require(entry.pluginName);
|
||||
|
||||
//let obj = new clazz.default(entry.conf)
|
||||
//this.plugins.push(obj)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private initApis(socket){
|
||||
|
||||
Reference in New Issue
Block a user