feat: render the terminal with ghostty-web

ghostty-web runs Ghostty's VT parser as WebAssembly behind an xterm-compatible API. The component keeps its lifecycle; the imports and the WASM bootstrap change. The emulator imports on demand, so the 624 KB chunk loads only when the terminal pane opens.

The CSP needs wasm-unsafe-eval for WebAssembly compilation and data: in connect-src for the inlined module the library fetches. The terminal renders to a canvas, so the xterm stylesheet and FitAddon package are gone.
This commit is contained in:
vhaudiquet committed 2026-11-28 10:36:17 +01:00
1 parent 808a78afa8
commit 3f61dd4db8
7 files changed
+58 -58

No files matched your search

+3 -1
View File
@@ -171,9 +171,11 @@ async fn headers(State(state): State<Shared>, request: Request, next: Next) -> R
Some(source) => format!("'self' {source}"),
None => "'self'".to_owned(),
};
// ghostty-web compiles its inlined WASM in the browser. Keep the
// narrow wasm-unsafe-eval allowance and let it fetch the data: module.
let csp = format!(
"default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; \
script-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss:; frame-src {frame_src}; \
script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'; connect-src 'self' data: ws: wss:; frame-src {frame_src}; \
frame-ancestors 'self'; base-uri 'self'; form-action 'self'"
);
if let Ok(value) = HeaderValue::from_str(&csp) {