This commit is contained in:
peter
2019-08-04 01:24:25 +02:00
parent 6aae2146e9
commit 79b15b98de
3 changed files with 16 additions and 2 deletions
+15
View File
@@ -122,14 +122,29 @@ export class FrontblockAdmin extends ConfigLoader<AdminConf>{
for(const api of rpcInfos){ for(const api of rpcInfos){
switch(api.info.type){ switch(api.info.type){
case 'call': case 'call':
try{
socket.unhook(api.name)
}catch(e){
}
socket.hook(api.name, api.info.fn) socket.hook(api.name, api.info.fn)
break break
case 'hook': case 'hook':
const hook = api.info.generator(socket) const hook = api.info.generator(socket)
hook.bind(this) hook.bind(this)
try{
socket.unhook(api.name)
}catch(e){
}
socket.hook(api.name, hook) socket.hook(api.name, hook)
break break
case 'unhook': case 'unhook':
try{
socket.unhook(api.name)
}catch(e){
}
socket.hook(api.name, api.info.fn) socket.hook(api.name, api.info.fn)
break break
} }
+1 -1
View File
@@ -96,6 +96,6 @@ export default class PluginManagerPlugin extends PluginManager implements Plugin
} }
stop(): void { stop(): void {
throw new Error("Method not implemented.");
} }
} }
@@ -113,7 +113,6 @@ export default class PluginManager extends ConfigLoader<PluginManagerConfig&Plug
} }
private async getLatestRelease(pluginName:string):Promise<any>{ private async getLatestRelease(pluginName:string):Promise<any>{
logger.info("Downloading Plugin", pluginName, "from", this.conf.resourceLocation + pluginName + '/releases')
if(pluginName === this.name) pluginName = "admin" if(pluginName === this.name) pluginName = "admin"
const response = await fetch(this.conf.resourceLocation + pluginName + '/releases') const response = await fetch(this.conf.resourceLocation + pluginName + '/releases')
if (!response.ok) throw new Error(pluginName+": "+response.statusText) if (!response.ok) throw new Error(pluginName+": "+response.statusText)