This commit is contained in:
gohumble
2022-02-23 14:42:17 +01:00
3 changed files with 17 additions and 34 deletions
+5 -6
View File
@@ -10,7 +10,6 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
@@ -59,7 +58,7 @@ func GetInvoice(params Params) (string, error) {
specialTransport := &http.Transport{}
// use a cert or skip TLS verification?
if params.Backend.getCert() == nil {
if params.Backend.getCert() != nil {
caCertPool := x509.NewCertPool()
ok := caCertPool.AppendCertsFromPEM([]byte(params.Backend.getCert()))
if !ok {
@@ -70,15 +69,15 @@ func GetInvoice(params Params) (string, error) {
specialTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
// todo -- commenting out proxy for dev
// info: always use http proxy
// use a tor proxy?
// if params.Backend.isTor() {
torURL, _ := url.Parse(TorProxyURL)
specialTransport.Proxy = http.ProxyURL(torURL)
// torURL, _ := url.Parse(TorProxyURL)
// specialTransport.Proxy = http.ProxyURL(torURL)
// }
// todo -- commenting out proxy for dev
// Client.Transport = specialTransport
Client.Transport = specialTransport
// description hash?
var _, b64h string
+11 -10
View File
@@ -32,8 +32,8 @@ var (
func init() {
mainMenu.Reply(
mainMenu.Row(btnBalanceMainMenu, btnHelpMainMenu),
mainMenu.Row(btnInvoiceMainMenu, btnSendMainMenu),
mainMenu.Row(btnBalanceMainMenu),
mainMenu.Row(btnInvoiceMainMenu, btnSendMainMenu, btnHelpMainMenu),
)
}
@@ -71,15 +71,16 @@ func (bot *TipBot) mainMenuBalanceButtonUpdate(to int64) {
}
if user.Wallet != nil {
amount, err := bot.GetUserBalanceCached(user)
if err == nil {
log.Tracef("[appendMainMenu] user %s balance %d sat", GetUserStr(user.Telegram), amount)
MainMenuCommandBalance := fmt.Sprintf("%s %d sat", MainMenuCommandBalance, amount)
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
mainMenu.Reply(
mainMenu.Row(btnBalanceMainMenu),
mainMenu.Row(btnInvoiceMainMenu, btnSendMainMenu, btnHelpMainMenu),
)
if err != nil {
amount = 0
}
log.Tracef("[appendMainMenu] user %s balance %d sat", GetUserStr(user.Telegram), amount)
MainMenuCommandBalance := fmt.Sprintf("%s %d sat", MainMenuCommandBalance, amount)
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
mainMenu.Reply(
mainMenu.Row(btnBalanceMainMenu),
mainMenu.Row(btnInvoiceMainMenu, btnSendMainMenu, btnHelpMainMenu),
)
}
}
+1 -18
View File
@@ -168,26 +168,9 @@ func (bot TipBot) getHandler() []Handler {
},
},
},
{
Endpoints: []interface{}{"/inv"},
Handler: bot.invHandler,
Interceptor: &Interceptor{
Type: MessageInterceptor,
Before: []intercept.Func{
bot.requirePrivateChatInterceptor,
bot.localizerInterceptor,
bot.logMessageInterceptor,
bot.requireUserInterceptor,
bot.lockInterceptor,
},
OnDefer: []intercept.Func{
bot.unlockInterceptor,
},
},
},
{
Endpoints: []interface{}{"/node"},
Handler: bot.registerNodeHandler,
Handler: bot.nodeHandler,
Interceptor: &Interceptor{
Type: MessageInterceptor,
Before: []intercept.Func{