Compare commits
No commits in common. "db408ecbde0db4712b1adcfe04350a1ae031db74" and "56236d54093f12790374fc80b86727bbba5475f9" have entirely different histories.
db408ecbde
...
56236d5409
1
go.mod
1
go.mod
@ -11,7 +11,6 @@ require (
|
|||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/namsral/flag v1.7.4-pre // indirect
|
github.com/namsral/flag v1.7.4-pre // indirect
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
golang.org/x/crypto v0.31.0 // indirect
|
golang.org/x/crypto v0.31.0 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -34,8 +34,6 @@ github.com/namsral/flag v1.7.4-pre/go.mod h1:OXldTctbM6SWH1K899kPZcf65KxJiD7Msce
|
|||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||||
|
@ -132,7 +132,7 @@ func (p *Phoenixd) GetInvoice(paymentHash string) (*lightning.Invoice, error) {
|
|||||||
var response struct {
|
var response struct {
|
||||||
PaymentHash string `json:"paymentHash"`
|
PaymentHash string `json:"paymentHash"`
|
||||||
Preimage string `json:"preimage"`
|
Preimage string `json:"preimage"`
|
||||||
Sats int64 `json:"receivedSat"`
|
Msats int64 `json:"receivedSat"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
CreatedAt int64 `json:"createdAt"`
|
CreatedAt int64 `json:"createdAt"`
|
||||||
ConfirmedAt int64 `json:"completedAt"`
|
ConfirmedAt int64 `json:"completedAt"`
|
||||||
@ -150,7 +150,7 @@ func (p *Phoenixd) GetInvoice(paymentHash string) (*lightning.Invoice, error) {
|
|||||||
return &lightning.Invoice{
|
return &lightning.Invoice{
|
||||||
PaymentHash: response.PaymentHash,
|
PaymentHash: response.PaymentHash,
|
||||||
Preimage: response.Preimage,
|
Preimage: response.Preimage,
|
||||||
Msats: response.Sats * 1_000,
|
Msats: response.Msats,
|
||||||
Description: response.Description,
|
Description: response.Description,
|
||||||
CreatedAt: createdAt,
|
CreatedAt: createdAt,
|
||||||
ConfirmedAt: confirmedAt,
|
ConfirmedAt: confirmedAt,
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package pages
|
package pages
|
||||||
|
|
||||||
import "github.com/skip2/go-qrcode"
|
templ Overlay() {
|
||||||
import "encoding/base64"
|
|
||||||
|
|
||||||
templ Overlay(lnurl string) {
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
@ -28,17 +25,6 @@ templ Overlay(lnurl string) {
|
|||||||
}, 60_000)
|
}, 60_000)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<div class="fixed bottom-0 left-0">
|
|
||||||
<img src={ "data:image/jpeg;base64," + qrEncode(lnurl) }/>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
}
|
}
|
||||||
|
|
||||||
func qrEncode(value string) string {
|
|
||||||
png, err := qrcode.Encode(value, qrcode.Medium, 256)
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return base64.StdEncoding.EncodeToString([]byte(png))
|
|
||||||
}
|
|
||||||
|
@ -27,10 +27,8 @@ func GetEnv(ctx context.Context) string {
|
|||||||
return "development"
|
return "development"
|
||||||
}
|
}
|
||||||
|
|
||||||
func OverlayHandler(lnurl string) echo.HandlerFunc {
|
func OverlayHandler(c echo.Context) error {
|
||||||
return func(c echo.Context) error {
|
return render(c, http.StatusOK, Overlay())
|
||||||
return render(c, http.StatusOK, Overlay(lnurl))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func render(ctx echo.Context, statusCode int, t templ.Component) error {
|
func render(ctx echo.Context, statusCode int, t templ.Component) error {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
@ -45,9 +44,7 @@ func NewServer() *Server {
|
|||||||
|
|
||||||
s.Static("/", "public/")
|
s.Static("/", "public/")
|
||||||
|
|
||||||
s.GET("/overlay", pages.OverlayHandler(
|
s.GET("/overlay", pages.OverlayHandler)
|
||||||
lnurl.Encode(fmt.Sprintf("%s/.well-known/lnurlp/%s", env.PublicUrl, "SNL")),
|
|
||||||
))
|
|
||||||
s.GET("/overlay/sse", sseHandler(p.IncomingPayments()))
|
s.GET("/overlay/sse", sseHandler(p.IncomingPayments()))
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user