Commit Graph
48 Commits
Author SHA1 Message Date
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 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 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
Mak5erandClaude 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 49b172628f fix(ci): fix ruff linting errors and restore compatibility imports 2026-07-22 13:29:52 +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 be4016a8a3 perf: harden downloader and runtime lifecycle 2026-07-09 23:59:34 +03:00
Mak5er bbb5af1643 fix(downloads): harden media download flows 2026-07-05 22:19:51 +03:00
Mak5er bfe5193205 perf: batch analytics inserts with single SQL statement 2026-06-18 18:33:34 +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 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 5bd8255898 fix: make analytics index migration idempotent 2026-04-09 01:08:49 +03:00
Mak5er c611fa1a73 refactor: introduce explicit app factory 2026-04-09 00:15:19 +03:00
Mak5er e43826a5fa perf: warm stats charts and surface analytics drops 2026-04-09 00:00:45 +03:00
Mak5er bb964728a7 refactor: organize services into domain subpackages 2026-04-07 01:08:39 +03:00
Mak5er 29795b9710 refactor: move runtime dependencies into app context 2026-04-07 00:24:38 +03:00
Mak5er bbe6737d85 refactor: normalize config names to upper snake case
- switch runtime imports to ADMIN_ID/CUSTOM_API_URL and drop lowercase module aliases
- keep backward-compatible env fallback for existing deployments
- update docs/tests and remove the completed config naming finding from the review backlog
2026-04-06 23:50:41 +03:00
Mak5er 26fadf3831 security: pseudonymize analytics identities and parallelize GA flush
- replace raw Telegram IDs in GA payloads with deterministic hashed identifiers
- send analytics batches with bounded concurrency instead of strict sequential posting
- remove the completed analytics privacy/performance finding from the review backlog
2026-04-06 23:43:12 +03:00
Mak5er 8adca9f43d Refactor inline delivery, cleanup dependencies, and overhaul logging
What changed:

- unified inline media delivery across TikTok, Instagram, Pinterest, SoundCloud, YouTube, and Twitter around a single editable-message flow with chosen-inline auto start and callback fallback

- added reusable inline request state/services, service icons, album deep links, and single-message inline progress/edit helpers

- enabled inline support for regular YouTube videos, Twitter inline media, and Twitter multi-photo album deep links; aligned Pinterest/Instagram/TikTok inline behaviors

- cleaned dead duplicated inline code, extracted shared inline request guards, and expanded tests around TikTok, Pinterest, SoundCloud, and YouTube handlers

- optimized project setup with trimmed runtime requirements, requirements-dev split, .dockerignore, Docker/compose improvements, and README updates

- rebuilt logging with structured context-aware adapters, request scoped flow decorators, JSONL event/perf logs, queue/download/cobalt timing events, and safer extra field sanitization to avoid LogRecord key collisions
2026-03-13 00:18:29 +02:00
mak5er 83b425393c feat: add adaptive download queue, retries, and session observability 2026-02-11 17:01:46 +02:00
mak5er fcf75526cf Refactor YouTube handler to utilize a new resilient downloader
- Introduced a new `ResilientDownloader` class in `utils/download_manager.py` for improved download handling with support for HTTP range requests, retries, and resumable downloads.
- Updated `youtube.py` to replace the previous download logic with the new downloader, enhancing performance and reliability.
- Removed the old `download_manager.py` and `http_client.py` services, consolidating functionality into the `utils` directory.
- Adjusted download methods to log metrics and handle errors more effectively.
- Increased the maximum file size limit for downloads to 1.5 GB to accommodate larger media files.
- Improved handling of YouTube streams, including better fallback mechanisms for downloading media.
- Updated inline query handling for YouTube Shorts to use the new downloader.
2025-12-17 11:41:03 +02:00
Mak5er dda200cc0c Add full quality option to video info keyboard and include full_quality router 2025-12-15 23:58:07 +02:00
Mak5er 55bd0bf03e Add ChatTrackerMiddleware for user and chat tracking, update analytics event handling, and improve admin functionalities 2025-11-03 11:08:55 +02:00
Mak5er 67f591207f Add user settings management and logging enhancements 2025-11-02 21:38:51 +02:00
Mak5er a85d34f58f Refactor database configuration and add SQLite initialization 2025-09-10 22:25:45 +03:00
Mak5er c3fc71a1a7 Add AnalyticsEvent model and log user actions to the database 2025-09-10 21:53:05 +03:00
Mak5er c583010514 Add subscription middleware to enforce channel subscription for bot usage 2025-04-10 21:05:49 +03:00
Mak5er 2f351df725 Refactor error handlers to improve error logging and enhance exception handling 2025-03-08 01:08:06 +02:00
Mak5er 5b3124731c Refactor Instagram and TikTok handlers for improved error handling and logging; update API URLs and message responses 2025-02-22 12:39:20 +02:00
Mak5er 2b87bc74d5 Fixed YouTube downloads and added cleaning for downloads folder 2024-11-24 14:54:31 +02:00
Mak5er 300dc3383b updated GA 2024-10-31 13:44:38 +02:00
Mak5er df64cbd84e updated GA settings 2024-10-31 12:26:50 +02:00
Mak5er 498a9d24a2 updated GA engagement time 2024-10-31 11:35:45 +02:00
Mak5er 41b181a2a2 updated GA url 2024-10-31 11:23:14 +02:00
Mak5er 638163568d fixed instagram downloader 2024-10-22 19:13:07 +03:00
Mak5er 53c84666a8 restored google analytic 2024-07-12 14:35:38 +03:00
Mak5er ca0e54917d add mp3 downloading from tiktok 2024-07-12 14:28:19 +03:00
Mak5er 27af4d6ffe add ban middleware 2024-07-12 13:04:15 +03:00
Mak5er ab208d764f add google analytic 2024-07-11 20:56:40 +03:00
Mak5er 207de460ca created custom tg bot API 2024-06-28 13:32:09 +03:00
Mak5er c4818c7790 add admin, optimized code and add music time 2024-06-23 23:22:39 +03:00
Mak5er ae94a3b5ad add database with users 2024-06-22 20:06:13 +03:00
Mak5er 109e305d42 add youtube 2024-06-22 19:24:28 +03:00
Mak5er 6358f300de fix small bug 2024-06-22 16:04:51 +03:00
Mak5er 743a89f81b add antiflood middleware 2024-06-21 17:36:56 +03:00
Mak5er dee77218f4 created tik-tok downloader 2024-06-21 17:00:54 +03:00