Skip to content

Commit 8809530

Browse files
amtiYoclaude
andcommitted
fix: pick up the client's review fixes
tg v0.0.1-alpha.6 closes two ways the bot token could escape -- an error body echoed by a proxy in front of the Bot API server, and the path inside a local-file error, which on a --local server is a directory named after the token -- and stops a symlink in the media directory from reading out of another bot's files. It also stops misreporting failures: ok=false on a 2xx is an API error again, the startup preflight waits through a booting server rather than exiting on its first 502, and TELEGRAM_READY_WAIT bounds the whole check instead of only the pauses in it. The rich senders take options now, so the Telegram interface here names them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014xA348oKfgDBSH1mbUkej3
1 parent ae3179a commit 8809530

5 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ GitHub Releases.
88

99
## Unreleased
1010

11+
### Security
12+
13+
- Through `tg` v0.0.1-alpha.6: the bot token can no longer reach a log line
14+
through an error body echoed by something in front of the Bot API server, nor
15+
through the file path wrapped inside a local-file error. A symlink in the
16+
server's media directory can no longer read a file out of another bot's
17+
directory.
18+
19+
### Fixed
20+
21+
- Through the client: an `ok=false` answer carried on a 2xx is an API error
22+
again, so rate limits and edit-not-modified are classified rather than
23+
slipping through as untyped failures; a startup preflight waits through a
24+
Bot API server that is still booting instead of exiting on its first 502;
25+
and `TELEGRAM_READY_WAIT` now bounds the whole startup check rather than only
26+
the pauses inside it.
27+
1128
## v0.0.1-beta.2 - 2026-09-08
1229

1330
Voicy's Telegram client is no longer its own, and it will not start against a

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module github.com/FreshLabDev/voicy
55
go 1.26.6
66

77
require (
8-
github.com/FreshLabDev/tg v0.0.1-alpha.1
8+
github.com/FreshLabDev/tg v0.0.1-alpha.6
99
github.com/jackc/pgx/v5 v5.9.2
1010
)
1111

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/FreshLabDev/tg v0.0.1-alpha.1 h1:eR1lHxbTYXF0oEe0arFERM2rT0anFuH60duzUFmTcLU=
2-
github.com/FreshLabDev/tg v0.0.1-alpha.1/go.mod h1:wsFn10qoSGmL5G1kkEQCxKG3N2BEqnry0yU1CrNwvrI=
1+
github.com/FreshLabDev/tg v0.0.1-alpha.6 h1:PBjXFUL1CbQgqDp55Sv8Q/TLx596B1yGhKCoDOP1n5c=
2+
github.com/FreshLabDev/tg v0.0.1-alpha.6/go.mod h1:wsFn10qoSGmL5G1kkEQCxKG3N2BEqnry0yU1CrNwvrI=
33
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

‎internal/bot/bot.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ type Telegram interface {
6868
SetMyCommandsForScope(context.Context, []tg.BotCommand, *tg.BotCommandScope) error
6969
SendMessage(context.Context, int64, string, *tg.InlineKeyboardMarkup) (tg.Message, error)
7070
SendEphemeralMessage(context.Context, int64, int64, int64, string, *tg.InlineKeyboardMarkup) (tg.Message, error)
71-
SendRichHTML(context.Context, int64, int64, int, string, *tg.InlineKeyboardMarkup) (tg.Message, error)
71+
SendRichHTML(context.Context, int64, int64, int, string, *tg.InlineKeyboardMarkup, ...tg.RichOption) (tg.Message, error)
7272
EditEphemeralMessageText(ctx context.Context, chatID, receiverUserID, ephemeralMessageID int64, text string, markup *tg.InlineKeyboardMarkup) error
73-
EditEphemeralRichHTML(ctx context.Context, chatID, receiverUserID, ephemeralMessageID int64, body string, markup *tg.InlineKeyboardMarkup) error
73+
EditEphemeralRichHTML(ctx context.Context, chatID, receiverUserID, ephemeralMessageID int64, body string, markup *tg.InlineKeyboardMarkup, opts ...tg.RichOption) error
7474
EditMessageText(context.Context, int64, int64, string, *tg.InlineKeyboardMarkup) error
75-
EditMessageRichHTML(ctx context.Context, chatID, messageID int64, body string, markup *tg.InlineKeyboardMarkup) error
75+
EditMessageRichHTML(ctx context.Context, chatID, messageID int64, body string, markup *tg.InlineKeyboardMarkup, opts ...tg.RichOption) error
7676
DeleteMessage(context.Context, int64, int64) error
7777
DeleteEphemeralMessage(ctx context.Context, chatID, receiverUserID, ephemeralMessageID int64) error
7878
AnswerCallbackQuery(context.Context, string, string) error

‎internal/bot/bot_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (f *fakeTG) SendEphemeralMessage(_ context.Context, _, _, _ int64, text str
215215
f.ephemeral = append(f.ephemeral, text)
216216
return tg.Message{MessageID: 501, EphemeralMessageID: 501}, nil
217217
}
218-
func (f *fakeTG) SendRichHTML(_ context.Context, chatID, _ int64, _ int, text string, _ *tg.InlineKeyboardMarkup) (tg.Message, error) {
218+
func (f *fakeTG) SendRichHTML(_ context.Context, chatID, _ int64, _ int, text string, _ *tg.InlineKeyboardMarkup, _ ...tg.RichOption) (tg.Message, error) {
219219
f.mu.Lock()
220220
hook := f.onRich
221221
f.calls = append(f.calls, "sendRich")
@@ -251,14 +251,14 @@ func (f *fakeTG) transcriptParts() []string {
251251
return out
252252
}
253253

254-
func (f *fakeTG) EditMessageRichHTML(_ context.Context, _, _ int64, text string, _ *tg.InlineKeyboardMarkup) error {
254+
func (f *fakeTG) EditMessageRichHTML(_ context.Context, _, _ int64, text string, _ *tg.InlineKeyboardMarkup, _ ...tg.RichOption) error {
255255
f.mu.Lock()
256256
defer f.mu.Unlock()
257257
f.calls = append(f.calls, "editRich")
258258
f.richEdits = append(f.richEdits, text)
259259
return nil
260260
}
261-
func (f *fakeTG) EditEphemeralRichHTML(_ context.Context, _, _, _ int64, text string, _ *tg.InlineKeyboardMarkup) error {
261+
func (f *fakeTG) EditEphemeralRichHTML(_ context.Context, _, _, _ int64, text string, _ *tg.InlineKeyboardMarkup, _ ...tg.RichOption) error {
262262
f.mu.Lock()
263263
defer f.mu.Unlock()
264264
f.calls = append(f.calls, "editEphemeralRich")

0 commit comments

Comments
 (0)