Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docker/card/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strconv"
"time"

_ "github.com/mattn/go-sqlite3"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func Db_add_card_receipt(db_conn *sql.DB, card_id int, payment_request string, payment_hash_hex string, amount_sats int) (card_receipt_id int) {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func Close(db *sql.DB) {
Expand Down
1 change: 0 additions & 1 deletion docker/card/db/db_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package db
import (
"database/sql"

_ "github.com/mattn/go-sqlite3"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func Db_get_setting(db_conn *sql.DB, name string) string {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func Db_insert_card(db_conn *sql.DB, key0 string, key1 string, k2 string, key3 string, key4 string,
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

type CardReceipt struct {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"card/util"
"database/sql"
"errors"

_ "github.com/mattn/go-sqlite3"
)

func Db_set_setting(db_conn *sql.DB, name string, value string) {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"database/sql"
"os"
"testing"

_ "github.com/mattn/go-sqlite3"
)

func openTestDB(t *testing.T) *sql.DB {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_test_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package db

import (
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func add_test_data(db_conn *sql.DB) {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

func Db_update_tokens(db_conn *sql.DB, initial_refresh_token string, new_refresh_token string, access_token string) (success bool) {
Expand Down
2 changes: 0 additions & 2 deletions docker/card/db/db_wipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package db
import (
"card/util"
"database/sql"

_ "github.com/mattn/go-sqlite3"
)

type CardKeys struct {
Expand Down
1 change: 0 additions & 1 deletion docker/card/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"syscall"
"time"

_ "github.com/mattn/go-sqlite3"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion docker/card/phoenix/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func doRequest(req *http.Request, timeout time.Duration, endpointName string) ([
}

if res.StatusCode != 200 {
log.Warning(endpointName, " StatusCode ", res.StatusCode)
log.Warn(endpointName, " StatusCode ", res.StatusCode)
return nil, errors.New("failed API call to Phoenix " + endpointName)
}

Expand Down
6 changes: 3 additions & 3 deletions docker/card/phoenix/send_lightning_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func SendLightningPayment(

password, err := loadPassword()
if err != nil {
log.Warning(err)
log.Warn(err)
return sendLightningPaymentResponse,
"no_config",
errors.New("could not load config for SendLightningPayment")
Expand All @@ -56,7 +56,7 @@ func SendLightningPayment(

req, err := http.NewRequest(http.MethodPost, phoenixBaseURL+"/payinvoice", reader)
if err != nil {
log.Warning(err)
log.Warn(err)
return sendLightningPaymentResponse,
"failed_request_creation",
errors.New("could not create request for SendLightningPayment")
Expand Down Expand Up @@ -90,7 +90,7 @@ func SendLightningPayment(
}

if res.StatusCode != 200 {
log.Warning("SendLightningPayment StatusCode ", res.StatusCode, "ResBody", string(resBody))
log.Warn("SendLightningPayment StatusCode ", res.StatusCode, "ResBody", string(resBody))
return sendLightningPaymentResponse,
"fail_status_code",
errors.New("fail status code returned for SendLightningPayment")
Expand Down
10 changes: 0 additions & 10 deletions docker/card/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ func Random_hex() string {
return hex.EncodeToString(b)
}

func Max(a, b int) int {
var max int
if a > b {
max = a
} else {
max = b
}
return max
}

func QrPngBase64Encode(data string) (encoded string) {
var data_qr_png []byte
data_qr_png, err := qrcode.Encode(data, qrcode.Medium, 256)
Expand Down
2 changes: 0 additions & 2 deletions docker/card/web/admin_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ func (app *App) CreateHandler_Admin() http.HandlerFunc {

request := r.RequestURI

//log.Info("CreateHandler_Admin handler with request uri : " + request)

// prevent caching
w.Header().Add("Cache-Control", "no-cache, no-store")

Expand Down
3 changes: 0 additions & 3 deletions docker/card/web/pos_api_addinvoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ func (app *App) CreateHandler_PosApi_AddInvoice() http.HandlerFunc {

log.Info("pos_api AddInvoice request received")

// reqToken := r.Header.Get("Authorization")
// log.Info("auth token : ", reqToken)

// get details from request body

decoder := json.NewDecoder(r.Body)
Expand Down
1 change: 0 additions & 1 deletion docker/card/web/public_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ func (app *App) CreateHandler_Public() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {

request := r.RequestURI
//log.Info("CreateHandler_Public handler with request uri : " + request)

w.Header().Add("Cache-Control", "max-age=60, must-revalidate")

Expand Down
3 changes: 1 addition & 2 deletions docker/card/web/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func visit(path string, di fs.DirEntry, err error) error {

// load the template cache
if strings.HasSuffix(template_name, ".html") {
//log.Info("loading template cache: " + template_full_name + " : from : " + path)
ts, err := template.New(template_name).ParseFiles(path)
if err != nil {
log.Error("template parse error: ", err)
Expand Down Expand Up @@ -90,7 +89,7 @@ func RenderStaticContent(w http.ResponseWriter, request string) {

switch {
case strings.HasSuffix(request, ".js"):
w.Header().Add("Content-Type", "application/json")
w.Header().Add("Content-Type", "application/javascript")
case strings.HasSuffix(request, ".css"):
w.Header().Add("Content-Type", "text/css")
case strings.HasSuffix(request, ".png"):
Expand Down
4 changes: 1 addition & 3 deletions docker/card/web/wallet_api_payinvoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package web

import (
"card/db"

"card/phoenix"
"card/util"
"encoding/json"
"net/http"
"strconv"
Expand Down Expand Up @@ -56,7 +54,7 @@ func (app *App) CreateHandler_WalletApi_PayInvoice() http.HandlerFunc {
return
}

actualAmtSat := util.Max(invAmtSat, reqObj.Amount)
actualAmtSat := max(invAmtSat, reqObj.Amount)

// check if there is sufficient balance (atomic query)

Expand Down
2 changes: 1 addition & 1 deletion docker/card/web/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (app *App) CreateHandler_Websocket() http.HandlerFunc {
strconv.Itoa(incomingPayment.Fees)+" sats fees,"+
" message: "+webSocketMessage.PayerNote))
if err != nil {
log.Warning("websocket write error :", err)
log.Warn("websocket write error :", err)
return
}
}
Expand Down