khatru: hodlbod's nip86 fixes.

This commit is contained in:
fiatjaf
2025-06-10 16:01:37 -03:00
parent cc6ec3af73
commit 50a753504d

View File

@@ -124,13 +124,18 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) {
methods := make([]string, 0, mat.NumField()) methods := make([]string, 0, mat.NumField())
for i := 0; i < mat.NumField(); i++ { for i := 0; i < mat.NumField(); i++ {
field := mat.Field(i) field := mat.Field(i)
value := mav.Field(i).Interface()
// danger: this assumes the struct fields are appropriately named // danger: this assumes the struct fields are appropriately named
methodName := strings.ToLower(field.Name) methodName := strings.ToLower(field.Name)
if methodName == "rejectapicall" {
continue
}
// assign this only if the function was defined // assign this only if the function was defined
if mav.Field(i).Interface() != nil { if !reflect.ValueOf(value).IsNil() {
methods[i] = methodName methods = append(methods, methodName)
} }
} }
resp.Result = methods resp.Result = methods