Commit Graph
34 Commits
Author SHA1 Message Date
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 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
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
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 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 468ba2031b Improve bot onboarding and adaptive downloads 2026-05-27 17:33:59 +03:00
Mak5er b61e3b3045 feat(settings): handle "message not modified" error gracefully and update tests 2026-04-16 18:19:06 +03:00
Mak5er 2699c332a1 feat(keyboards): enhance button labels with emojis for improved visibility 2026-04-12 23:27:39 +03:00
Mak5er 6899f5c872 feat(video-info): enhance button labels with emojis for better visibility 2026-04-11 20:15:32 +03:00
Mak5er 91b84c83b2 feat(admin): streamline runtime control panel 2026-04-10 21:03:23 +03:00
Mak5er d18e0d4b5c chore: clean package exports and lint issues 2026-04-09 16:24:06 +03:00
Mak5er 566c85d93b Enhance statistics handling and chart rendering
- Introduced caching for statistics snapshots and charts to improve performance.
- Refactored the statistics fetching logic to aggregate data by service and date.
- Updated the chart rendering function to return PNG bytes directly without filesystem writes.
- Added new inline keyboard for statistics with options to toggle between total and split views.
- Improved test coverage for statistics-related functionalities, including fetching and rendering.
2026-03-22 23:05:08 +02: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 943d14ccea chore: refresh bot copy and keyboard flow 2026-02-16 00:39:27 +02:00
mak5er 1bb272fe70 Implement user settings resolution for group chats, add private chat guard middleware, and enhance message handling across various platforms 2026-01-14 01:14:49 +02:00
mak5er efe664ce00 Add MP3 downloading functionality for TikTok and YouTube, including UI updates and database changes 2026-01-14 00:26:52 +02:00
mak5er 5287841b83 Enhance stats functionality by adding service breakdown and updating keyboard for period selection 2025-12-22 13:18:46 +02:00
mak5er 449db311f2 Refactor user stats command to include error handling and logging
- Added try-except block in the stats command to handle exceptions and log errors.
- Updated logging to capture exceptions when generating stats.

Refactor YouTube download handler for improved error handling and type safety

- Introduced safe_int function to handle integer conversions safely.
- Updated download_video and inline_youtube_query functions to use safe_int for view and like counts.
- Removed custom OAuth verifier function and related code.

Simplify video info keyboard function

- Removed unused full_quality_callback parameter from return_video_info_keyboard function.

Update requirements for PostgreSQL support

- Added psycopg2-binary and asyncpg to requirements.txt for PostgreSQL database support.
- Added pytest-asyncio for async testing.

Update Alembic configuration for environment-based database URL

- Changed sqlalchemy.url in alembic.ini to use environment variable DATABASE_URL.

Refactor database connection to support PostgreSQL

- Updated db.py to use BigInteger for primary keys and adapt to PostgreSQL.
- Implemented asyncpg for asynchronous database operations.
- Added sequence adjustments for PostgreSQL after migrations.

Add migration script from SQLite to PostgreSQL

- Created migrate_sqlite_to_postgres.py to facilitate data migration from SQLite to PostgreSQL.

Implement a resilient downloader service

- Added download_manager.py with a ResilientDownloader class for robust file downloading.
- Supports multipart downloads, retries, and resuming interrupted downloads.

Refactor tests to accommodate new database and downloader structure

- Updated test_db.py to use DATABASE_URL for database connection in tests.
- Refactored Instagram handler tests to use the new InstagramService for downloading videos.
2025-12-15 23:58:44 +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 d5664a0362 Add functionality to send messages by chat ID and update admin panel statistics 2025-11-03 10:30:30 +02:00
Mak5er 0879c3a51b Add active users check functionality and update admin interface 2025-11-03 10:00:49 +02:00
Mak5er 67f591207f Add user settings management and logging enhancements 2025-11-02 21:38:51 +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 f5127d25b3 Updated Instagram downloading
Added inline mode support for Instagram reels
2025-02-09 19:28:43 +02:00
Mak5er cc2b592915 Updated TikTok downloading
Added inline mode support for TikTok videos
2025-02-09 14:22:38 +02:00
Mak5er 54685e1521 updated statistic 2024-10-31 13:02:49 +02:00
Mak5er 8e66a006aa updated urls detecting 2024-10-09 19:23:54 +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 c4818c7790 add admin, optimized code and add music time 2024-06-23 23:22:39 +03:00
Mak5er 0342e52877 add setting 2024-06-23 16:42:55 +03:00