Some more cleanup, move html into its own dir
This commit is contained in:
parent
f014dffad9
commit
ebbe258b0a
3 changed files with 12 additions and 5 deletions
11
lnd/lnd.go
11
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
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue