1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! The embedded Svelte SPA, kept in the binary with nothing serving it yet
//! (#6286).
//!
//! Why the assets stay: ADR-0032 moves this dashboard onto `trusty-console`,
//! which mounts a sibling daemon's SPA by vendoring its `rust_embed` assets —
//! the disposition #6287 settled for trusty-analyze. That mount is a
//! fast-follow, and deleting `ui/dist/` now would mean restoring it then. The
//! files are git-tracked and `build.rs` regenerates them, so keeping the embed
//! costs binary size and nothing else.
//!
//! Why the handler is gone: `static_handler` was an axum fallback route and
//! `serve_embedded` built an `axum::response::Response`. Neither can exist
//! without the listener this crate no longer binds, and keeping them would have
//! meant keeping an axum dependency for code no request can reach.
//!
//! What is left: [`WebAssets`] and [`asset`], which answer "what is in the
//! bundle" and "give me these bytes and their content type" — the two questions
//! a console-side mount asks, with no framework in either.
//!
//! Test: `embedded_bundle_carries_an_index_html`.
use RustEmbed;
/// Embedded UI assets produced by `pnpm build` in `ui/`.
///
/// `build.rs` runs the Vite build before compilation, so the folder is always
/// populated. In this monorepo the UI lives inside the crate rather than at the
/// repo root, which is why the path is not the upstream `../../ui/dist/`.
;
/// One embedded file: its bytes and the content type to serve it as.
/// Look up one embedded asset, defaulting an empty path to the SPA shell.
///
/// Why: hash-based routing lives client-side, so a mount serves `index.html`
/// for any path that is not a real file — but that fallback decision belongs to
/// whoever owns the route, not here. This answers only whether the file exists.
/// What: `None` when the path is not in the bundle; otherwise the bytes plus
/// the `mime_guess` content type.
/// Test: `embedded_bundle_carries_an_index_html`.