feat: add thumbnail preview, audio-only detection, /download command, tests, and bugfixes

- Add thumbnail preview with metadata (title, uploader, duration) before download
- Auto-detect audio-only sites (Spotify, SoundCloud, etc.) and skip type selection
- Add /download command for feature parity with UI button
- Fix yt-dlp defer bug: StatusFailed was overwritten to StatusCompleted
- Fix handleURLInput using editText with msgID=0 (now uses sendWithKB)
- Fix filename detection: use job ID prefix for reliable file finding
- Fix double answerCb between handleBackStep and handleDownloadPrompt
- Fix runDownload unused msgID parameter
- Fix context for download goroutine (use context.Background)
- Remove unused startWebhook h parameter
- Remove dead buildToggleKeyboard function
- Add formatBytes, formatDuration, formatLabelForDisplay tests
- Add IsAudioOnlyContent, MediaType.String tests
- Add repo integration tests (users, preferences, quotas, history, delete)
- Add cmd/bot tests (parseAllowedUsers, env helpers)
- Add edge case tests for progress parser
- Add zero/negative safety guard in formatDuration
- Add .gitea, TODO.md, opencode.json to gitignore
This commit is contained in:
2026-06-25 15:07:31 +03:30
parent 05fcdf7458
commit cd27b4d28d
15 changed files with 631 additions and 64 deletions

View File

@@ -182,6 +182,8 @@ func (h *Handler) routeCommand(ctx context.Context, msg *models.Message, userID
h.handleHelp(ctx, msg)
case "/history":
h.handleHistory(ctx, msg, userID)
case "/download":
h.handleDownloadCommand(ctx, msg, userID)
default:
h.sendText(ctx, msg.Chat.ID, "Unknown command")
}
@@ -222,6 +224,7 @@ func (h *Handler) HandleCallback(ctx context.Context, cb *models.CallbackQuery)
h.backToMenu(ctx, chatID, msgID, cb.ID, userID)
case data == "download":
h.handleDownloadPrompt(ctx, chatID, msgID, cb.ID, userID)
h.answerCb(ctx, cb.ID)
case data == "settings":
h.settingsCallback(ctx, chatID, msgID, cb.ID, userID)
case data == "help":