1
1
mirror of https://github.com/bumi/lntip synced 2026-02-16 14:07:51 +00:00

3 Commits
1.5.0 ... 1.5.1

Author SHA1 Message Date
ae9f643fbf go fmt 2022-05-07 12:50:15 +02:00
5fd10bc647 Add icon assets 2022-05-07 11:36:42 +02:00
5d2c9cd639 Fix: use correct header to get the original request host
Proxy servers can set the X-Forwarded-Host and X-Forwarded-Proto headers to pass on the original host and protocol.
We should also support the Forwarded header (which combines this in one header described in RFC7239 - but seems echo does not support parsing that one?)
2022-05-06 20:30:35 +02:00
3 changed files with 8 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 KiB

11
lnme.go
View File

@@ -152,8 +152,13 @@ func main() {
if !cfg.Bool("disable-ln-address") {
lnurlHandler := func(c echo.Context) error {
host := c.Request().Host
if c.Request().Header.Get(echo.HeaderXForwardedFor) != "" {
host = c.Request().Header.Get(echo.HeaderXForwardedFor)
proto := c.Scheme()
// TODO: support RFC7239 Forwarded header
if c.Request().Header.Get("X-Forwarded-Host") != "" {
host = c.Request().Header.Get("X-Forwarded-Host")
}
if c.Request().Header.Get("X-Forwarded-Proto") != "" {
proto = c.Request().Header.Get("X-Forwarded-Proto")
}
name := c.Param("name")
lightningAddress := name + "@" + host
@@ -162,7 +167,7 @@ func main() {
if amount := c.QueryParam("amount"); amount == "" {
lnurlPayResponse1 := lnurl.LNURLPayResponse1{
LNURLResponse: lnurl.LNURLResponse{Status: "OK"},
Callback: fmt.Sprintf("%s://%s%s", c.Scheme(), host, c.Request().URL.Path),
Callback: fmt.Sprintf("%s://%s%s", proto, host, c.Request().URL.Path),
MinSendable: 1000,
MaxSendable: 100000000,
EncodedMetadata: lnurlMetadata,