mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-01 22:56:41 +00:00
[client] Add Wails3 + React desktop UI scaffold
Stage 1 of the client/ui (Fyne) replacement. Adds a new client/ui-wails module that runs on Linux/macOS/Windows from a single React + Vite + Tailwind frontend driven by a thin gRPC services layer in Go. - Single-module integration (no submodule): merge Wails3 into root go.mod with build tags !android !ios !freebsd !js so cross-compiles on those targets exclude the package automatically. - Seven gRPC-bound services: Connection, Settings, Networks, Profiles, Debug, Update, Peers. Peers bridges Status polling and SubscribeEvents to the Wails event bus (netbird:status, netbird:event). - Tray + window shell mirrors the Fyne menu 1:1 with hide-on-close, SIGUSR1 / Windows named-event for external "show window" triggers. - React pages cover functional parity for Status, Settings (3 tabs), Networks (3 tabs), Profiles, Debug, Update, QuickActions, LoginUrl. - SVG-sourced tray icons (12 source SVGs incl. macOS template variants) rasterized to PNG via task common:generate:tray:icons. - Linux launcher sets WEBKIT_DISABLE_DMABUF_RENDERER=1 in the .desktop Exec= line and in task linux:run so the app renders correctly under RDP, VirtualBox, KVM, and bare WMs (Fluxbox/dwm) without DRM access.
This commit is contained in:
85
client/ui-wails/README.md
Normal file
85
client/ui-wails/README.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# NetBird desktop UI (Wails3 + React)
|
||||
|
||||
Replaces `client/ui` (Fyne). One binary on Windows / macOS / Linux,
|
||||
talks to the NetBird daemon over gRPC, renders a React frontend in a
|
||||
WebView.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Go ≥ 1.25, Node ≥ 20, **pnpm** (`corepack enable && corepack prepare pnpm@latest --activate`)
|
||||
- `wails3` CLI: `go install github.com/wailsapp/wails/v3/cmd/wails3@latest`
|
||||
- `task`: `go install github.com/go-task/task/v3/cmd/task@latest`
|
||||
- A running NetBird daemon (default: `unix:///var/run/netbird.sock`,
|
||||
Windows `tcp://127.0.0.1:41731`)
|
||||
- Linux only: `libwebkit2gtk-4.1-dev`, `libgtk-3-dev`,
|
||||
`libayatana-appindicator3-dev`
|
||||
|
||||
## Develop without rebuilding
|
||||
|
||||
```bash
|
||||
cd client/ui-wails
|
||||
task dev
|
||||
```
|
||||
|
||||
`task dev` runs Vite (port 9245) + the Go binary + a `*.go` watcher.
|
||||
Frontend edits hot-reload instantly. Go edits trigger a rebuild and
|
||||
relaunch. Pass daemon flags after `--`:
|
||||
|
||||
```bash
|
||||
task dev -- --daemon-addr=tcp://127.0.0.1:41731
|
||||
```
|
||||
|
||||
For pure UI work (no native window, fastest loop):
|
||||
|
||||
```bash
|
||||
cd frontend && pnpm dev
|
||||
```
|
||||
|
||||
## Production build
|
||||
|
||||
```bash
|
||||
task build
|
||||
```
|
||||
|
||||
Output in `bin/`. Frontend assets are embedded into the binary.
|
||||
|
||||
### Cross-compile Windows from Linux
|
||||
|
||||
Install the mingw-w64 toolchain once:
|
||||
|
||||
```bash
|
||||
sudo apt install gcc-mingw-w64-x86-64 # Debian/Ubuntu
|
||||
sudo dnf install mingw64-gcc # Fedora
|
||||
sudo pacman -S mingw-w64-gcc # Arch
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=1 task windows:build
|
||||
```
|
||||
|
||||
Produces `bin/netbird-ui.exe`. macOS cross-compile from Linux is not
|
||||
supported (signing and notarization need a real Mac).
|
||||
|
||||
## Regenerating bindings
|
||||
|
||||
When a Go service signature changes:
|
||||
|
||||
```bash
|
||||
wails3 generate bindings
|
||||
```
|
||||
|
||||
`task dev` does this automatically on `*.go` save.
|
||||
|
||||
## Tray icons
|
||||
|
||||
Source SVGs live in `assets/svg/` (state.svg + state-macos.svg). After editing
|
||||
any SVG, rasterize to the PNGs the Go side embeds:
|
||||
|
||||
```bash
|
||||
task common:generate:tray:icons
|
||||
```
|
||||
|
||||
Requires Inkscape. Commit the resulting `assets/*.png` files alongside the
|
||||
SVG change so CI doesn't need Inkscape installed.
|
||||
Reference in New Issue
Block a user