projects/shelled/shelled-os-ui/src-tauri/binaries/README.md
Z User 3f0893cdf7 refactor: switch from sidecar IPC to webview-based RustDesk integration
Previous approach used Tauri sidecar binary with IPC commands. New approach
uses the RustDesk web architecture correctly:

- RustDesk server runs as native binary in --server mode (ports 21115-21119)
- RustDesk web client (Flutter web build) loaded in a Tauri webview window
- Web client communicates with server via WebSocket (21118/21119)

Backend changes:
- main.rs: Simplified IPC - start/stop server + open webview window
- Removed tokio dependency (no longer needed)
- Removed sidecar bundle config from tauri.conf.json

Frontend changes:
- RemoteDesktop.js: Toggle server on/off, launch web client webview
- New UI with server control section + web client launcher
- Updated CSS for the new layout
- Updated HTML with server URL input and launch button

Documentation:
- Updated binaries/README.md with full build pipeline:
  1. Build RustDesk native binary
  2. Build Flutter web client
  3. WASM bridge dependency note
  4. Server ports reference
2026-04-06 19:35:50 +00:00

96 lines
2.7 KiB
Markdown

# RustDesk Integration — Build Instructions
## Architecture
```
Shelled OS (Tauri)
├── Main Window: OS desktop UI (taskbar, popups)
├── RustDesk Server: Native binary (--server mode, ports 21115-21119)
└── RustDesk Web Client: Flutter web build loaded in a Tauri webview
└── Connects to server via WebSocket (ws://localhost:21118, ws://localhost:21119)
```
## Step 1: Build RustDesk Native Binary
The RustDesk binary is built from `shelled/rustdesk-as-ref/`.
### Prerequisites (Windows)
- Rust toolchain (`rustup`)
- vcpkg with: `libvpx`, `libyuv`, `opus`, `aom`
- Visual Studio Build Tools (C++ workload)
```powershell
set VCPKG_ROOT=C:\path\to\vcpkg
cd shelled\rustdesk-as-ref
cargo build --release
```
### Copy binary
```powershell
mkdir shelled\shelled-os-ui\src-tauri\binaries
copy target\release\rustdesk.exe shelled\shelled-os-ui\src-tauri\binaries\rustdesk.exe
```
## Step 2: Build RustDesk Web Client
The web client is a Flutter web build that communicates with the server via WebSocket.
### Prerequisites
- Flutter SDK 3.24+
- The `flutter/web/js/` WASM bridge (from `rustdesk-web-client` project)
### Build
```powershell
cd shelled\rustdesk-as-ref\flutter
# Install web dependencies
flutter pub get
flutter create --platforms web . # Generate web/ directory if missing
# Build Flutter web
flutter build web --release
```
### Copy to Shelled OS
```powershell
mkdir shelled\shelled-os-ui\rustdesk-web
xcopy build\web\* shelled\shelled-os-ui\rustdesk-web\ /E
```
### Note on the WASM Bridge
The RustDesk web client requires a JS/WASM bridge layer that provides:
- `setByName(name, value)` — Flutter → Rust/WASM commands
- `getByName(name, value)` — Rust/WASM → Flutter data
- `init()` — Initialize the connection
This bridge was removed from the main RustDesk repo. You'll need to get it from:
- GitHub Releases: `web_deps.tar.gz` from `rustdesk/doc.rustdesk.com`
- Or the `MonsieurBiche/rustdesk-web-client` fork's `fix-build` branch
## Step 3: Run Shelled OS
```powershell
cd shelled\shelled-os-ui
npm run dev
```
### Using the Remote Desktop
1. Click the Remote Desktop icon in the taskbar
2. Click "Start Server" to launch the RustDesk server
3. Click "Launch" to open the web client in a new window
4. Connect to remote machines through the web client
## Server Ports
| Port | Protocol | Purpose |
|------|----------|---------|
| 21115 | TCP | NAT type test |
| 21116 | TCP+UDP | ID registration & signaling |
| 21117 | TCP | Relay server |
| 21118 | TCP/WS | WebSocket signaling (web client) |
| 21119 | TCP/WS | WebSocket relay (web client) |
## WebSocket URLs (for web client)
- Signal: `ws://localhost:21118` (or `wss://` behind reverse proxy)
- Relay: `ws://localhost:21119` (or `wss://` behind reverse proxy)