fix
This commit is contained in:
@@ -33,17 +33,12 @@ export default class PluginManagerPlugin extends PluginManager implements Plugin
|
||||
type: 'call'
|
||||
},
|
||||
{
|
||||
name: "getInstalledPlugins",
|
||||
name: "getInstalledPluginNames",
|
||||
visibility: "private",
|
||||
rpc: async() => { return await this.getInstalledPlugins() },
|
||||
rpc: async() => { return await this.getInstalledPluginNames() },
|
||||
type: 'call'
|
||||
},
|
||||
{
|
||||
name: "getLoadedPlugins",
|
||||
visibility: "private",
|
||||
rpc: async () => { return this.getLoadedPlugins() },
|
||||
type: 'call'
|
||||
},{
|
||||
name: "getLoadedPluginNames",
|
||||
visibility: "private",
|
||||
rpc: async () => { return this.getLoadedPluginNames() },
|
||||
@@ -87,12 +82,19 @@ export default class PluginManagerPlugin extends PluginManager implements Plugin
|
||||
visibility: "private",
|
||||
rpc: async(conf) => { return this.downloadPlugin(conf) },
|
||||
type: 'call'
|
||||
},{
|
||||
name: "getConfig",
|
||||
visibility: "private",
|
||||
rpc: async() => { return this.conf },
|
||||
type: 'call'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async start(): Promise<void> {
|
||||
|
||||
await Promise.all(this.getInstalledPluginNames().map(name => {
|
||||
return this.loadPlugin(name)
|
||||
}));
|
||||
}
|
||||
|
||||
stop(): void {
|
||||
|
||||
@@ -78,7 +78,7 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
|
||||
]
|
||||
}
|
||||
|
||||
public getInstalledPlugins():string[] {
|
||||
public getInstalledPluginNames():string[] {
|
||||
try {
|
||||
const installed = fs.readdirSync(this.conf.installDir)
|
||||
return installed.filter( entry => entry[0] != '.')
|
||||
@@ -93,6 +93,7 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
|
||||
}
|
||||
|
||||
public getLoadedPlugins(): PluginMap {
|
||||
//logger.debug(this.loadedPlugins)
|
||||
return this.loadedPlugins
|
||||
}
|
||||
|
||||
@@ -186,7 +187,7 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
|
||||
try {
|
||||
let version = await this.getLatestVersion(pluginName)
|
||||
|
||||
if(this.conf[pluginName] == null || version != this.conf[pluginName]!["installed"]){
|
||||
if(this.conf[pluginName] == null || version != this.conf[pluginName]!["installed"].raw){
|
||||
await this.downloadPlugin(pluginName)
|
||||
this.extractPlugin(pluginName)
|
||||
}
|
||||
@@ -222,7 +223,7 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
|
||||
if(pluginName === this.name) pluginName = "admin"
|
||||
const pth = path.join("..", "..", this.conf.installDir, pluginName)
|
||||
logger.info("Loading frontend plugin from fs", path.join(__dirname,pth,"FrontendPlugin.js"))
|
||||
return fs.readFileSync(path.join(__dirname, pth,"FrontendPlugin.js"))
|
||||
return fs.readFileSync(path.join(__dirname, pth,"FrontendPlugin.js")).toString()
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user