xmpp/src-tauri/README.md
2026-05-07 17:53:39 +03:00

64 lines
1.8 KiB
Markdown

# Tauri wrapper for XMPP client
npm run tauri icon путь/к/картинке.png
Native desktop wrapper around the $mol XMPP client, packaged via [Tauri 2](https://tauri.app/).
## Prerequisites
1. **Rust toolchain** — install via [rustup](https://rustup.rs/).
2. **Node.js** — for the Tauri CLI.
3. **WebView2 runtime** (Windows 10+ has it built-in).
4. **mam** dev tool (already used for the $mol build).
```powershell
# from c:\dev\mam\xmpp
npm install
```
This pulls `@tauri-apps/cli` from package.json.
## Dev (live reload)
In **terminal 1** — start the $mol dev server at the repo root:
```powershell
cd c:\dev\mam
mam
```
This serves the app at `http://localhost:9080/xmpp/`.
In **terminal 2** — start Tauri pointing at that URL:
```powershell
cd c:\dev\mam\xmpp
npm run tauri:dev
```
A native window opens loading the XMPP client. Edits to `xmpp.view.ts` / `.view.tree` / `.view.css` rebuild the bundle (via `mam`) and the WebView reloads.
## Production build
```powershell
cd c:\dev\mam\xmpp
npm run tauri:build
```
The static frontend (`xmpp/index.html` + `xmpp/-/web.js` + locale json) is packed into the executable. Output in `src-tauri/target/release/bundle/`.
### Icons
`tauri build` needs PNG/ICO icons in `src-tauri/icons/`. Generate them once from any source PNG:
```powershell
npm run tauri icon path/to/source.png
```
This populates `src-tauri/icons/` with all the sizes referenced in `tauri.conf.json`.
## Notes
- `index.html` references `-/web.js` (the bundled file). Same path works in both `mam`'s dev server and the static Tauri bundle.
- CSP is disabled (`security.csp: null`) so the WebView can connect to arbitrary `wss://` XMPP servers.
- IndexedDB / Web Audio / clipboard paste / file picker — all standard WebView features, work out of the box.