claude: updated CLAUDE.md

This commit is contained in:
2025-12-07 08:18:25 +01:00
parent 05411ce8b8
commit feee9229fa
+17 -29
View File
@@ -17,7 +17,7 @@ cargo tauri dev
# Debug build for very quick testing (without bundle) # Debug build for very quick testing (without bundle)
cargo tauri build --debug --no-bundle cargo tauri build --debug --no-bundle
# Relase build for testing (without bundling) # Release build for testing (without bundling)
cargo tauri build --no-bundle cargo tauri build --no-bundle
# Production (with bundling) # Production (with bundling)
@@ -62,6 +62,13 @@ cargo test -- --nocapture
deno outdated --update --latest deno outdated --update --latest
``` ```
### Wayland Users
```bash
# Set this environment variable if running on Wayland
WEBKIT_DISABLE_DMABUF_RENDERER=1
```
## Architecture ## Architecture
LanSpread follows a layered, modular architecture with clear separation of concerns: LanSpread follows a layered, modular architecture with clear separation of concerns:
@@ -89,13 +96,16 @@ The project is organized as a Cargo workspace with 7 crates:
- Converts `EtiGame` structs to modern `Game` struct - Converts `EtiGame` structs to modern `Game` struct
**Core P2P Engine:** **Core P2P Engine:**
- **lanspread-peer**: (~97KB) Central orchestration for all P2P functionality - **lanspread-peer**: Central orchestration for all P2P functionality
- QUIC-based networking with length-delimited frame codec (`tokio-util`) - Entry point: `start_peer()` in `lib.rs`
- Manages peer-to-peer connections and game synchronization
- Handles file streaming with chunk transfers and path validation
- Communicates via unbounded channels (`PeerEvent`, `PeerCommand`) - Communicates via unbounded channels (`PeerEvent`, `PeerCommand`)
- Implements retry logic for requesting games from peers - Key modules:
- Entry point: `start_peer()` function - `services.rs`: Background tasks (server, discovery, ping, local game monitor)
- `handlers.rs`: Command handlers for UI requests
- `network.rs`: QUIC connection management with length-delimited frames
- `download.rs`: Chunked file transfer logic
- `peer_db.rs`: Peer tracking and game availability
- `path_validation.rs`: Security for file operations
**Application Layer:** **Application Layer:**
- **lanspread-tauri-deno-ts**: Tauri desktop application - **lanspread-tauri-deno-ts**: Tauri desktop application
@@ -174,25 +184,3 @@ File transfers validate paths to prevent directory traversal attacks. All file o
**Why not Tauri + Leptos?** Leptos adds unnecessary complexity. Tauri is designed to transfer backend Rust to frontend JavaScript world, but with Leptos the frontend becomes Rust, creating a double translation. The current Tauri + Deno/TypeScript approach is cleaner. **Why not Tauri + Leptos?** Leptos adds unnecessary complexity. Tauri is designed to transfer backend Rust to frontend JavaScript world, but with Leptos the frontend becomes Rust, creating a double translation. The current Tauri + Deno/TypeScript approach is cleaner.
**Why Tauri?** Simple setup, easy development with `cargo tauri dev`, easy testing and bundling with installers, small final binary (~13MB). **Why Tauri?** Simple setup, easy development with `cargo tauri dev`, easy testing and bundling with installers, small final binary (~13MB).
## File Organization
```
crates/
├── lanspread-db/ # Core data models
├── lanspread-utils/ # Macros & utilities
├── lanspread-proto/ # Protocol definitions
├── lanspread-compat/ # Legacy ETI compatibility
├── lanspread-mdns/ # mDNS discovery
├── lanspread-peer/ # P2P engine (largest, most complex)
└── lanspread-tauri-deno-ts/
├── src-tauri/ # Rust Tauri backend
└── (sibling dirs) # Deno/TypeScript frontend code
```
## Additional Resources
- **README.md**: Build and development prerequisites
- **LESSONS_LEARNED.md**: Architectural decisions and trade-offs
- **AGENTS.md**: Code quality guidelines
- **TODO.md**: Tracked work items