add option to have external port
This commit is contained in:
parent
3a2096345d
commit
6ef61fe1af
6 changed files with 61 additions and 25 deletions
|
|
@ -2,13 +2,14 @@ package lnurlp
|
|||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/boltcard/boltcard/db"
|
||||
"github.com/boltcard/boltcard/lnd"
|
||||
"github.com/boltcard/boltcard/resp_err"
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Callback(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -37,6 +38,11 @@ func Callback(w http.ResponseWriter, r *http.Request) {
|
|||
}).Info("lnurlp_callback")
|
||||
|
||||
domain := db.Get_setting("HOST_DOMAIN")
|
||||
hostdomainPort := db.Get_setting("HOST_DOMAIN_PORT")
|
||||
hostdomainsuffix := ""
|
||||
if hostdomainPort != "" {
|
||||
hostdomainsuffix = ":" + hostdomainPort
|
||||
}
|
||||
if r.Host != domain {
|
||||
log.Warn("wrong host domain")
|
||||
resp_err.Write(w)
|
||||
|
|
@ -52,7 +58,7 @@ func Callback(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
amount_sat := amount_msat / 1000
|
||||
|
||||
metadata := "[[\"text/identifier\",\"" + name + "@" + domain + "\"],[\"text/plain\",\"bolt card deposit\"]]"
|
||||
metadata := "[[\"text/identifier\",\"" + name + "@" + domain + hostdomainsuffix + "\"],[\"text/plain\",\"bolt card deposit\"]]"
|
||||
pr, r_hash, err := lnd.Add_invoice(amount_sat, metadata)
|
||||
if err != nil {
|
||||
log.Warn("could not add_invoice")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue