Files
dbx/src-web/src/state.rs
T
t8y2 0f40488bf1 feat(web): add password setup page, change password, and settings tabs
- First-time visitors see a password setup page instead of open access
- Password persisted to SQLite (env var DBX_PASSWORD takes priority)
- Add change password in settings dialog (Security tab, web only)
- Split settings dialog into Editor and Security tabs
- Argon2 hashing for all password storage
2026-05-05 22:22:04 +08:00

20 lines
566 B
Rust

use dbx_core::connection::AppState;
use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::{broadcast, Mutex, RwLock};
pub struct LoginRateLimit {
pub fail_count: u32,
pub locked_until: Option<std::time::Instant>,
}
pub struct WebState {
pub app: Arc<AppState>,
pub data_dir: PathBuf,
pub password_hash: RwLock<Option<String>>,
pub sessions: RwLock<HashSet<String>>,
pub sse_channels: RwLock<HashMap<String, broadcast::Sender<String>>>,
pub login_rate_limit: Mutex<LoginRateLimit>,
}