Skip to content

Commit

Permalink
feat: add support for custom telegram endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
damonto committed Jul 28, 2024
1 parent 6d282ad commit 9a6f65e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/app/handler/chip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 8 additions & 7 deletions internal/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/util/euicc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 9a6f65e

Please sign in to comment.