Skip to content

Conversation

@optiix
Copy link
Contributor

@optiix optiix commented Nov 7, 2025

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 7 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.
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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…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.
@optiix optiix closed this by deleting the head repository Nov 7, 2025
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