From 514574ef038e918f166780e2187033e1e6efaa21 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Tue, 20 Aug 2019 14:57:57 +0200 Subject: [PATCH] Skip bad CA --- main.go | 4 ++-- mlpapi1.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 12bb6e0..098f65b 100644 --- a/main.go +++ b/main.go @@ -62,7 +62,7 @@ type CardFaceFlipPics struct { func webhook(update tg.APIUpdate) { // Handle inline queries (99% of the usage I hope) - if update.Inline != nil { + if update.Inline != nil && update.Inline.Query != "" { query := update.Inline.Query results, err := mlpapiSearch(query) if err != nil { @@ -205,7 +205,7 @@ func getCardEntry(card CardData, flipped int) (string, string, []tg.APIInlineKey buttons := []tg.APIInlineKeyboardButton{ { Text: "Ponyhead", - URL: "http://ponyhead.com/cards/" + cid, + URL: "https://ponyhead.com/cards/" + cid, }, } diff --git a/mlpapi1.go b/mlpapi1.go index 4b24d25..63e87eb 100644 --- a/mlpapi1.go +++ b/mlpapi1.go @@ -1,6 +1,7 @@ package main import ( + "crypto/tls" "encoding/json" "fmt" "net/http" @@ -26,6 +27,9 @@ type CardData struct { var netClient = &http.Client{ Timeout: time.Second * 20, + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, } func mlpapiSearch(query string) (results CardSearchResults, err error) {