From ebbe258b0a49c791e79b028693a5b1fc0f50329b Mon Sep 17 00:00:00 2001 From: Asara Date: Sat, 4 Feb 2023 19:11:50 -0500 Subject: [PATCH] Some more cleanup, move html into its own dir --- nostr/form.html => html/nostr_form.html | 0 lnd/lnd.go | 11 +++++++++-- nostr/nostr.go | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) rename nostr/form.html => html/nostr_form.html (100%) diff --git a/nostr/form.html b/html/nostr_form.html similarity index 100% rename from nostr/form.html rename to html/nostr_form.html diff --git a/lnd/lnd.go b/lnd/lnd.go index 53ca8df..1870069 100644 --- a/lnd/lnd.go +++ b/lnd/lnd.go @@ -1,8 +1,15 @@ package lnd -import "github.com/davecgh/go-spew/spew" +import ( + "github.com/davecgh/go-spew/spew" +) -func Request(request []byte) (string, int, error) { +func Request(rKey string, request []byte) (string, int, error) { + //redis, err := redis.New("localhost:6379", "", redis.LndDb) + //if err != nil { + // return "", 0, errors.New("Failed to connect to redis") + //} + spew.Dump(rKey) spew.Dump(request) return "x", 1, nil } diff --git a/nostr/nostr.go b/nostr/nostr.go index 81d2e95..cc953f7 100644 --- a/nostr/nostr.go +++ b/nostr/nostr.go @@ -28,7 +28,7 @@ type NostrRequest struct { func RequestNostrAddr(w http.ResponseWriter, r *http.Request) { switch r.Method { case "GET": - http.ServeFile(w, r, "nostr/form.html") + http.ServeFile(w, r, "html/nostr_form.html") case "POST": r.ParseForm() rKey := getRkey(r.FormValue("Name"), getHostname(r.Host)) @@ -66,7 +66,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) { jsonUser, _ := json.Marshal(user) // generate the payment request - paymentReq, exp, err := lnd.Request(jsonUser) + paymentReq, exp, err := lnd.Request(rKey, jsonUser) if err != nil { w.WriteHeader(http.StatusServiceUnavailable) return @@ -122,7 +122,7 @@ func AddNostrAddr(n NostrRequest) { r, err := redis.New("localhost:6379", "", redis.NostrDb) if err != nil { - fmt.Println("FAILED") + fmt.Println("Failed to connect to redis") } nameKey := getRkey(n.Name, n.Hostname) err = r.Client.Set(nameKey, jsonUser, redis.NostrDb).Err()