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){
switch(api.info.type){
case 'call':
try{
socket.unhook(api.name)
}catch(e){
}
socket.hook(api.name, api.info.fn)
break
case 'hook':
const hook = api.info.generator(socket)
hook.bind(this)
try{
socket.unhook(api.name)
}catch(e){
}
socket.hook(api.name, hook)
break
case 'unhook':
try{
socket.unhook(api.name)
}catch(e){
}
socket.hook(api.name, api.info.fn)
break
}