import { default as PluginManager } from "./PluginManager"; import { Plugin } from "frontblock-generic/Plugin"; import * as Logger from 'log4js'; Logger.configure({ appenders: { "PluginManager/Plugin": { type: 'stdout' }, //app: { type: 'file', filename: 'application.log' } }, categories: { default: { appenders: [ 'PluginManager/Plugin' ], level: 'debug' } } }) const logger = Logger.getLogger("PluginManager/Plugin") export class PluginManagerPlugin extends PluginManager implements Plugin{ name: string; constructor(){ super() this.loadedPlugins[this.name] = {backend:this, frontend: this.loadFrontend(this.name)} } exportRPCs(): import("frontblock-generic/Plugin").socketioRPC[] { return [ { name: "getAvailablePluginNames", visibility: "private", rpc: async() => { return await this.getAvailablePluginNames() }, type: 'call' }, { name: "getInstalledPlugins", visibility: "private", rpc: async() => { return await this.getInstalledPlugins() }, type: 'call' }, { name: "getLoadedPlugins", visibility: "private", rpc: async () => { return this.getLoadedPlugins() }, type: 'call' },{ name: "getLoadedPluginNames", visibility: "private", rpc: async () => { return this.getLoadedPluginNames() }, type: 'call' },{ name: "installPlugin", visibility: "private", rpc: async(pluginName:string) => { return await this.installPlugin(pluginName) }, type: 'call' }, { name: "uninstallPlugin", visibility: "private", rpc: async(pluginName:string) => { return await this.uninstallPlugin(pluginName) }, type: 'call' }, { name: "loadPlugin", visibility: "private", rpc: async(pluginName:string) => { return await this.loadPlugin(pluginName) }, type: 'call' }, { name: "unloadPlugin", visibility: "private", rpc: async(pluginName:string) => { return this.unloadPlugin(pluginName) }, type: 'call' }, { name: "updateConfig", visibility: "private", rpc: async(conf) => { return this.updateConfig(conf) }, type: 'call' } ] } async start(): Promise { await this.installPlugin("admin") //self-update } stop(): void { throw new Error("Method not implemented."); } }