diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs index 8750bba..8177856 100644 --- a/src-tauri/src/config.rs +++ b/src-tauri/src/config.rs @@ -1,3 +1,5 @@ +use rand::distr::Alphanumeric; +use rand::{rng, Rng}; use serde::{Deserialize, Serialize}; use std::{ path::{Path, PathBuf}, @@ -12,13 +14,20 @@ pub struct Config { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct CoreCFG { pub home_path: Option, + #[serde(skip_serializing)] pub current_file: Option, + pub client_id: String, } impl Default for CoreCFG { fn default() -> Self { CoreCFG { home_path: None, current_file: None, + client_id: rng() + .sample_iter(&Alphanumeric) + .take(30) + .map(char::from) + .collect(), } } } @@ -35,6 +44,7 @@ pub fn load_config(path: Option) -> Config { }), } } + #[tauri::command] pub fn get_basepath(app_handle: tauri::AppHandle) -> Option { let config = app_handle.state::>();