This commit is contained in:
Daniel Hübleitner
2019-09-18 02:11:22 +02:00
parent 741c253202
commit 2f32d7c9cd
+6 -6
View File
@@ -224,9 +224,9 @@ export class RPCSocketServer{
socket.on('error', this.conf.errorHandler(socket))
socket.on('close', this.conf.closeHandler(socket))
if(this.visibility === "127.0.0.1")
this.initApis(socket)
this.initRPCs(socket)
else
this.initPublicApis(socket)
this.initPublicRPCs(socket)
})
this.wsServer.listen(this.port, this.visibility)
}catch(e){
@@ -235,8 +235,8 @@ export class RPCSocketServer{
}
}
protected initApis(socket:Socket){
const adminRPCs:socketioRPC[] = [
protected initRPCs(socket:Socket){
const infoRPC:socketioRPC[] = [
{
name: 'info',
type: 'call',
@@ -245,12 +245,12 @@ export class RPCSocketServer{
]
const rpcInfos:ExtendedRpcInfo[] = [
...rpcHooker(socket, "Admin", adminRPCs, false),
...rpcHooker(socket, "RPC", infoRPC, false),
...this.rpcExporters.flatMap(exporter => rpcHooker(socket, exporter.name, [...exporter.exportPublicRPCs(), ...exporter.exportRPCs()]))
]
}
protected initPublicApis(socket:Socket){
protected initPublicRPCs(socket:Socket){
const adminRPCs:socketioRPC[] = [
{
name: 'info',