feat: add static previews to the room pane

The preview tool could only name a port, so a static build needed a
server the terminal had to keep alive. `preview` now accepts a path:
the app reads the file or folder over the room's ssh sandbox and serves
it from a signed host, with `..` and dotfiles refused and a 16 MiB cap.

The target is stored with the room and replayed as a durable event. The
pane shows a static path with a reload control and keeps the port field
as a local fallback.
This commit is contained in:
vhaudiquet committed 2026-11-28 11:24:57 +01:00
1 parent 5be17cf4ef
commit 36de0aace7
20 files changed
+1046 -145

No files matched your search

+19
View File
@@ -67,6 +67,25 @@ pub struct User {
pub avatar_updated_at: Option<i64>,
}
/// What the room's preview pane shows: a port inside the sandbox, or
/// a static file or folder served by the app.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(tag = "kind", rename_all = "lowercase")]
pub enum PreviewTarget {
/// A listener inside the sandbox.
Port { port: u16 },
/// A file, or a folder with an `index.html`, read over ssh and
/// served from the signed preview host.
Static {
/// The workspace-relative path the agent named.
path: String,
/// The workspace-relative directory the URL paths resolve in.
root: String,
/// The workspace-relative file a request for `/` serves.
entry: String,
},
}
/// One server-sent event. Durable events are also rows in `events`;
/// deltas are live only.
#[derive(Debug, Clone, Serialize, Deserialize)]