- Rust 94.7%
- Nix 4.2%
- CSS 0.7%
- Dockerfile 0.3%
- JavaScript 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
The client carried a hand-written copy of the Mir API in src/api.rs — ~70 types and 63 request functions — that drifted from the server silently. They now come from the shared mir-api crate in the mir repository, where every call is checked against the real router. api.rs keeps only what a browser UI needs: a client built from the stored credentials (api::mir()), the cached itemdb and locations, and on-screen labels and badge colours. Pages call mir-api methods directly. Instance, flow-run and demand routes take Uuid ids. Flow runs and demand lists are fetched across all pages rather than the server's first page. reqwest with native-tls is gone from the direct dependencies; mir-api brings reqwest with rustls (fetch in the browser). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
| .cargo | ||
| .woodpecker | ||
| assets | ||
| src | ||
| .gitignore | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Containerfile | ||
| Dioxus.toml | ||
| flake.lock | ||
| flake.nix | ||
| nginx.conf | ||
| README.md | ||
| rust-toolchain.toml | ||
| tailwind.config.js | ||
| tailwind.css | ||
Mir Client
A Dioxus web client for Mir.
Development
The project ships a Nix flake with a complete development shell — a pinned Rust
toolchain (with the wasm32-unknown-unknown target), the matching dx
(dioxus-cli), wasm-bindgen, tailwindcss, and the native libraries needed for
the optional desktop build.
nix develop
Then run the web app with hot reload:
dx serve --platform web
dx serve proxies /api/* to a local mir on localhost:8080 (see
Dioxus.toml), so the dev setup is same-origin like production. Start mir
with cargo run -- example/config.toml and log in with the prefilled
instance URL (<origin>/api). For a remote server, enter its API base,
e.g. https://mir.example.org/api.
To produce a production bundle (output under target/dx/mir_client/release/web/public):
dx bundle --platform web --release --debug-symbols false
--debug-symbols falsestrips DWARF debug info, which otherwise crashes
binaryen'swasm-optduring release optimization.
Tailwind CSS is compiled automatically by
build.rs(it shells out to the
tailwindcssbinary provided by the dev shell), so there's no separate watch
step to run.
Without Nix
If you prefer not to use Nix, you'll need to match the versions yourself:
- Rust (stable) with the
wasm32-unknown-unknowntarget dioxus-cli0.7.9wasm-bindgen-cli0.2.125tailwindcss3.x
Build & Deploy
The flake builds a reproducible production artifact and a self-contained nginx
container image (no external/private flake dependencies):
nix build .#mir_client # static site -> result/public
nix build .#containerImage # OCI image serving the site via nginx
The API
Request and response types and the HTTP calls come from the mir-api crate
in the mir repository, where every call is
checked against the server. Missing an endpoint? Add it there, with a contract
test. To build against a local mir checkout instead of its main branch:
cargo check --config 'patch."https://git.hydrar.de/red/mir".mir-api.path="../mir/crates/mir-api"'
Project layout
.
├─ assets/ # static assets (favicon, CSS); tailwind.css is generated
├─ src/
│ ├─ main.rs # app entry point + routing
│ ├─ api.rs # session client, item cache, UI labels
│ ├─ page/ # routed pages
│ ├─ qrscan.rs # QR code scanning
│ ├─ setup.rs # initial credential setup
│ └─ store.rs # local storage helpers
├─ flake.nix # dev shell + build + container
├─ rust-toolchain.toml
└─ Dioxus.toml