forked from boos/BoosAPI
refactor: purge Node.js, Rust is the one true backend
- Moved boosapi-rs/* to repo root - Deleted all Node.js source (src/server/, src/web/, scripts/) - Deleted node_modules, package.json, tsconfig, vite.config - Updated .gitignore and AGENTS.md for Rust-only stack - Fixed static file path for frontend dist/web/ - Dockerfile stays the same (already Rust-only) - Kept dist/web/ for Rust static serving
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ProxySurfaceState {
|
||||
sessions: Arc<Mutex<HashMap<String, SurfaceSession>>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SurfaceSession {
|
||||
pub id: String,
|
||||
pub model: String,
|
||||
pub channel_id: Option<i64>,
|
||||
pub metadata: Value,
|
||||
}
|
||||
|
||||
impl ProxySurfaceState {
|
||||
pub fn upsert_session(&self, session: SurfaceSession) {
|
||||
self.sessions.lock().insert(session.id.clone(), session);
|
||||
}
|
||||
|
||||
pub fn get_session(&self, id: &str) -> Option<SurfaceSession> {
|
||||
self.sessions.lock().get(id).cloned()
|
||||
}
|
||||
|
||||
pub fn remove_session(&self, id: &str) -> Option<SurfaceSession> {
|
||||
self.sessions.lock().remove(id)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user