Update README and API for Docker integration and app management
- Revised README.md to clarify the use of Docker alongside Podman for containerization. - Updated API documentation to reflect new RPC endpoints, including `auth.logout`. - Enhanced WebSocket handling in the API for better connection management. - Modified Neode UI to utilize a curated list of Docker-based applications, replacing previous Start9 registry calls. - Improved error handling and logging in the marketplace for better user experience.
This commit is contained in:
@@ -80,17 +80,35 @@ impl ApiHandler {
|
||||
|
||||
let (mut tx, mut rx) = ws_stream.split();
|
||||
|
||||
// Send periodic pings to keep connection alive
|
||||
let ping_interval = tokio::time::interval(tokio::time::Duration::from_secs(30));
|
||||
tokio::pin!(ping_interval);
|
||||
|
||||
// Keep connection open; UI may send/receive JSON patches. For now just accept and ignore.
|
||||
while let Some(msg) = rx.next().await {
|
||||
match msg {
|
||||
Ok(Message::Close(_)) => break,
|
||||
Ok(Message::Ping(data)) => {
|
||||
let _ = tx.send(Message::Pong(data)).await;
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = ping_interval.tick() => {
|
||||
if tx.send(Message::Ping(vec![])).await.is_err() {
|
||||
debug!("Failed to send ping, connection likely closed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
debug!("WebSocket stream error: {}", e);
|
||||
break;
|
||||
msg = rx.next() => {
|
||||
match msg {
|
||||
Some(Ok(Message::Close(_))) => break,
|
||||
Some(Ok(Message::Pong(_))) => {
|
||||
debug!("Received pong");
|
||||
}
|
||||
Some(Ok(Message::Ping(data))) => {
|
||||
let _ = tx.send(Message::Pong(data)).await;
|
||||
}
|
||||
Some(Ok(_)) => {}
|
||||
Some(Err(e)) => {
|
||||
debug!("WebSocket stream error: {}", e);
|
||||
break;
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ impl RpcHandler {
|
||||
"echo" => self.handle_echo(rpc_req.params).await,
|
||||
"server.echo" => self.handle_echo(rpc_req.params).await,
|
||||
"auth.login" => self.handle_auth_login(rpc_req.params).await,
|
||||
"auth.logout" => self.handle_auth_logout().await,
|
||||
"container-install" => self.handle_container_install(rpc_req.params).await,
|
||||
"container-start" => self.handle_container_start(rpc_req.params).await,
|
||||
"container-stop" => self.handle_container_stop(rpc_req.params).await,
|
||||
@@ -152,6 +153,14 @@ impl RpcHandler {
|
||||
Ok(serde_json::Value::Null)
|
||||
}
|
||||
|
||||
async fn handle_auth_logout(&self) -> Result<serde_json::Value> {
|
||||
// For now, just return success. In a full implementation, this would:
|
||||
// - Invalidate session tokens
|
||||
// - Clear cookies (if we were managing them)
|
||||
// - Close authenticated WebSocket connections
|
||||
Ok(serde_json::Value::Null)
|
||||
}
|
||||
|
||||
async fn handle_container_install(
|
||||
&self,
|
||||
params: Option<serde_json::Value>,
|
||||
|
||||
Reference in New Issue
Block a user