### Start rqbit Server Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Starts the rqbit server, specifying the download directory. This is a basic command to get the server running. ```bash rqbit server start ~/Downloads ``` -------------------------------- ### Start Dev Server Source: https://github.com/ikatson/rqbit/blob/main/DEV-GUIDE.md Starts the development server for the project. ```bash make devserver ``` -------------------------------- ### Install Web UI Dependencies Source: https://github.com/ikatson/rqbit/blob/main/DEV-GUIDE.md Installs the necessary dependencies for the Web UI. ```bash make webui-deps ``` -------------------------------- ### Install Web UI Dependencies Source: https://github.com/ikatson/rqbit/blob/main/desktop/README.md Installs the necessary Node.js dependencies for the rqbit web UI. Run this in the webui directory. ```bash npm install ``` -------------------------------- ### Run Web UI Development Source: https://github.com/ikatson/rqbit/blob/main/DEV-GUIDE.md Starts the development server specifically for the Web UI. ```bash make webui-dev ``` -------------------------------- ### Install rqbit with Homebrew Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Installs the rqbit client on macOS or Linux systems that use Homebrew package manager. ```bash brew install rqbit ``` -------------------------------- ### Run Tauri Development Source: https://github.com/ikatson/rqbit/blob/main/DEV-GUIDE.md Starts the development environment for the desktop application using Tauri. ```bash cargo tauri dev ``` -------------------------------- ### Install rqbit with Cargo Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Installs the rqbit client using Cargo, the Rust package manager. Requires the Rust toolchain to be installed. ```bash cargo install rqbit ``` -------------------------------- ### Install Tauri CLI Source: https://github.com/ikatson/rqbit/blob/main/DEV-GUIDE.md Installs the Tauri command-line interface, required for desktop app development. ```bash cargo install tauri-cli ``` -------------------------------- ### Enable UPnP Server in rqbit Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Starts the rqbit server with UPnP enabled, allowing it to advertise managed torrents to the local network. ```bash rqbit --enable-upnp-server server start ... ``` -------------------------------- ### Run WebUI Development Server Source: https://github.com/ikatson/rqbit/blob/main/AGENTS.md Starts the web UI in development mode using Vite, enabling hot reloading. Points to http://localhost:3031. ```bash # Run webui in dev mode (hot reload vite server). Points to http://localhost:3031. make webui-dev ``` -------------------------------- ### Run Test Server Source: https://github.com/ikatson/rqbit/blob/main/AGENTS.md Starts a test server that simulates traffic and points to http://localhost:3030 for the web UI and API. Requires restart if Rust code changes. ```bash # Run test server that simulates traffic. Points to http://localhost:3030 for the main session's web UI and API. # If you make changes to Rust this needs to be restarted. make testserver ``` -------------------------------- ### Build Desktop App Source: https://github.com/ikatson/rqbit/blob/main/AGENTS.md Installs npm dependencies and compiles TypeScript for the desktop app. Avoids expensive 'cargo tauri build' for development. ```bash # Desktop app. You cannot test it or see it, so don't bother running expensive "cargo tauri build" cd desktop && npm install && tsc --noEmit ``` -------------------------------- ### Pause Flow Example Source: https://github.com/ikatson/rqbit/blob/main/crates/librqbit/src/torrent_state/live/STATE.md Describes the state transition when pausing torrents, moving all IN_FLIGHT pieces to QUEUED. This involves marking pieces as broken and storing the ChunkTracker for potential resumption. ```text IN_FLIGHT → QUEUED (for all in-flight pieces) 1. pause(): - Calls PieceTracker::into_chunks() which: - For each piece in inflight, calls mark_piece_broken_if_not_have(piece) - Returns the inner ChunkTracker - Stores the ChunkTracker for resume ``` -------------------------------- ### Build Rust Project with WebUI Feature Source: https://github.com/ikatson/rqbit/blob/main/CLAUDE.md Build the project with the 'webui' feature enabled. Requires npm to be installed for frontend asset handling. ```bash cargo build --release --features webui ``` -------------------------------- ### Run Test Server Source: https://github.com/ikatson/rqbit/blob/main/CLAUDE.md Start a test server that simulates network traffic. It serves the main session's web UI and API on http://localhost:3030. This server must be restarted if Rust code changes. ```bash make testserver ``` -------------------------------- ### Create Torrent Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Creates a new torrent file from a local folder and starts seeding it. ```APIDOC ## POST /torrents/create ### Description Creates a new torrent file from a specified local folder and begins seeding it. ### Method POST ### Endpoint /torrents/create ### Request Body - **folder_path** (string) - Required - The path to the local folder to create a torrent from. ``` -------------------------------- ### Start Torrent Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Resumes the download or seeding process for a specific torrent. ```APIDOC ## POST /torrents/{id_or_infohash}/start ### Description Resumes the download or seeding activity for the specified torrent. ### Method POST ### Endpoint /torrents/{id_or_infohash}/start ### Parameters #### Path Parameters - **id_or_infohash** (string) - Required - The ID or infohash of the torrent. ``` -------------------------------- ### Build Rust Project with WebUI Feature Source: https://github.com/ikatson/rqbit/blob/main/AGENTS.md Builds the Rust project with the 'webui' feature enabled. Requires npm to be installed. ```bash # Build with webui feature (requires npm installed) cargo build --release --features webui ``` -------------------------------- ### Import Helper Functions for Formatting Source: https://github.com/ikatson/rqbit/blob/main/crates/librqbit/webui/CLAUDE.md Imports utility functions for formatting byte sizes, calculating estimated completion times, and getting display names for torrents. These are located in the `helper/` directory. ```typescript import { formatBytes } from "../helper/formatBytes"; import { getCompletionETA } from "../helper/getCompletionETA"; import { torrentDisplayName } from "../helper/getTorrentDisplayName"; ``` -------------------------------- ### Watch Folder for Torrents Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Configures the rqbit server to monitor a specified folder for new .torrent files and automatically start downloading them to a designated path. ```bash rqbit server start --watch-folder [path] /download/path ``` -------------------------------- ### List Available APIs via HTTP Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Use curl to query the root endpoint of the rqbit HTTP API to get a list of all available APIs and their descriptions. This is useful for understanding the server's capabilities. ```bash curl -s 'http://127.0.0.1:3030/' { "apis": { "GET /": "list all available APIs", "GET /dht/stats": "DHT stats", "GET /dht/table": "DHT routing table", "GET /metrics": "Prometheus metrics", "GET /stats": "Global session stats", "GET /stream_logs": "Continuously stream logs", "GET /torrents": "List torrents", "GET /torrents/playlist": "Playlist for supported players", "GET /torrents/{id_or_infohash}": "Torrent details", "GET /torrents/{id_or_infohash}/haves": "The bitfield of have pieces", "GET /torrents/{id_or_infohash}/metadata": "Download the corresponding torrent file", "GET /torrents/{id_or_infohash}/peer_stats": "Per peer stats", "GET /torrents/{id_or_infohash}/peer_stats/prometheus": "Per peer stats in prometheus format", "GET /torrents/{id_or_infohash}/playlist": "Playlist for supported players", "GET /torrents/{id_or_infohash}/stats/v1": "Torrent stats", "GET /torrents/{id_or_infohash}/stream/{file_idx}": "Stream a file. Accepts Range header to seek.", "GET /web/": "Web UI", "POST /rust_log": "Set RUST_LOG to this post launch (for debugging)", "POST /torrents": "Add a torrent here. magnet: or http:// or a local file.", "POST /torrents/create": "Create a torrent and start seeding. Body should be a local folder", "POST /torrents/resolve_magnet": "Resolve a magnet to torrent file bytes", "POST /torrents/{id_or_infohash}/add_peers": "Add peers (newline-delimited)", "POST /torrents/{id_or_infohash}/delete": "Forget about the torrent, remove the files", "POST /torrents/{id_or_infohash}/forget": "Forget about the torrent, keep the files", "POST /torrents/{id_or_infohash}/pause": "Pause torrent", "POST /torrents/{id_or_infohash}/start": "Resume torrent", "POST /torrents/{id_or_infohash}/update_only_files": "Change the selection of files to download. You need to POST json of the following form {\"only_files\": [0, 1, 2]}" }, "server": "rqbit", "version": "9.0.0-beta.1" } ``` -------------------------------- ### List Torrent Contents with rqbit Source: https://github.com/ikatson/rqbit/blob/main/crates/rqbit/README.md Prints the contents of a torrent file or magnet link without starting a download. Use the --list flag. ```bash rqbit --list ``` -------------------------------- ### Checksum Failure Flow Example Source: https://github.com/ikatson/rqbit/blob/main/crates/librqbit/src/torrent_state/live/STATE.md Illustrates the state transition from IN_FLIGHT to QUEUED when a piece's hash verification fails. This involves removing the piece from inflight and marking it as broken. ```text IN_FLIGHT → QUEUED 1. All chunks received, hash verification fails 2. PieceTracker::take_inflight(piece) → removes from inflight 3. PieceTracker::mark_piece_hash_failed(piece) → calls mark_piece_broken_if_not_have(piece) → sets queue_pieces[p] = true ``` -------------------------------- ### Search Log Files with rg Source: https://github.com/ikatson/rqbit/blob/main/AGENTS.md Examples of using 'rg' to search log files, with filters for specific content and limiting output. Avoid reading large log files directly. ```bash # search for peer address rg "192.168.1.100" /tmp/rqbit-log | head -50 # search for peer address rg "ERROR" /tmp/rqbit-log | tail -100 # recent errors rg "abc123" /tmp/rqbit-log | head -20 # search for torrent hash ``` -------------------------------- ### Array Filtering for Virtualization Source: https://github.com/ikatson/rqbit/blob/main/crates/librqbit/webui/architecture/virtualization.md When using virtualization, it is mandatory to filter the data array before passing it to the Virtuoso component. This example shows the correct approach compared to a non-virtualized CSS hidden method. ```typescript // With virtualization - filter first const filtered = items.filter(item => matchesSearch(item)); } /> // Without virtualization - CSS hidden (doesn't work with virtualization!) items.map(item => (