reformat with gofmt
This commit is contained in:
parent
d82c17e0a1
commit
7816566d59
9 changed files with 221 additions and 216 deletions
|
|
@ -27,7 +27,7 @@ func db_open() (*sql.DB, error) {
|
|||
return db, nil
|
||||
}
|
||||
|
||||
func db_get_setting(setting_name string) (string) {
|
||||
func db_get_setting(setting_name string) string {
|
||||
|
||||
setting_value := ""
|
||||
|
||||
|
|
@ -74,13 +74,19 @@ func db_insert_card(one_time_code string, k0_auth_key string, k2_cmac_key string
|
|||
allow_neg_bal_ptr bool) error {
|
||||
|
||||
lnurlw_enable_yn := "N"
|
||||
if lnurlw_enable { lnurlw_enable_yn = "Y" }
|
||||
if lnurlw_enable {
|
||||
lnurlw_enable_yn = "Y"
|
||||
}
|
||||
|
||||
uid_privacy_yn := "N"
|
||||
if uid_privacy { uid_privacy_yn = "Y" }
|
||||
if uid_privacy {
|
||||
uid_privacy_yn = "Y"
|
||||
}
|
||||
|
||||
allow_neg_bal_yn := "N"
|
||||
if allow_neg_bal_ptr { allow_neg_bal_yn = "Y" }
|
||||
if allow_neg_bal_ptr {
|
||||
allow_neg_bal_yn = "Y"
|
||||
}
|
||||
|
||||
db, err := db_open()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ func db_open() (*sql.DB, error) {
|
|||
return db, nil
|
||||
}
|
||||
|
||||
func db_get_setting(setting_name string) (string) {
|
||||
func db_get_setting(setting_name string) string {
|
||||
|
||||
setting_value := ""
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"strconv"
|
||||
"time"
|
||||
"crypto/sha256"
|
||||
|
||||
decodepay "github.com/fiatjaf/ln-decodepay"
|
||||
lnrpc "github.com/lightningnetwork/lnd/lnrpc"
|
||||
|
|
@ -106,7 +106,7 @@ func add_invoice(amount_sat int64, metadata string) (payment_request string, r_h
|
|||
|
||||
// https://api.lightning.community/?shell#subscribesingleinvoice
|
||||
|
||||
func monitor_invoice_state(r_hash []byte) () {
|
||||
func monitor_invoice_state(r_hash []byte) {
|
||||
|
||||
// SubscribeSingleInvoice
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ func monitor_invoice_state(r_hash []byte) () {
|
|||
log.Fields{
|
||||
"r_hash": hex.EncodeToString(r_hash),
|
||||
"invoice_state": invoice_state,
|
||||
},).Info("invoice state updated")
|
||||
}).Info("invoice state updated")
|
||||
|
||||
db_update_receipt_state(hex.EncodeToString(r_hash), invoice_state)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"encoding/hex"
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func lnurlp_callback(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -31,7 +31,7 @@ func lnurlp_callback(w http.ResponseWriter, r *http.Request) {
|
|||
"card_id": card_id,
|
||||
"amount": amount,
|
||||
"req.Host": r.Host,
|
||||
},).Info("lnurlp_callback")
|
||||
}).Info("lnurlp_callback")
|
||||
|
||||
domain := db_get_setting("HOST_DOMAIN")
|
||||
if r.Host != domain {
|
||||
|
|
@ -47,7 +47,7 @@ func lnurlp_callback(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
amount_sat := amount_msat / 1000;
|
||||
amount_sat := amount_msat / 1000
|
||||
|
||||
metadata := "[[\"text/identifier\",\"" + name + "@" + domain + "\"],[\"text/plain\",\"bolt card deposit\"]]"
|
||||
pr, r_hash, err := add_invoice(amount_sat, metadata)
|
||||
|
|
@ -66,7 +66,7 @@ func lnurlp_callback(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
go monitor_invoice_state(r_hash)
|
||||
|
||||
log.Debug("sending 'status OK' response");
|
||||
log.Debug("sending 'status OK' response")
|
||||
|
||||
jsonData := []byte(`{` +
|
||||
`"status":"OK",` +
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ func lnurlp_response(w http.ResponseWriter, r *http.Request) {
|
|||
"url_path": r.URL.Path,
|
||||
"name": name,
|
||||
"r.Host": r.Host,
|
||||
},).Info("lnurlp_response")
|
||||
}).Info("lnurlp_response")
|
||||
|
||||
// look up domain setting (HOST_DOMAIN)
|
||||
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func db_open() (*sql.DB, error) {
|
|||
return db, nil
|
||||
}
|
||||
|
||||
func db_get_setting(setting_name string) (string) {
|
||||
func db_get_setting(setting_name string) string {
|
||||
|
||||
setting_value := ""
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"strconv"
|
||||
log "github.com/sirupsen/logrus"
|
||||
qrcode "github.com/skip2/go-qrcode"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type card_wipe_info struct {
|
||||
|
|
@ -29,7 +29,6 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
|
||||
// check if card_name exists
|
||||
|
||||
card_count, err := db_get_card_name_count(*card_name_ptr)
|
||||
|
|
@ -63,7 +62,7 @@ func main() {
|
|||
`"k4": "` + card_wipe_info_values.k4 + `",` +
|
||||
`"uid": "` + card_wipe_info_values.uid + `",` +
|
||||
`"version": 1` +
|
||||
`}`;
|
||||
`}`
|
||||
|
||||
fmt.Println()
|
||||
q, err := qrcode.New(qr, qrcode.Medium)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue