stuff
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
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] = this
|
||||
}
|
||||
|
||||
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: "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<void> {
|
||||
await this.installPlugin("admin") //self-update
|
||||
}
|
||||
|
||||
stop(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user