Mak5er
1d0fd2a038
fix(db): add psycopg for SQLAlchemy 2.1 and support driver fallback for migrations
2026-11-02 01:38:01 +02:00
Mak5er
723df68feb
admin: remove Message by Chat ID from main admin panel and return back to history on cancel
2026-09-15 00:20:22 +03:00
Mak5er
5790b5251b
fix(history): resolve user username/fullname correctly and fix DownloadHistory.user relationship
2026-09-15 00:14:41 +03:00
Mak5er
5a22c39ebe
fix(logger): route bot logs to stdout, demote noisy traces to debug, and add startup/shutdown lifecycle logs
2026-09-14 23:41:15 +03:00
Mak5er
71374922cf
fix(guest): do not trigger greeting on replies to bot downloads unless supported link is provided
2026-09-14 23:21:18 +03:00
Mak5er
c16f4490bb
fix(startup): polish setup_dialogs registration order and keyword args in twitter logger
2026-09-14 23:14:49 +03:00
Mak5er
9f77fac8f8
feat(admin): add download history dialog with pagination, filters, and chat messaging
2026-09-14 23:12:40 +03:00
Mak5er
c15cc22609
feat(download): record download history and summary logs across all media handlers
2026-09-14 15:24:35 +03:00
Mak5er
56b0062e22
feat(storage): add download_history table, repository mixin, and migration
2026-09-14 15:19:41 +03:00
Mak5er
c1831c19f7
refactor(logger): reduce Docker log noise and add concise download summary logging
2026-09-14 15:17:53 +03:00
Mak5er
d4595a7e13
feat(guest-mode): add Telegram Bot API 9.0 guest mode support and media download flow
...
- Add guest_message router and handler for guest mentions in chats where bot is not a member
- Support link detection from direct messages, replies, quotes, and text_link entities
- Integrate with inline media senders for supported platforms and deep-linking for audio/albums
- Add guest rate-limiting and ban enforcement in antiflood and ban middlewares
- Update chat tracker to track guest users without saving non-member group data
- Bypass private chat guard for guest messages
- Add /start settings, /start stats, and /start dl_<token> deep-link handlers
- Add comprehensive test suite in tests/test_guest_mode.py
2026-09-14 14:35:09 +03:00
Mak5er
ff08a681fd
feat(broadcast): add token bucket rate limiter, forum topic support, and broadcast delivery report
2026-09-08 17:16:51 +03:00
Mak5er
c960fc1ae1
feat: add automatic detection and migration when groups upgrade to supergroups
2026-09-08 17:00:48 +03:00
Mak5er
e16e964ab6
test: fix ruff lint errors (unused imports and E712 comparisons)
2026-09-08 16:45:01 +03:00
Mak5er
07b96ee040
feat(admin): implement segmented mailing, group reach verification, and admin UI
2026-09-08 16:27:00 +03:00
Mak5er
5a4a58cd83
test: add adversarial m2 test suite
2026-09-08 16:16:37 +03:00
Mak5er
b4d9d000b0
feat: separate users and groups, track group membership, and improve admin stats
2026-09-08 16:11:12 +03:00
Mak5er and Claude Fable 5
caffc343af
refactor: apply full-project audit — bug fixes, performance, deduplication
...
Full-codebase audit (149 raw findings, 57 verified and applied).
Fixes:
- download resume: recompute Range header per retry attempt; never resume
preallocated multipart .part files (silent media corruption)
- inline sends: canonical error tail (rate-limit/queue-busy/timeout/failure)
for all platforms; YouTube inline no longer strands tokens in
'processing' for 6h
- admin mailing: exclude banned users; fix Telegram error-text matching
- middlewares: instantiate once and share across message/callback/inline
so antiflood/ban state no longer fragments
- event loop: move ZIP compression, JSON state persistence, admin FS
walks, PIL/ffmpeg/ffprobe work off the loop
- download queue: prune idle per-user scopes; cancelled leader releases
joined duplicate requests
- worker subprocess: disable log sinks (stderr error protocol and log
rotation no longer race the parent)
- third-party loggers route through app handlers instead of lastResort
- tiktok: fix mojibake reaction emoji; per-user settings in doc callback;
per-URL locks for short-URL expansion; parallel photo-set downloads
- ci: fix broken yt-dlp auto-bump workflow baseline
- db: drop redundant analytics_events indexes (migration 000010)
Refactoring:
- services/inline/send_flow.py: shared inline delivery flow for all five
platforms (~640 duplicated lines removed)
- services/media/audio_flow.py: shared MP3 pipeline (was duplicated 6x
across youtube/youtube_inline/soundcloud/spotify)
- CobaltMediaService base + shared Cobalt response parsing
- services/platforms/ytdlp_helpers.py: shared yt-dlp scaffolding
- register_inline_send_handlers: one chosen_inline_result/callback
registration factory for 8 handlers
- merge pinterest/threads single-media and media-group flows
- logging decorator factory; remove ~11 dead repository methods
Tests: 470 -> 518 passing, coverage 77.3% -> 80.9% (CI gate 74%).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
2026-07-26 16:25:59 +03:00
Mak5er
48115e06e7
test(db): update expected default user settings in test_add_user_and_settings
2026-07-22 20:10:56 +03:00
Mak5er
1988c3315b
fix: harden YouTube media extraction
2026-07-20 01:50:23 +03:00
Mak5er
40662635b7
feat: add Spotify audio downloads and rich metadata
...
Add Spotify track resolution through YouTube audio sources with oEmbed fallback, caching, routing, analytics, and user-facing support. Normalize MP3 filenames, ID3 tags, JPEG cover art, Telegram thumbnails, and duplicate artist metadata across Spotify, YouTube Music, and SoundCloud. Extend regression coverage for provider parsing, delivery, metadata, covers, cache behavior, and link dispatch.
2026-07-10 12:22:17 +03:00
Mak5er
681f9fa233
feat: add Threads downloads and inline support
2026-07-10 02:45:50 +03:00
Mak5er
be4016a8a3
perf: harden downloader and runtime lifecycle
2026-07-09 23:59:34 +03:00
Mak5er
9fdc5681d7
fix: resolve 'Too many open files' leak & handle cosmetic chat action errors gracefully
2026-07-08 21:41:02 +03:00
Mak5er
bbb5af1643
fix(downloads): harden media download flows
2026-07-05 22:19:51 +03:00
Mak5er
86712315b3
feat: implement media handler architecture with support for multiple platforms and comprehensive test coverage
2026-07-01 00:45:28 +03:00
Mak5er
ac682fdba6
fix: handle mounted youtube cookie permissions
2026-06-26 03:24:44 +03:00
Mak5er
f8fc9648d0
fix: stabilize CI quality gates
2026-06-26 03:07:11 +03:00
Mak5er
1806c149fd
fix: align CI checks with current baseline
2026-06-26 03:04:34 +03:00
Mak5er
4ead6d0710
fix: handle business message dedupe safely
2026-06-26 02:55:32 +03:00
Mak5er
5c0842ea8d
fix: update tests for refactored code (stats extraction, ban middleware, analytics)
2026-06-18 19:00:16 +03:00
Mak5er
0a0ab1466f
perf: tune connection pool for Neon serverless (5+10, 300s recycle, FIFO)
2026-06-18 18:28:44 +03:00
Mak5er
62050a0f2c
perf: comprehensive production audit and hardening (Phase 1-4)
...
43 files changed, 828 insertions, 408 deletions. Key changes:
== Phase 1 - Critical fixes ==
- Fix shared mutable state in ResilientDownloader (class-level _inflight_downloads)
- Add threading.Lock to request dedup (race condition on concurrent claims)
- Fix ban_middleware fail-closed: DB error -> fallback to 'active' instead of 'restricted'
- Fix COUNT(*) anti-pattern: 5 methods fetched entire user table into memory
- Remove 6 duplicated function definitions in user_messages.py (silent shadowing)
- Extract metadata from Cobalt responses (Instagram no longer discards descriptions)
- Add SSRF validation for COBALT_API_URL (private IP blocking, scheme enforcement)
- Docker: healthcheck, resource limits, restart: on-failure:5
- Fix migration crash-loop (try/except guardrails + dialect detection bug)
== Phase 2 - Performance hardening ==
- Exponential backoff+jitter in cobalt_client and retry_async_operation (removed 9 fixed delays)
- Add asyncio.wait_for timeouts to Instagram/Pinterest downloads
- TikTok preflight size check before download
- SQLAlchemy pool event listeners (perf metrics on checkout/overflow)
- DownloadedFile TTL cleanup (date_added index + daily cron cleanup)
- Per-request UUID request_id in ChatTrackerMiddleware for end-to-end tracing
- private_chat_guard caching (60s TTL, reduces Telegram API calls)
- Antiflood O(k) eviction instead of O(n) full scan
- TikTok: Semaphore(3)+sliding-window rate limiter instead of global asyncio.Lock
== Phase 3 - CI hardening ==
- CI: lint job (ruff + mypy), docker smoke tests migrations, --cov-fail-under=80
- Upgrade dependency-audit Python 3.12 -> 3.14
- Fix 7 '# type: ignore' decorators with ParamSpec
- Migration 000005: ix_analytics_events_user_id + ix_downloaded_files_date_added
- Race-condition tests for dedup, queue shutdown, per-user slots
== Phase 4 - Architecture ==
- .dockerignore (exclude .git, tests, __pycache__, .env from Docker image)
- Consolidate 3 FakeYoutubeDL/DummyYDL classes into conftest.py
- Extract _download_youtube_media() from 70-line closure
- BasePlatformMediaService ABC in services/platforms/__init__.py
- Remove empty profiling/ directory
Tests: 349 passed, 0 failed (4 skipped: PostgreSQL-dependent)
2026-06-16 01:01:06 +03:00
Mak5er
468ba2031b
Improve bot onboarding and adaptive downloads
2026-05-27 17:33:59 +03:00
Mak5er
37b694c276
fix: restore youtube access helpers and migration head
2026-05-25 17:38:31 +03:00
Mak5er and Claude Sonnet 4
86ee114c8d
fix(tiktok): use Cobalt first, fix H.264 candidate order, close #49
...
- Add Cobalt as first download attempt in download_video; falls back to
tikwm direct then yt-dlp when Cobalt is unavailable or fails
- Reorder _direct_video_candidates from hdplay→play→wmplay to
play→wmplay→hdplay so H.264/AVC streams are preferred over H.265/HEVC,
fixing gray-frame / audio-only playback on Telegram clients
- Update test to mock _download_via_cobalt and reflect new candidate order
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com >
2026-05-13 00:11:39 +03:00
Mak5er
259f12da5e
fix(tiktok): prefer TikWM with yt-dlp fallback
...
Use TikWM metadata and direct media URLs as the primary TikTok path, keeping yt-dlp as a fallback. Rework TikTok download retries into service cycles so one failing provider does not exhaust all retry attempts before fallback.
2026-05-08 12:49:03 +03:00
Mak5er
35b626dfc6
Embed bot avatar in audio uploads
2026-04-26 12:40:27 +03:00
Mak5er
138ce34b3d
Fix YouTube Music yt-dlp fallback
2026-04-26 11:44:21 +03:00
Mak5er
9cdf29d65e
feat: add video metadata handling for Telegram video attributes and update video send kwargs
2026-04-20 18:27:15 +03:00
Mak5er
06e6c8923f
Merge pull request #45 from Mak5er/issue/44
...
fix: send full Instagram carousels beyond Telegram batch limit
2026-04-20 12:02:46 +03:00
Mak5er
fc41bde6f9
fix(db): normalize alembic database URL handling
...
Resolve Alembic paths relative to the services directory, load DATABASE_URL from the project .env, and normalize async PostgreSQL URLs before migrations run.
Also extract shared database URL helpers and cover the behavior with database tests.
2026-04-20 12:02:07 +03:00
Mak5er
134ba2b269
fix: send full Instagram carousels beyond Telegram batch limit
2026-04-20 11:52:19 +03:00
Mak5er
b61e3b3045
feat(settings): handle "message not modified" error gracefully and update tests
2026-04-16 18:19:06 +03:00
Mak5er
91b84c83b2
feat(admin): streamline runtime control panel
2026-04-10 21:03:23 +03:00
Mak5er
26b7873cd0
fix(concurrency): scope parallel media flows per chat
...
Scope download queue limits by user and chat so the same user can run downloads across multiple chats without tripping a shared pending cap.
Also coalesce concurrent single-media requests by cache key so duplicate links wait for the first upload and then reuse the cached Telegram file_id instead of downloading the same file again.
2026-04-10 19:22:04 +03:00
Mak5er
eb743e203b
fix(dedupe): scope duplicate checks per chat
...
Track message dedupe by user and chat so the same user can send the same link in multiple chats without false duplicate-processing blocks.
Add runtime regression coverage for cross-chat dedupe isolation.
2026-04-10 19:00:21 +03:00
Mak5er
ab6404657b
fix(antiflood): scope limits per chat
...
Track antiflood state by user and chat for message and callback events so the same user can work in multiple chats without false positives.
Add regression and user journey tests covering cross-chat behavior and the group-to-DM recovery flow.
2026-04-10 18:46:16 +03:00
Mak5er
52c6aa6300
fix: restore settings toggle callbacks
2026-04-10 13:27:29 +03:00
Mak5er
77c4cda0b8
Refactor logging paths and stabilize db tests
2026-04-10 00:42:21 +03:00