refactor backend
This commit is contained in:
78
src-tauri/src/models.rs
Normal file
78
src-tauri/src/models.rs
Normal file
@@ -0,0 +1,78 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ScanResponse {
|
||||
pub browsers: Vec<BrowserView>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BrowserView {
|
||||
pub browser_id: String,
|
||||
pub browser_name: String,
|
||||
pub data_root: String,
|
||||
pub profiles: Vec<ProfileSummary>,
|
||||
pub extensions: Vec<ExtensionSummary>,
|
||||
pub bookmarks: Vec<BookmarkSummary>,
|
||||
pub stats: BrowserStats,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BrowserStats {
|
||||
pub profile_count: usize,
|
||||
pub extension_count: usize,
|
||||
pub bookmark_count: usize,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileSummary {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub email: Option<String>,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_label: String,
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExtensionSummary {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub version: Option<String>,
|
||||
pub icon_data_url: Option<String>,
|
||||
pub profile_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BookmarkSummary {
|
||||
pub url: String,
|
||||
pub title: String,
|
||||
pub profile_ids: Vec<String>,
|
||||
}
|
||||
|
||||
pub struct BrowserDefinition {
|
||||
pub id: &'static str,
|
||||
pub name: &'static str,
|
||||
pub local_app_data_segments: &'static [&'static str],
|
||||
}
|
||||
|
||||
pub struct TempExtension {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub version: Option<String>,
|
||||
pub icon_data_url: Option<String>,
|
||||
pub profile_ids: BTreeSet<String>,
|
||||
}
|
||||
|
||||
pub struct TempBookmark {
|
||||
pub url: String,
|
||||
pub title: String,
|
||||
pub profile_ids: BTreeSet<String>,
|
||||
}
|
||||
Reference in New Issue
Block a user