From 03938179397caeb6dadbddd2c290581db633631a Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 3 Jan 2025 20:30:52 +0100 Subject: [PATCH] Also show lightning address --- pages/overlay.templ | 9 ++++++--- pages/render.go | 4 ++-- server/server.go | 8 +++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pages/overlay.templ b/pages/overlay.templ index 280ea44..c1c0a94 100644 --- a/pages/overlay.templ +++ b/pages/overlay.templ @@ -3,7 +3,7 @@ package pages import "github.com/skip2/go-qrcode" import "encoding/base64" -templ Overlay(lnurl string) { +templ Overlay(lnurl string, lnaddr string) { @@ -29,8 +29,11 @@ templ Overlay(lnurl string) { })
- -
scan to zap message
+
+
{ lnaddr }
+ +
+
zap us a message!
diff --git a/pages/render.go b/pages/render.go index d61bb35..735e36a 100644 --- a/pages/render.go +++ b/pages/render.go @@ -27,9 +27,9 @@ func GetEnv(ctx context.Context) string { return "development" } -func OverlayHandler(lnurl string) echo.HandlerFunc { +func OverlayHandler(lnurl string, lnaddr string) echo.HandlerFunc { return func(c echo.Context) error { - return render(c, http.StatusOK, Overlay(lnurl)) + return render(c, http.StatusOK, Overlay(lnurl, lnaddr)) } } diff --git a/server/server.go b/server/server.go index a4fe4ba..f294016 100644 --- a/server/server.go +++ b/server/server.go @@ -27,6 +27,11 @@ func NewServer() *Server { CustomTimeFormat: "2006-01-02 15:04:05.00000-0700", })) + u, err := url.Parse(env.PublicUrl) + if err != nil { + log.Fatal(err) + } + webhookPath := "/overlay/webhook" webhookUrl, err := url.JoinPath(env.PublicUrl, webhookPath) if err != nil { @@ -46,7 +51,8 @@ func NewServer() *Server { s.Static("/", "public/") s.GET("/overlay", pages.OverlayHandler( - lnurl.Encode(fmt.Sprintf("%s/.well-known/lnurlp/%s", env.PublicUrl, "SNL")), + lnurl.Encode(fmt.Sprintf("%s/.well-known/lnurlp/%s", env.PublicUrl, "snl")), + fmt.Sprintf("%s@%s", "snl", u.Host), )) s.GET("/overlay/sse", sseHandler(p.IncomingPayments()))