Update UI components and state management
This commit is contained in:
parent
9a2596ed4a
commit
1df0df222f
8 changed files with 2 additions and 59 deletions
20
Cargo.toml
20
Cargo.toml
|
|
@ -53,21 +53,5 @@ urlencoding = "2.1"
|
|||
uuid = { version = "1.11", features = ["serde", "v4"] }
|
||||
webbrowser = "0.8"
|
||||
|
||||
[lints.rust]
|
||||
unused_imports = "warn"
|
||||
unused_variables = "warn"
|
||||
unused_mut = "warn"
|
||||
unsafe_code = "deny"
|
||||
missing_debug_implementations = "warn"
|
||||
|
||||
[lints.clippy]
|
||||
all = "warn"
|
||||
pedantic = "warn"
|
||||
nursery = "warn"
|
||||
cargo = "warn"
|
||||
unwrap_used = "warn"
|
||||
expect_used = "warn"
|
||||
panic = "warn"
|
||||
todo = "warn"
|
||||
# Disabled: transitive dependencies we cannot control
|
||||
multiple_crate_versions = "allow"
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
6
build.rs
6
build.rs
|
|
@ -1,9 +1,3 @@
|
|||
//! Build script for botui
|
||||
//!
|
||||
//! This is a minimal build script since botui is now a pure web project.
|
||||
//! Tauri build requirements have been moved to the botapp crate.
|
||||
|
||||
fn main() {
|
||||
// No build steps required for pure web UI
|
||||
// Tauri-specific builds are now in botapp
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
//! HTTP client for communicating with botserver
|
||||
//!
|
||||
//! This module re-exports the HTTP client from botlib.
|
||||
//! All implementation is now in the shared library.
|
||||
|
||||
#![cfg(not(feature = "desktop"))]
|
||||
|
||||
// Re-export everything from botlib's http_client
|
||||
pub use botlib::http_client::*;
|
||||
pub use botlib::models::ApiResponse;
|
||||
|
|
|
|||
10
src/lib.rs
10
src/lib.rs
|
|
@ -1,16 +1,6 @@
|
|||
//! `BotUI` - General Bots Pure Web UI
|
||||
//!
|
||||
//! This crate provides the web UI layer for General Bots:
|
||||
//! - Serves static HTMX UI files (suite, minimal)
|
||||
//! - Proxies API requests to botserver
|
||||
//! - `WebSocket` support for real-time communication
|
||||
//!
|
||||
//! For desktop/mobile native features, see the `botapp` crate which
|
||||
//! wraps this pure web UI with Tauri.
|
||||
|
||||
pub mod shared;
|
||||
pub mod ui_server;
|
||||
|
||||
// Re-export commonly used types
|
||||
pub use shared::AppState;
|
||||
pub use ui_server::configure_router;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//! `BotUI` main entry point
|
||||
//!
|
||||
//! Starts the web UI server for General Bots.
|
||||
|
||||
use log::info;
|
||||
use std::net::SocketAddr;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
//! Shared types and state management for `BotUI`
|
||||
//!
|
||||
//! This module provides shared application state and utilities
|
||||
//! used across the UI server.
|
||||
|
||||
pub mod state;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,13 @@
|
|||
//! Application state management
|
||||
//!
|
||||
//! This module contains the shared application state that is passed to all
|
||||
//! route handlers and provides access to the `BotServer` client.
|
||||
|
||||
use botlib::http_client::BotServerClient;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Application state shared across all handlers
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AppState {
|
||||
/// HTTP client for communicating with `BotServer`
|
||||
pub client: Arc<BotServerClient>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
/// Create a new application state
|
||||
///
|
||||
/// Uses `BOTSERVER_URL` environment variable if set, otherwise defaults to localhost:8080
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
let url = std::env::var("BOTSERVER_URL").ok();
|
||||
|
|
@ -25,7 +16,6 @@ impl AppState {
|
|||
}
|
||||
}
|
||||
|
||||
/// Check if the `BotServer` is healthy
|
||||
pub async fn health_check(&self) -> bool {
|
||||
self.client.health_check().await
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//! UI Server module for `BotUI`
|
||||
//!
|
||||
//! Handles HTTP routing, WebSocket proxying, and static file serving.
|
||||
|
||||
use axum::{
|
||||
body::Body,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue