mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-24 03:17:00 +00:00
- 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
20 lines
566 B
Rust
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>,
|
|
}
|