Mak5er
5790b5251b
fix(history): resolve user username/fullname correctly and fix DownloadHistory.user relationship
2026-09-15 00:14:41 +03:00
Mak5er
56b0062e22
feat(storage): add download_history table, repository mixin, and migration
2026-09-14 15:19:41 +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
07b96ee040
feat(admin): implement segmented mailing, group reach verification, and admin UI
2026-09-08 16:27:00 +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
635e50b407
feat(settings): add media quality & file options, ZIP multi-photo archives, and categorized /settings UI
...
- Add video_quality, as_document, audio_format, and file_button to user settings schema and Alembic migrations.
- Categorize /settings into Media & Quality, Appearance & Buttons, and Chat & Clean-up with dynamic back navigation.
- Implement strict document delivery with disable_content_type_detection=True to prevent Telegram video player fallback when as_document is ON.
- Add multi-photo ZIP archive packaging for photo carousels in as_document mode.
- Differentiate DB media file cache entries between video and document types (url#document vs url#video) to eliminate cache collisions.
- Hide redundant Download File inline button when as_document setting is active.
- Remove obsolete referral system (/ref command and links).
2026-07-22 13:18:09 +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
1806c149fd
fix: align CI checks with current baseline
2026-06-26 03:04:34 +03:00
Mak5er
c628b91da0
fix: accept any args in engine close event listener
2026-06-18 19:18:48 +03:00
Mak5er
f4e2182a3e
fix: remove unused imports (Tuple, Any)
2026-06-18 18:51:55 +03:00
Mak5er
441e3c7bd4
perf: batch file cache cleanup in chunks of 1000
2026-06-18 18:49:19 +03:00
Mak5er
ef6952cdac
db: deduplicate settings rows and simplify user_settings query
2026-06-18 18:48:08 +03:00
Mak5er
007dc088c1
types: add type hints to repository methods
2026-06-18 18:46:38 +03:00
Mak5er
20fc1ea6d3
perf: consolidate 5 admin count queries into single SQL
2026-06-18 18:35:54 +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
51abba9220
fix(db): use SafeAsyncSession to shield close/rollback and dispose engine on shutdown
2026-06-18 18:07:40 +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
37b694c276
fix: restore youtube access helpers and migration head
2026-05-25 17:38:31 +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
77c4cda0b8
Refactor logging paths and stabilize db tests
2026-04-10 00:42:21 +03:00
Mak5er
57012b387e
perf: harden update backpressure and antiflood
2026-04-09 01:31:47 +03:00
Mak5er
77839a8f62
chore: dedupe inline handlers and clean repo artifacts
2026-04-09 01:20:13 +03:00
Mak5er
0a42cba701
refactor: split storage database responsibilities
2026-04-09 00:20:30 +03:00
Mak5er
8d873067ca
perf: index analytics event stats queries
2026-04-08 23:49:38 +03:00
Mak5er
88c01b9091
fix: harden settings integrity and validation
2026-04-08 23:40:55 +03:00
Mak5er
d3947221cc
fix: preserve app logging during embedded alembic startup
2026-04-07 01:43:22 +03:00
Mak5er
bb964728a7
refactor: organize services into domain subpackages
2026-04-07 01:08:39 +03:00