first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+2 -1
View File
@@ -11,4 +11,5 @@ log.workspace = true
tokio.workspace = true
tower.workspace = true
tower-http = { workspace = true, features = ["trace", "cors"] }
galaxyui.workspace = true
galaxyui_core.workspace = true
galaxy_core.workspace = true
+25 -5
View File
@@ -1,11 +1,12 @@
use std::net::SocketAddr;
use galaxyui::{Entity, ModelContext, SingletonEntity};
use galaxyui_core::{Entity, ModelContext, SingletonEntity};
use tower_http::trace::TraceLayer;
use galaxy_core::channel::{Channel, ChannelState};
// Spells "Warp" - should hopefully not conflict with other ports.
// Does not conflict with known ports on https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
const PORT: u16 = 9277;
const PORT_BASE: u16 = 9277;
/// A singleton model for the small HTTP server that is run by the Warp client.
pub struct HttpServer {
@@ -46,14 +47,33 @@ impl HttpServer {
}
runtime.spawn(async move {
let addr = SocketAddr::from(([127, 0, 0, 1], PORT));
let listener = tokio::net::TcpListener::bind(addr).await?;
let addr = SocketAddr::from(([127, 0, 0, 1], Self::port()));
let listener = match tokio::net::TcpListener::bind(addr).await {
Ok(listener) => listener,
Err(err) => {
log::error!("Failed to bind local HTTP server to {addr}: {err}");
return;
}
};
axum::serve(listener, root.layer(TraceLayer::new_for_http())).await
if let Err(err) = axum::serve(listener, root.layer(TraceLayer::new_for_http())).await {
log::error!("Local HTTP server exited with error: {err}");
}
});
Ok(runtime)
}
pub fn port() -> u16 {
match ChannelState::channel() {
Channel::Stable => PORT_BASE,
Channel::Preview => PORT_BASE + 1,
Channel::Dev => PORT_BASE + 2,
Channel::Local => PORT_BASE + 3,
Channel::Integration => PORT_BASE + 4,
Channel::Oss => PORT_BASE + 5,
}
}
}
impl Entity for HttpServer {