Skip to content

Conversation

@optiix
Copy link
Contributor

@optiix optiix commented Nov 7, 2025

New Features

WebDrop - LAN-based Playlist Upload

  • Upload M3U playlist files directly to your Android TV via web browser
  • Access from any device on your local network
  • No need for USB drives or cloud services
  • Simple web interface at http://[your-tv-ip]:8080

PIN Encryption (Optional Security Feature)

  • Optional database encryption protected by 6-digit PIN code
  • Encrypts all playlist data, channels, and app settings
  • PIN required on every app launch to access content
  • Rate limiting: 5 failed attempts locks the app temporarily
  • Why encryption matters in 2025: With increasing privacy concerns and data breaches, protecting your viewing habits and playlist
    sources is more important than ever. Optional encryption ensures your data stays private on shared devices.

Updated App Icon

  • New modern launcher icon design
  • Improved visibility on Android TV home screen

Optional Features

Both WebDrop and PIN encryption are completely optional:

  • You can use the app without enabling either feature
  • Enable only the features you need
  • Full functionality available without security features

Known Issues

  • Performance with encryption enabled: When PIN encryption is active, the app may experience slightly slower startup times and
    database operations. This is a normal trade-off for the added security layer.

Technical Improvements

  • Enhanced ProGuard rules for better compatibility
  • Improved startup flow for encrypted databases
  • Better error handling and user feedback
  • SQLCipher integration for database security

Tested on: Android TV Emulator and Nvidia Shield

optiix and others added 12 commits November 4, 2025 20:56
Added complete Swedish translation with 203 strings across 11 XML files:
- ui.xml (20 strings) - Main UI navigation
- feat_stream.xml (21 strings) - Video player controls
- feat_playlist.xml (13 strings) - Playlist management
- feat_setting.xml (106 strings) - Settings
- feat_foryou.xml (14 strings) - Home screen
- feat_playlist_configuration.xml (9 strings)
- data.xml (9 strings) - Notifications
- app.xml (7 strings) - App-level resources
- feat_favourite.xml (2 strings)
- feat_console.xml (1 string)
- feat_about.xml (1 string)

Technical terms (M3U, EPG, IPTV, DLNA) preserved.
All format placeholders and markdown formatting maintained.
Co-authored-by: oxyroid <70512220+oxyroid@users.noreply.github.com>
Co-authored-by: oxyroid <70512220+oxyroid@users.noreply.github.com>
Co-authored-by: oxyroid <70512220+oxyroid@users.noreply.github.com>
Implements a new "WebDrop" data source that allows users to upload M3U playlists
through a web browser on their local network, eliminating the need to type on TV remotes.

Features:
- Embedded Ktor CIO web server running on port 8080
- Responsive Material3 web UI with drag-and-drop support
- Three upload methods: file upload (400MB max), URL import, Xtream codes
- Real-time server status display with URL copy functionality
- Automatic emulator detection (shows localhost for testing)
- Full integration with existing M3U and Xtream parsers
- Material3 Compose UI following existing design patterns
- Multi-language support (11 locales)

Technical implementation:
- Repository pattern with WebServerRepository interface
- StateFlow-based reactive state management
- Ktor 3.3.1 CIO engine (Android-compatible, pure Kotlin)
- ADB port forwarding support for emulator testing
- CORS and content negotiation middleware
- Integration with PlaylistRepository.m3uOrThrow() and xtreamOrThrow()

Also removes broken French translations containing invalid unicode escape sequences.
This commit adds two major security and convenience features:

## USB Encryption Feature
- Encrypt entire database using USB stick as physical key
- Military-grade AES-256-GCM encryption with PBKDF2 key derivation
- Supports both TV and smartphone apps
- Lock screen when USB is removed
- USB device monitoring and management
- Warning dialogs for encryption enable/disable
- Multi-language support for all USB encryption strings

Files:
- USBKeyRepository: Core USB device detection and encryption management
- DatabaseMigrationHelper: Handles SQLCipher database encryption
- SecuritySection (TV): Material3 TV-optimized UI
- SecurityFragment (smartphone): Material Design UI
- USBLockScreen: Full-screen lock when USB removed
- USB permissions in AndroidManifest

## WebDrop Feature Integration
- Server-side file upload handling (already implemented)
- UI integration for WebDrop in settings
- Multi-language support

Dependencies:
- SQLCipher for Android 4.6.1
- USB Host API support
…h enterprise-level improvements

This commit introduces two major features along with critical bug fixes for production stability:

## 1. WebDrop Feature - Embedded Web Server for Playlist Management
- Implemented Ktor-based embedded web server for remote playlist uploads
- Web interface accessible at http://[device-ip]:8080 for easy file uploads
- Three import methods supported:
  * File upload (M3U/M3U8 files up to 400MB)
  * URL import (remote M3U playlist URLs)
  * Xtream Codes API import (username/password authentication)
- Enhanced upload.html with modern responsive UI
- Real-time playlist status endpoint at /status
- Automatic playlist parsing and channel import on upload

## 2. PIN-Based Database Encryption with SQLCipher
- Full Room database encryption using SQLCipher 4.5.x
- 6-digit PIN authentication system with unlock screen
- Secure key derivation using Android Keystore (AES-256-GCM)
- PBKDF2 with SHA-256 for PIN-to-key conversion (100,000 iterations)
- UnlockManager for app-wide authentication state management
- PIN unlock screen blocks app access until authentication succeeds
- Encryption status dashboard showing health metrics
- Database migration support for upgrading unencrypted to encrypted DBs
- USB key storage for encryption keys

## 3. Enterprise-Level Network Timeout Fixes
- Fixed SocketTimeoutException for large M3U playlist downloads
- Configured OkHttp timeouts for slow M3U servers:
  * connectTimeout: 30 seconds (slow networks)
  * readTimeout: 90 seconds (critical for slow servers)
  * writeTimeout: 30 seconds (sufficient for GET requests)
  * callTimeout: 5 minutes (total max time for large downloads)
- Comprehensive error handling with proper HTTP status codes (408, 503, 500)
- Detailed error logging with timing metrics for debugging
- Streaming-aware timeout configuration (readTimeout resets per data chunk)

## 4. Android TV Compatibility Fixes
- Fixed ActivityNotFoundException crash on TV startup
- Wrapped MANAGE_ALL_FILES_ACCESS_PERMISSION request in try-catch
- TV devices skip this permission gracefully (not supported on Android TV)
- App can still access cache/data directories without this permission

## 5. File Upload Path Fix
- Fixed WebServerRepositoryImpl.kt file path handling
- Changed from absolute path to proper file:// URI scheme
- Ensures uploaded files are correctly recognized by playlist parser

## 6. Enhanced Logging and Debugging
- Added comprehensive logging to M3UParserImpl for stream debugging
- Enhanced PlaylistRepositoryImpl logging for input stream tracking
- OkHttp interceptor logs request/response timing and payload sizes
- Timber-based structured logging with component-specific tags

## Files Changed:
- app/tv/MainActivity.kt: Added PIN unlock authentication gate
- data/api/ApiModule.kt: Enterprise-level timeout configuration
- data/database/DatabaseModule.kt: SQLCipher integration
- data/repository/webserver/WebServerRepositoryImpl.kt: File URI fix
- business/setting/UnlockManager.kt: Authentication state manager
- data/security/PINKeyManager.kt: Secure key management with Android Keystore
- app/tv/screens/security/PINUnlockScreen.kt: 6-digit PIN input UI
- app/tv/screens/security/EncryptionStatusDashboard.kt: Health monitoring UI
- data/repository/usbkey/USBKeyRepositoryImpl.kt: USB key storage
- Remove USB encryption initialization from M3UApplication startup
- PIN unlock screen now displays correctly on app launch
- Add ProGuard rules for Ktor and SQLCipher to prevent crashes
- Fix rate limiting in PIN unlock (5 attempts max)
- Improve PIN encryption UI flow and confirmation logic
- Update launcher icons
- Enhance database encryption with PIN-based key derivation

Tested on emulator and Nvidia Shield - working correctly.
Features Added:
- Content Type Mode: Display Live TV, Movies, and Series as separate cards for Xtream playlists
- Enterprise smooth scrolling for category list (first column) with 20% threshold zones
- Enterprise smooth scrolling for channel list (second column) with intelligent bring-into-view
- Conditional live preview: Only shows for Live TV content, empty space for Movies/Series
- White text on selected items for better visibility against purple background

UI Improvements:
- Smooth navigation that only scrolls when items are near viewport edges
- Middle 60% "no scroll zone" prevents jarring jumps during navigation
- Content Type Mode toggle in Settings with Xtream-only warning

Technical Details:
- Implemented threshold-based scrolling algorithm
- Added CONTENT_TYPE_MODE preference key
- Created ContentTypeCardsRow and ContentTypeCard composables
- Enhanced CategoryList and ChannelList with smart scroll behavior
- Added playlist type detection for conditional UI rendering
- Removed app/smartphone module completely
- Removed baselineprofile/smartphone module
- Updated settings.gradle.kts to exclude smartphone modules
- Project now focuses exclusively on Android TV platform
- Updated app name display from 'M3U' to 'M3U CiNEMA' in top bar
- Created new TV banner (320x180) from custom logo design
- Generated all launcher icon densities (mdpi through xxxhdpi)
- Icons feature centered M3 play symbol on dark background
- Professional metallic silver branding throughout
- DatabaseRepairManager: Automatic repair and recovery for corrupted databases
- ChecksumValidator: SHA-256 integrity verification for backup files
- SessionTimeoutMonitor: 6-hour session timer for security compliance
- SessionCountdownWarning: UI component for session expiration alerts
- Enhanced PlaylistRepositoryImpl with checksum verification
- Comprehensive backup integrity checking system
- Re-enabled Optional Features section (VALFRIA FUNKTIONER)
- Content Type Mode toggle: Display Live TV, Movies, Series as cards
- Xtream-only warning for Content Type Mode
- Adult Content access button with PIN protection indicator
- Age restriction notice for mature content
- Professional UI with proper icons and styling
Major Features:
- New playlist management interface in Settings > Prenumerera > Manage Playlists
- 3-column management view (Groups, Channels, Preview)
- Visual state indicators for categories (Red=Hidden, Green=Pinned, Normal)
- Category state cycling: Normal > Hidden > Pinned > Normal
- Separate viewing and management interfaces for better UX
- All categories visible in management (including hidden ones)

Playlist Management:
- Added PlaylistManagement.kt with full management UI
- Horizontal playlist selector showing type labels (XTREAM • LIVE TV, MOVIES, SERIES)
- Delete confirmation dialog for playlists
- Real-time category state changes with color coding
- Clean category list in viewing mode (FOR YOU > LIVE TV)

Database Enhancements:
- Added WatchProgress entity for VOD playback tracking
- Database schema migrations (v21, v22)
- WatchProgressDao with smart filtering (5-90% watched)
- WatchProgressRepository for progress management

Continue Watching Feature (Foundation):
- VOD playback position tracking with 30-second intervals
- Position offset (-30s) for better resume experience
- Automatic cleanup on playback completion
- ContinueWatchingItem model in ForyouViewModel

UI/UX Improvements:
- Removed PIN/HIDE controls from viewing screens
- Enterprise-level smooth scrolling in category lists
- Color-coded category states with proper alpha blending
- Focused state brightness for better visibility
- Auto-selection on focus for seamless navigation

Content Type Mode:
- Added CONTENT_TYPE_MODE preference
- Dashboard tab filtering based on content type
- Xtream type-specific handling (Live TV, Movies, Series)
- Intelligent tab visibility management

Helper Methods:
- getAllChannelsForPlaylist() in PlaylistViewModel
- onHideCategory() and onPinOrUnpinCategory() overloads
- Enhanced playlist type detection and labeling

Files Modified:
- DashboardScreen.kt: Content type mode integration
- ForyouScreen.kt: Continue watching support
- CategoryList.kt: Removed management controls, smooth scrolling
- SubscribeSection.kt: Manage Playlists tab
- PlaylistViewModel.kt: Management helper methods
- SettingProperties.kt: Content type mode preference
- DatabaseModule.kt: WatchProgress support
- PlayerManagerImpl.kt: VOD progress tracking
- Various parser and repository improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant