diff --git a/.gitignore b/.gitignore index adf8f72..67aec72 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,7 @@ # Go workspace file go.work + +# binary outputs +well-goknown +cmd/lnd-verifier/lnd-verifier diff --git a/nostr/nostr.go b/nostr/nostr.go index 7f691e1..aa82b7d 100644 --- a/nostr/nostr.go +++ b/nostr/nostr.go @@ -125,7 +125,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) { tmplt, err := template.ParseFiles("html/nostr_qr_response.html") if err != nil { - l.Error().Msg("unable to parse template") + l.Error().Msg("unable to parse qr response template") w.WriteHeader(http.StatusServiceUnavailable) json.NewEncoder(w).Encode(&jsonErrorMessage{ Error: "service unavailable", @@ -147,6 +147,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) { func GetNostrAddr(w http.ResponseWriter, r *http.Request) { ctx := context.TODO() + l := logger.Get() // get query string for username r.ParseForm() requestedName := r.FormValue("name") @@ -158,6 +159,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) { search := getRkey("verified", requestedName, getHostname(r.Host)) addr, err := redisCli.Get(ctx, search).Result() if err != nil { + l.Info().Msg(fmt.Sprintf("get %s: not found", search)) w.WriteHeader(http.StatusNotFound) json.NewEncoder(w).Encode(&jsonErrorMessage{ Error: "username not registered", @@ -166,6 +168,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) { } dec, err := b64.StdEncoding.DecodeString(addr) if err != nil { + l.Error().Msg(fmt.Sprintf("get %s: unable to decode key", search)) w.WriteHeader(http.StatusInternalServerError) json.NewEncoder(w).Encode(&jsonErrorMessage{ Error: "internal server error", @@ -173,6 +176,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) { return } + l.Info().Msg(fmt.Sprintf("get %s: found and returned", search)) w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(dec)