mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-03-27 01:13:09 +00:00
feat(servo-shell): wire appd WebSocket port discovery at startup
appd_ws_port() -> u16: - Checks WEFT_APPD_WS_PORT env var first. - Falls back to reading XDG_RUNTIME_DIR/weft/appd.wsport. - Falls back to hardcoded default 7410. run() now calls appd_ws_port() and passes the result to embed_servo. embed_servo signature updated to accept ws_port: u16. When the Servo embedder is implemented, it injects the port as window.WEFT_APPD_WS_PORT before loading the system UI HTML.
This commit is contained in:
parent
6d88104f28
commit
d6ede23183
1 changed files with 28 additions and 2 deletions
|
|
@ -24,7 +24,10 @@ fn run() -> anyhow::Result<()> {
|
|||
let html_path = system_ui_html_path()?;
|
||||
tracing::info!(path = %html_path.display(), "system UI entry point located");
|
||||
|
||||
embed_servo(&wayland_display, &html_path)
|
||||
let ws_port = appd_ws_port();
|
||||
tracing::info!(ws_port, "appd WebSocket port");
|
||||
|
||||
embed_servo(&wayland_display, &html_path, ws_port)
|
||||
}
|
||||
|
||||
fn system_ui_html_path() -> anyhow::Result<PathBuf> {
|
||||
|
|
@ -42,7 +45,30 @@ fn system_ui_html_path() -> anyhow::Result<PathBuf> {
|
|||
)
|
||||
}
|
||||
|
||||
fn embed_servo(_wayland_display: &str, _html_path: &std::path::Path) -> anyhow::Result<()> {
|
||||
fn appd_ws_port() -> u16 {
|
||||
if let Ok(explicit) = std::env::var("WEFT_APPD_WS_PORT")
|
||||
&& let Ok(n) = explicit.trim().parse::<u16>()
|
||||
{
|
||||
return n;
|
||||
}
|
||||
if let Ok(runtime_dir) = std::env::var("XDG_RUNTIME_DIR") {
|
||||
let port_file = std::path::Path::new(&runtime_dir)
|
||||
.join("weft")
|
||||
.join("appd.wsport");
|
||||
if let Ok(contents) = std::fs::read_to_string(&port_file)
|
||||
&& let Ok(n) = contents.trim().parse::<u16>()
|
||||
{
|
||||
return n;
|
||||
}
|
||||
}
|
||||
7410
|
||||
}
|
||||
|
||||
fn embed_servo(
|
||||
_wayland_display: &str,
|
||||
_html_path: &std::path::Path,
|
||||
_ws_port: u16,
|
||||
) -> anyhow::Result<()> {
|
||||
anyhow::bail!(
|
||||
"Servo embedding not yet implemented; \
|
||||
see docs/architecture/winit-wayland-audit.md for gap assessment"
|
||||
|
|
|
|||
Loading…
Reference in a new issue