2025-03-25 16:44:28 +08:00
|
|
|
use custom_error::custom_error;
|
2025-03-06 12:32:59 +08:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
use tokio::sync::RwLock;
|
|
|
|
|
|
|
|
|
|
use crate::config::Config;
|
|
|
|
|
use crate::database::Database;
|
2025-03-10 19:01:11 +08:00
|
|
|
use crate::recorder::bilibili::client::BiliClient;
|
2025-03-06 12:32:59 +08:00
|
|
|
use crate::recorder_manager::RecorderManager;
|
|
|
|
|
|
|
|
|
|
custom_error! {
|
|
|
|
|
StateError
|
|
|
|
|
RecorderAlreadyExists = "Recorder already exists",
|
|
|
|
|
RecorderCreateError = "Recorder create error",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub struct State {
|
|
|
|
|
pub db: Arc<Database>,
|
|
|
|
|
pub client: Arc<BiliClient>,
|
|
|
|
|
pub config: Arc<RwLock<Config>>,
|
|
|
|
|
pub recorder_manager: Arc<RecorderManager>,
|
|
|
|
|
pub app_handle: tauri::AppHandle,
|
2025-03-25 16:44:28 +08:00
|
|
|
}
|