fix sesamefilter default

This commit is contained in:
2020-03-05 18:48:39 +01:00
parent 42c2d4d3ec
commit bb94b1c405
3 changed files with 20 additions and 40 deletions
+7 -2
View File
@@ -38,14 +38,19 @@ export class RPCServer<
private exporters: Exporters<InterfaceT, SubResType> = [],
conf: T.ServerConf<InterfaceT, SubResType> = {}
){
if(!conf.visibility) this.visibility = "127.0.0.1"
if(!conf.visibility) this.visibility = "0.0.0.0"
this.accessFilter = conf.accessFilter || (async () => true)
if(conf.sesame){
this.sesame = U.makeSesameFunction(conf.sesame)
}
this.accessFilter = conf.accessFilter || (async (sesame) => {
if(!this.sesame) return true
return this.sesame!(sesame!)
})
this.errorHandler = (socket:I.Socket) => (error:any, rpcName:string, args: any[]) => {
if(conf.errorHandler) conf.errorHandler(socket, error, rpcName, args)
else throw error