From 50a753504d118fcbfdc425c368995d791ac86bde Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 10 Jun 2025 16:01:37 -0300 Subject: [PATCH] khatru: hodlbod's nip86 fixes. --- khatru/nip86.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/khatru/nip86.go b/khatru/nip86.go index f61a721..7951f38 100644 --- a/khatru/nip86.go +++ b/khatru/nip86.go @@ -124,13 +124,18 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) { methods := make([]string, 0, mat.NumField()) for i := 0; i < mat.NumField(); i++ { field := mat.Field(i) + value := mav.Field(i).Interface() // danger: this assumes the struct fields are appropriately named methodName := strings.ToLower(field.Name) + if methodName == "rejectapicall" { + continue + } + // assign this only if the function was defined - if mav.Field(i).Interface() != nil { - methods[i] = methodName + if !reflect.ValueOf(value).IsNil() { + methods = append(methods, methodName) } } resp.Result = methods