P1f: self-contained Tauri host; complete P1
This commit is contained in:
+5
-2
@@ -36,14 +36,17 @@ npm --prefix app run tauri build -- --bundles deb
|
||||
|
||||
The bundle targets are `deb` and `appimage`. The icon at `src-tauri/icons/icon.png` is a P0 placeholder.
|
||||
|
||||
## Verified build
|
||||
## Self-contained app
|
||||
|
||||
The app now starts the ZHILA host (engine, session, SQLite project, assets, loopback wire) inside its own process. The built window does not need the daemon.
|
||||
|
||||
```bash
|
||||
npm --prefix ui run build
|
||||
cd app
|
||||
./node_modules/.bin/tauri build --no-bundle
|
||||
# with the daemon running:
|
||||
./src-tauri/target/release/zhila-app
|
||||
```
|
||||
|
||||
The host binds `127.0.0.1:4317` with the development token `dev` and loads `~/.local/share/zhila/descent-04`. For browser development run the standalone daemon instead; both cannot own the port at the same time.
|
||||
|
||||
`cargo check --manifest-path app/src-tauri/Cargo.toml` and the release build pass. The earlier `dbus-1`/`webkit2gtk`/`gtk` pkg-config failure is historical; those packages are installed. The window screenshot is `preview-tauri.png` at the repository root.
|
||||
|
||||
Generated
+903
-9
File diff suppressed because it is too large
Load Diff
@@ -12,5 +12,8 @@ tauri-build = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = [] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
zhila-daemon = { path = "../../crates/zhila-daemon" }
|
||||
tokio = { version = "1", features = ["rt"] }
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
|
||||
[workspace]
|
||||
|
||||
@@ -1,6 +1,44 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use zhila_daemon::{HostConfig, run};
|
||||
|
||||
fn main() {
|
||||
let _ = tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| "zhila_daemon=info,zhila_engine=info".into()),
|
||||
)
|
||||
.with_target(false)
|
||||
.try_init();
|
||||
|
||||
// The native app is self-contained: the engine, session, project store and
|
||||
// wire live in this process. The webview talks to the same loopback wire as
|
||||
// the browser-first surface.
|
||||
std::thread::spawn(|| {
|
||||
let runtime = match tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
{
|
||||
Ok(runtime) => runtime,
|
||||
Err(error) => {
|
||||
eprintln!("zhila host runtime: {error}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
runtime.block_on(async {
|
||||
if let Err(error) = run(HostConfig {
|
||||
port: 4317,
|
||||
token: "dev".into(),
|
||||
no_audio: false,
|
||||
project: None,
|
||||
})
|
||||
.await
|
||||
{
|
||||
eprintln!("zhila host: {error:#}");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
tauri::Builder::default()
|
||||
.run(tauri::generate_context!())
|
||||
.expect("ZHILA could not open its window");
|
||||
|
||||
Reference in New Issue
Block a user