diff --git a/internal/app/handler/chip.go b/internal/app/handler/chip.go index 11cc452..0696a06 100644 --- a/internal/app/handler/chip.go +++ b/internal/app/handler/chip.go @@ -58,7 +58,7 @@ Sign Keys: var keysReplacement string for _, key := range chip.EUICCInfo2.PkiForSigning { - keysReplacement += util.FincCertificateIssuer(key) + "\n" + keysReplacement += util.FindCertificateIssuer(key) + "\n" } keysReplacement = strings.TrimSuffix(keysReplacement, "\n") return c.Send( diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index dd313a1..32d28f1 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -10,13 +10,14 @@ const ( ) type Config struct { - BotToken string - AdminId int64 - Dir string - APDUDriver string - Version string - DontDownload bool - Verbose bool + BotToken string + AdminId int64 + TelegramEndpoint string + Dir string + APDUDriver string + Version string + DontDownload bool + Verbose bool } var C = &Config{} diff --git a/internal/pkg/util/euicc.go b/internal/pkg/util/euicc.go index 104d4aa..de7e1d5 100644 --- a/internal/pkg/util/euicc.go +++ b/internal/pkg/util/euicc.go @@ -47,7 +47,7 @@ func init() { } } -func FincCertificateIssuer(keyID string) string { +func FindCertificateIssuer(keyID string) string { for _, ci := range certificateIssuers { if strings.HasPrefix(keyID, ci.KeyID) { return ci.Name diff --git a/main.go b/main.go index ef817f7..d818a2c 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ func init() { } flag.StringVar(&config.C.BotToken, "bot-token", "", "telegram bot token") flag.Int64Var(&config.C.AdminId, "admin-id", 0, "telegram admin id") + flag.StringVar(&config.C.TelegramEndpoint, "telegram-endpoint", "https://api.telegram.org", "telegram endpoint") flag.StringVar(&config.C.APDUDriver, "apdu-driver", "at", "the APDU driver to use (at or qmi)") flag.StringVar(&config.C.Version, "version", "v2.0.2", "the version of lpac to download") flag.StringVar(&config.C.Dir, "dir", "/tmp/telegram-sms", "the directory to store lpac") @@ -55,6 +56,7 @@ func main() { bot, err := telebot.NewBot(telebot.Settings{ Token: config.C.BotToken, + URL: config.C.TelegramEndpoint, Client: &http.Client{ Timeout: 30 * time.Second, Transport: &http.Transport{