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