Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 128 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ Yoop enables seamless peer-to-peer file transfers over local networks using simp
- **Cross-platform**: Works on Windows, Linux, and macOS
- **No account required**: Zero configuration, no cloud dependency
- **Simple 4-character codes**: Easy discovery without IP addresses
- **QR code support**: Display scannable codes for upcoming mobile app (experimental)
- **Dual discovery**: UDP broadcast + mDNS/DNS-SD for reliable device discovery
- **Private & secure**: TLS 1.3 encryption, data never leaves local network
- **Fast transfers**: Chunked transfers with xxHash64 verification
- **Resume capability**: Interrupted transfers can be resumed automatically
- **CLI interface**: Full-featured command-line tool
- **Web interface**: Browser-based UI for devices without CLI access
- **CLI + Web interface**: Full-featured command-line tool and browser-based UI
- **Trusted devices**: Ed25519 signature-based authentication for direct transfers
- **Clipboard sharing**: One-shot transfer and live bidirectional sync
- **Shell completions**: Bash, Zsh, Fish, PowerShell, Elvish support

## Quick Start

Expand Down Expand Up @@ -51,24 +53,38 @@ yoop receive A7K9 --output ~/Downloads/
yoop receive A7K9 --batch
```

### Clipboard Sharing
### Clipboard Sharing (Unique Feature!)

```bash
# Share current clipboard content (generates a code)
yoop clipboard share
# One-shot clipboard sharing
yoop clipboard share # Share current clipboard
yoop clipboard receive A7K9 # Receive clipboard content

# Receive clipboard content using a code
yoop clipboard receive A7K9

# Start bidirectional clipboard sync (host)
yoop clipboard sync

# Join existing sync session
yoop clipboard sync A7K9
# Live bidirectional sync (sync clipboard changes in real-time)
yoop clipboard sync # Host sync session
yoop clipboard sync A7K9 # Join sync session
```

Supports text and images. Changes sync automatically across devices!

## Installation

### via npm (Recommended)

```bash
# npm
npm install -g yoop

# pnpm
pnpm add -g yoop

# yarn
yarn global add yoop

# bun
bun add -g yoop
```

### From Source

Requires **Rust 1.86.0** or later.
Expand All @@ -81,17 +97,33 @@ cargo install --path crates/yoop-cli

### Pre-built Binaries

Pre-built binaries and package manager support are planned for future releases.
Pre-built binaries for Windows, Linux, and macOS are coming soon.

## Shell Completions

Install tab completions for your shell:

```bash
yoop completions install # Auto-detect shell and install
yoop completions install --shell zsh
yoop completions generate bash # Print to stdout
```

Supported: Bash, Zsh, Fish, PowerShell, Elvish

## How It Works

**Code-based transfers:**

1. **Sender** shares files and gets a 4-character code (e.g., `A 7 K 9`)
2. **Receiver** enters the code on their device
3. **Discovery** happens via UDP broadcast + mDNS on local network
4. **Transfer** occurs directly over TLS 1.3 encrypted TCP connection
5. **Verification** using xxHash64 per chunk, SHA-256 for complete file
6. **Resume** automatic resumption of interrupted transfers from last checkpoint

**For trusted devices:** Direct connection using Ed25519 signatures (no code needed)

```
┌─────────────┐ UDP Broadcast ┌──────────────┐
│ Sender │ ◄──────── Code: A7K9 ──────────► │ Receiver │
Expand All @@ -105,26 +137,68 @@ Pre-built binaries and package manager support are planned for future releases.

```bash
# Sharing & Receiving
yoop share <files...> # Share files/folders
yoop receive <code> # Receive with code
yoop share <files...> # Share files/folders
yoop receive <code> # Receive with code
yoop send <device> <files...> # Send to trusted device (no code)

# Clipboard Sharing
yoop clipboard share # Share clipboard content
yoop clipboard receive <code> # Receive clipboard content
yoop clipboard sync [code] # Bidirectional clipboard sync

# Utilities
yoop scan # Scan for active shares on network
yoop web # Start web interface
yoop config # Manage configuration
yoop diagnose # Network diagnostics
yoop history # View transfer history

# Planned Features
yoop send <device> <files> # Send to trusted device (in development)
yoop trust list # Manage trusted devices (in development)
yoop clipboard share # Share clipboard content
yoop clipboard receive <code> # Receive clipboard content
yoop clipboard sync [code] # Bidirectional clipboard sync

# Device & Network Management
yoop trust list # Manage trusted devices
yoop scan # Scan for active shares
yoop diagnose # Network diagnostics

# Configuration & Utilities
yoop config # Manage configuration
yoop history # View transfer history
yoop web # Start web interface
yoop completions install # Install shell completions
```

## Web Interface

Start a browser-based UI for devices without CLI access:

```bash
yoop web # Start on default port 8080
yoop web --port 9000 # Custom port
yoop web --auth # Require authentication
yoop web --localhost-only # Bind to localhost only
```

**Features:**

- Drag-and-drop file sharing
- QR codes with deep links (for future mobile app integration)
- File previews (images, text, archives)
- Real-time transfer progress
- No installation required (just open in browser)

Access at `http://[your-ip]:8080` from any device on the network.

## Trusted Devices

Send files directly to trusted devices without share codes:

```bash
# First transfer: Use share code
yoop share file.txt
# After accepting, you'll be prompted to trust the device

# Subsequent transfers: Direct send (no code needed)
yoop send "Device-Name" file.txt

# Manage trusted devices
yoop trust list # List all trusted devices
yoop trust set "Name" --level full # Set trust level
yoop trust remove "Name" # Remove device
```

**Security:** Uses Ed25519 signatures for authentication. No MITM attacks possible.

## Configuration

Yoop can be configured via TOML files:
Expand All @@ -139,6 +213,7 @@ Example configuration:
[general]
device_name = "My-Laptop"
default_expire = "5m"
default_output = "~/Downloads"

[network]
port = 52525
Expand All @@ -152,8 +227,26 @@ verify_checksum = true
[security]
tls_verify = true
rate_limit_attempts = 3

[trust]
enabled = true
auto_prompt = true
default_level = "ask_each_time"

[history]
enabled = true
max_entries = 100

[ui]
show_qr = false # Enable QR codes (for future mobile app)

[web]
port = 8080
auth = false
```

See all options: `yoop config list`

## Development

### Prerequisites
Expand Down Expand Up @@ -189,6 +282,8 @@ cargo test --lib --workspace

# Integration tests only
cargo test --test integration_transfer
cargo test --test integration_trust
cargo test --test integration_clipboard

# With output
cargo test -- --nocapture
Expand All @@ -205,6 +300,9 @@ cargo clippy --workspace -- -D warnings

# Check without building
cargo check --workspace

# Generate documentation
cargo doc --workspace --open
```

## Architecture
Expand Down
8 changes: 6 additions & 2 deletions crates/yoop-cli/src/commands/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub async fn run(args: ShareArgs) -> Result<()> {
let total_size: u64 = files.iter().map(|f| f.size).sum();
let code = session.code().to_string();

display_share_info(&files, total_size, &code, &args)?;
display_share_info(&files, total_size, &code, &args, &global_config)?;

let progress_rx = session.progress();
let expire_duration =
Expand Down Expand Up @@ -99,6 +99,7 @@ fn display_share_info(
total_size: u64,
code: &str,
args: &ShareArgs,
global_config: &yoop_core::config::Config,
) -> Result<()> {
let total_files = files.len();

Expand Down Expand Up @@ -128,7 +129,10 @@ fn display_share_info(
});
println!("{}", serde_json::to_string_pretty(&output)?);
} else if !args.quiet {
CodeBox::new(code).with_expire(&args.expire).display();
CodeBox::new(code)
.with_expire(&args.expire)
.with_qr(global_config.ui.show_qr)
.display();
println!();
}

Expand Down
25 changes: 24 additions & 1 deletion crates/yoop-cli/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ const BOX_WIDTH: usize = 33;
pub struct CodeBox<'a> {
code: &'a str,
expire: Option<&'a str>,
show_qr: bool,
}

impl<'a> CodeBox<'a> {
/// Create a new code box.
#[must_use]
pub const fn new(code: &'a str) -> Self {
Self { code, expire: None }
Self {
code,
expire: None,
show_qr: false,
}
}

/// Add expiration time to the box.
Expand All @@ -24,6 +29,13 @@ impl<'a> CodeBox<'a> {
self
}

/// Enable QR code display.
#[must_use]
pub const fn with_qr(mut self, show: bool) -> Self {
self.show_qr = show;
self
}

/// Display the code box to stdout.
pub fn display(&self) {
let spaced_code = format_code_spaced(self.code);
Expand All @@ -41,6 +53,17 @@ impl<'a> CodeBox<'a> {
}

println!(" └{}┘", "─".repeat(BOX_WIDTH));

if self.show_qr {
if let Ok(qr) = yoop_core::qr::generate_ascii(self.code) {
println!();
for line in qr.lines() {
println!(" {}", line);
}
println!();
println!(" Scan to receive: yoop://{}", self.code);
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/yoop-core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl Default for UiConfig {
fn default() -> Self {
Self {
theme: "auto".to_string(),
show_qr: true,
show_qr: false,
notifications: true,
sound: true,
}
Expand Down
2 changes: 2 additions & 0 deletions crates/yoop-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//! - [`history`] - Transfer history tracking and persistence
//! - [`preview`] - File preview generation (thumbnails, text snippets)
//! - [`protocol`] - LDRP wire protocol implementation
//! - [`qr`] - QR code generation for share codes
//! - [`transfer`] - File transfer engine
//! - [`trust`] - Trusted devices management
//! - [`web`] - Embedded web server for browser-based access
Expand Down Expand Up @@ -63,6 +64,7 @@ pub mod file;
pub mod history;
pub mod preview;
pub mod protocol;
pub mod qr;
pub mod transfer;
pub mod trust;

Expand Down
Loading