Phase 1: quick flow fixes
- One message per job: the status message is deleted once the file is
sent, or shortened to "Sent." when Telegram keeps it.
- No reply quotes in private chats; groups keep them.
- Queue status only mentions the position when the wait is above
QUEUE_NOTICE_THRESHOLD_SECONDS or somebody is ahead. Status edits are
throttled to one per 2.5 s per message; a state that arrives too soon
is shown later instead of dropped. The wait estimate is 0 with a free
slot.
- Caption with title (uploader and date when generic), uploader,
duration, a short source link without tracking parameters and an
optional "via @bot" line (CAPTION_ATTRIBUTION). Uploaded videos get a
320 px JPEG thumbnail; merged MP4s are written with faststart.
- Buttons under the result: Audio (MP3), Other quality, Thumbnail,
Delete. Requester only in groups.
- Language resolved once per update and passed in the context. A
fallback to English is logged as a bug; a test walks every screen in
Spanish and Dutch. Language picker on the first /start.
- Sizes without a zero decimal ("50 MB").
- First link of a new user shows the card once and sets the default to
"best that fits my limit".
- Errors offer the next step (Try again, Smaller quality, Upgrade, Open
app); passing lookup failures are retried once.
- Up to MULTI_LINK_MAX links per message; a link sent a moment ago gets
"already sent" with a Send again button.
- Mini App menu button, labelled per private chat in the user's
language.
- Personal /settings in private chats with an "Add me to a group"
button.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3c153af97f
commit
6843053582
@@ -82,7 +82,7 @@ func (h *harness) fetch(user int64, url string) fakeserver.Call {
|
||||
card := h.card(user, user, url)
|
||||
seq := h.press(user, user, card, "dl:")
|
||||
video := h.wait(seq, "sendVideo", func(c fakeserver.Call) bool { return c.ChatID() == user && !c.Failed })
|
||||
h.wait(seq, edits, func(c fakeserver.Call) bool { return c.ChatID() == user && strings.Contains(c.Text(), "Done") })
|
||||
h.finished(seq, user)
|
||||
return video
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func TestCacheHitEnforcesSizeLimit(t *testing.T) {
|
||||
// the cache, and he still must not get it.
|
||||
card := h.card(bob, bob, link)
|
||||
seq := h.press(bob, bob, card, "dl:")
|
||||
offer := h.wait(seq, "sendMessage", textHas("larger than your limit of 2.0 MB"))
|
||||
offer := h.wait(seq, "sendMessage", textHas("larger than your limit of 2 MB"))
|
||||
if !strings.Contains(offer.Text(), "You can lift the limit") {
|
||||
t.Fatalf("offer = %q", offer.Text())
|
||||
}
|
||||
@@ -224,7 +224,9 @@ func TestCacheHitCountsAgainstAndIsStoppedByTheDailyQuota(t *testing.T) {
|
||||
t.Fatalf("usage after a cache hit = %+v, want 1 download and its bytes", u)
|
||||
}
|
||||
// Bob's quota is used up. The cached file is refused like a fresh one.
|
||||
card := h.card(bob, bob, link)
|
||||
// (/dl, because a plain link he just got is answered with "already
|
||||
// sent", whose button runs into the same limit.)
|
||||
card := h.card(bob, bob, "/dl "+link)
|
||||
seq := h.press(bob, bob, card, "dl:")
|
||||
alert := h.wait(seq, "answerCallbackQuery", nil)
|
||||
if !strings.Contains(alert.Params["text"], "You used your 1 download for today") {
|
||||
@@ -307,8 +309,8 @@ func TestTwoRequestersShareOneDownload(t *testing.T) {
|
||||
// Everyone is notified on completion: both get the file.
|
||||
toAlice := h.wait(seqA, "sendVideo", func(c fakeserver.Call) bool { return c.ChatID() == alice })
|
||||
toGroup := h.wait(seqA, "sendVideo", func(c fakeserver.Call) bool { return c.ChatID() == group })
|
||||
h.wait(seqA, edits, func(c fakeserver.Call) bool { return c.ChatID() == alice && strings.Contains(c.Text(), "Done") })
|
||||
h.wait(seqA, edits, func(c fakeserver.Call) bool { return c.ChatID() == group && strings.Contains(c.Text(), "Done") })
|
||||
h.finished(seqA, alice)
|
||||
h.finished(seqA, group)
|
||||
|
||||
// The file went over the wire once; the second requester got the
|
||||
// file_id of the first upload.
|
||||
@@ -433,7 +435,7 @@ func TestInvalidFileIDFallsBackToTheStoredCopy(t *testing.T) {
|
||||
if !uploaded(healed, "video") || healed.Files["video"].Size != 4096 {
|
||||
t.Fatalf("the fallback must upload the stored copy: %+v %+v", healed.Params, healed.Files)
|
||||
}
|
||||
h.wait(seq, edits, func(c fakeserver.Call) bool { return c.ChatID() == bob && strings.Contains(c.Text(), "Done") })
|
||||
h.finished(seq, bob)
|
||||
if n := len(h.fake.Downloads()); n != 1 {
|
||||
t.Fatalf("yt-dlp ran %d times; the stored copy should have been enough", n)
|
||||
}
|
||||
@@ -472,7 +474,7 @@ func TestInvalidFileIDWithoutStoredCopyDownloadsAgain(t *testing.T) {
|
||||
if !uploaded(fresh, "video") {
|
||||
t.Fatal("the fresh download must be uploaded")
|
||||
}
|
||||
h.wait(seq, edits, func(c fakeserver.Call) bool { return c.ChatID() == bob && strings.Contains(c.Text(), "Done") })
|
||||
h.finished(seq, bob)
|
||||
if n := len(h.fake.Downloads()); n != 2 {
|
||||
t.Fatalf("yt-dlp ran %d times, want 2 (the original and the re-download)", n)
|
||||
}
|
||||
@@ -512,7 +514,7 @@ func TestLowerProfileIsDerivedFromTheStoredCopy(t *testing.T) {
|
||||
if video.Files["video"].Size != 500 || video.Params["height"] != "480" {
|
||||
t.Fatalf("derived video = %+v %+v", video.Params, video.Files)
|
||||
}
|
||||
h.wait(seq, edits, func(c fakeserver.Call) bool { return c.ChatID() == bob && strings.Contains(c.Text(), "Done") })
|
||||
h.finished(seq, bob)
|
||||
if trans.calls.Load() != 1 {
|
||||
t.Fatalf("transcoder ran %d times, want 1", trans.calls.Load())
|
||||
}
|
||||
@@ -572,7 +574,7 @@ func TestFreshCommandSkipsTheCacheUnderNormalLimits(t *testing.T) {
|
||||
if !uploaded(video, "video") {
|
||||
t.Fatal("/fresh must download and upload again")
|
||||
}
|
||||
h.wait(seq, edits, textHas("Done"))
|
||||
h.finished(seq, 0)
|
||||
if n := len(h.fake.Downloads()); n != 2 {
|
||||
t.Fatalf("downloads = %d, want 2", n)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user