Description
Generate and display file previews before accepting transfers for safety and convenience.
Requirements
- Receiver sees file previews before accepting transfer
- Preview generation on sender side (non-blocking)
- Multiple preview types based on file format
- Configurable preview generation (enable/disable per file type)
- Preview size limits (max bandwidth for preview transfer)
Preview Types
Images (jpg, png, gif, webp)
- Thumbnail: 256x256px
- Max size: 50KB
- Format: JPEG for transfer
Videos (mp4, mov, webm)
- First frame thumbnail: 256x256px
- Max size: 50KB
- Duration and resolution metadata
PDFs
- First page thumbnail: 512x512px
- Max size: 100KB
- Page count metadata
Text/Code Files
- First 1KB of content
- Syntax highlighting hint (file extension)
- Line count, encoding
Archives (zip, tar, gz)
- File listing (first 50 entries)
- Total files count
- Compressed/uncompressed sizes
Other Files
- File icon based on extension
- MIME type
- Size and modification date
Protocol Extension
New message types (0x07-0x08):
PreviewRequest - Receiver requests preview for specific file
PreviewData - Sender sends preview data
Configuration
[preview]
enabled = true
max_image_size = "50KB"
max_text_length = 1024
generate_pdf = true
generate_video = true
generate_archive_listing = true
Technical Details
- Use
image crate for image thumbnails
- Use
pdf or poppler for PDF rendering
- Use
ffmpeg or gstreamer for video frames (optional)
- Use
zip, tar crates for archive listings
- Async preview generation (don't block transfer)
- Cache generated previews during session
UI Display
- CLI: Text preview or "[Image: 1920x1080 JPEG]" placeholders
- TUI: Render thumbnails using Unicode blocks or kitty graphics protocol
- Web: Display actual images/thumbnails in browser
Acceptance Criteria
- Receiver sees meaningful preview for images, PDFs, videos, text
- Preview generation doesn't delay transfer initiation
- Previews are optional (can skip and accept blindly)
- Preview size limited to avoid bandwidth waste
Description
Generate and display file previews before accepting transfers for safety and convenience.
Requirements
Preview Types
Images (jpg, png, gif, webp)
Videos (mp4, mov, webm)
PDFs
Text/Code Files
Archives (zip, tar, gz)
Other Files
Protocol Extension
New message types (0x07-0x08):
PreviewRequest- Receiver requests preview for specific filePreviewData- Sender sends preview dataConfiguration
Technical Details
imagecrate for image thumbnailspdforpopplerfor PDF renderingffmpegorgstreamerfor video frames (optional)zip,tarcrates for archive listingsUI Display
Acceptance Criteria