1
1
mirror of https://github.com/bumi/lntip synced 2026-02-17 14:37:50 +00:00

15 Commits
1.3.0 ... 1.4.0

Author SHA1 Message Date
6b7ab33efe Update FUNDING.yml 2021-10-25 11:24:02 +02:00
36d4dec5fd Merge pull request #22 from bumi/lnurl-logging
Better error logging for the LNURL endpoint
2021-10-25 11:00:55 +02:00
0fd121d130 Merge pull request #23 from bumi/feature/nicer-lnurlp-urls
Nicer LNURLp URLs
2021-10-25 10:59:43 +02:00
9ae6153d47 Nicer LNURLp URLs
this also registers a shorter lnurlp that can be used additionally to the lightning address
2021-10-24 11:44:05 +02:00
3b7ac31615 Better error logging for the LNURL endpoint
This checks for errors when creating the invoice and logs the error and returns an LNURL error response.
Before it would return a blank pr.
2021-10-24 11:32:00 +02:00
22bc75d564 Merge pull request #20 from GlenCooper/patch-1
Fix typo in README.md
2021-10-15 12:46:08 +02:00
Glen Cooper
2bcd2fd96f Fix typo in README.md
Settigns -> Settings
2021-10-15 02:56:50 +00:00
9ec4db5144 Create LICENSE 2021-10-14 23:43:18 +02:00
4a4614d8fb Merge pull request #18 from crc32/patch-2
Add Tor support for Heroku
2021-10-13 20:50:34 +02:00
Colin Crossman
00b33e3bd9 Update README.md with additional Heroku info
Add a statement about the non-standard Tor buildpack, along with instructions to remove. Also add a pointer to the Heroku page describing the method to link the app to a personal domain.
2021-10-13 12:26:07 -06:00
Colin Crossman
109fa20593 Merge branch 'bumi:master' into patch-2 2021-10-13 12:16:32 -06:00
24cdca056f Merge pull request #19 from crc32/master
Update README.md for clarity
2021-10-13 13:24:12 +02:00
Colin Crossman
03117dc326 Update README.md for clarity
It was unclear how to get the HEX of the TLS cert. Initially I had been trying to use openssl to export the hex of the signature, which was wrong. I finally realized that the xxd command was intended to be applied on the entire tls.cert file, and that worked. So I added this to clarify that aspect.
2021-10-12 20:27:11 -06:00
Colin Crossman
1fe4dd3dd6 Update app.json for Tor on Heroku
Add heroku buildpack for Tor integration
2021-10-12 18:06:20 -06:00
Colin Crossman
5dd2c2cdb5 Update app.json
For Heroku, add the Tor buildpack to allow for Tor connections.
2021-10-08 22:33:55 -06:00
5 changed files with 46 additions and 4 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1 +1 @@
custom: https://ln.michaelbumann.com?lightning=lnurlp:ln.michaelbumann.com/.well-known/lnurlp/sats
custom: https://ln.michaelbumann.com?lightning=lnurlp:ln.michaelbumann.com/lnurlp/github

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Michael Bumann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -114,10 +114,21 @@ One click deployment with Heroku:
You will need your LND address, the LND tls certificate (HEX) and the macaroon (HEX).
When getting the HEX of the TLS certificate, use `xxd -plain tls.cert | tr -d '\n'`. The TLS cert is located in the lnd directory:
* ~/umbrel/lnd/tls.cert on Umbrel
* /mnt/hdd/lnd/tls.cert on Raspiblitz
* Can also be located in ~/.lnd
[![Deploy on Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/bumi/lnme)
Here is a [Video Demo of the Heroku deployment](https://www.youtube.com/watch?v=hSFXhnLp_Rc)
In order to run Tor on Heroku, the Heroku deployment includes a non-official buildpack: https://github.com/iamashks/heroku-buildpack-tor-proxy
This buildpack can be disabled and removed if not needed or desired, through the Settings tab on the Heroku dashboard, or by editing app.json and removing the buildpack.
Lastly, using the Heroku deployment, you can link the app to your own domain by following the directions here: https://help.heroku.com/MTG1BIA7/how-do-i-connect-a-domain-to-my-heroku-app
### Deployment Notes
To run LnMe as systemd service have a look at the [systemd service example config](https://github.com/bumi/lnme/blob/master/examples/lnme.service)

View File

@@ -21,6 +21,9 @@
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-go"
},
{
"url": "https://github.com/iamashks/heroku-buildpack-tor-proxy.git"
}
]
}
}

11
lnme.go
View File

@@ -144,7 +144,7 @@ func main() {
})
if !cfg.Bool("disable-ln-address") {
e.GET("/.well-known/lnurlp/:name", func(c echo.Context) error {
lnurlHandler := func(c echo.Context) error {
name := c.Param("name")
lightningAddress := name + "@" + c.Request().Host
lnurlMetadata := "[[\"text/identifier\", \"" + lightningAddress + "\"], [\"text/plain\", \"Sats for " + lightningAddress + "\"]]"
@@ -164,11 +164,16 @@ func main() {
stdOutLogger.Printf("New LightningAddress request amount: %s", amount)
msats, err := strconv.ParseInt(amount, 10, 64)
if err != nil || msats < 1000 {
stdOutLogger.Printf("Invalid amount: %s", amount)
return c.JSON(http.StatusOK, lnurl.LNURLErrorResponse{Status: "ERROR", Reason: "Invalid Amount"})
}
sats := msats / 1000 // we need sats
metadataHash := sha256.Sum256([]byte(lnurlMetadata))
invoice, err := lnClient.AddInvoice(sats, lightningAddress, metadataHash[:])
if err != nil {
stdOutLogger.Printf("Error creating invoice: %s", err)
return c.JSON(http.StatusOK, lnurl.LNURLErrorResponse{Status: "ERROR", Reason: "Server Error"})
}
lnurlPayResponse2 := lnurl.LNURLPayResponse2{
LNURLResponse: lnurl.LNURLResponse{Status: "OK"},
PR: invoice.PaymentRequest,
@@ -178,7 +183,9 @@ func main() {
}
return c.JSON(http.StatusOK, lnurlPayResponse2)
}
})
}
e.GET("/.well-known/lnurlp/:name", lnurlHandler)
e.GET("/lnurlp/:name", lnurlHandler)
}
// Debug test endpoint