Also show lightning address

This commit is contained in:
ekzyis 2025-01-03 20:30:52 +01:00
parent a5a6a1711a
commit 0393817939
3 changed files with 15 additions and 6 deletions

View File

@ -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) {
<html>
<head>
<meta charset="UTF-8">
@ -29,8 +29,11 @@ templ Overlay(lnurl string) {
})
</script>
<div class="bg-white fixed bottom-0 left-0 text-center p-3">
<img src={ "data:image/jpeg;base64," + qrEncode(lnurl) }/>
<div>scan to zap message</div>
<div class="p-2">
<div class="font-bold">{ lnaddr }</div>
<img src={ "data:image/jpeg;base64," + qrEncode(lnurl) }/>
</div>
<div class="italic">zap us a message!</div>
</div>
</body>
</html>

View File

@ -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))
}
}

View File

@ -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()))