start adding handling for lnurlp

This commit is contained in:
Peter Rounce 2022-09-14 12:54:29 +00:00
parent 79c6369c39
commit e16fca179b
6 changed files with 107 additions and 8 deletions

View file

@ -182,7 +182,7 @@ func parse_request(req *http.Request) (int, error) {
card_count, err := db_get_card_count_for_uid(uid_str)
if err != nil {
return 0, errors.New("could not get card records count")
return 0, errors.New("could not get card count for uid")
}
if card_count == 0 {
@ -246,6 +246,13 @@ func parse_request(req *http.Request) (int, error) {
func lnurlw_response(w http.ResponseWriter, req *http.Request) {
env_host_domain := os.Getenv("HOST_DOMAIN")
if req.Host != env_host_domain {
log.Warn("wrong host domain")
write_error(w)
return
}
card_id, err := parse_request(req)
if err != nil {