added automatically generated client ids
This commit is contained in:
parent
58a2229cce
commit
615e09db16
1 changed files with 10 additions and 0 deletions
|
|
@ -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<PathBuf>,
|
||||
#[serde(skip_serializing)]
|
||||
pub current_file: Option<PathBuf>,
|
||||
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<PathBuf>) -> Config {
|
|||
}),
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_basepath(app_handle: tauri::AppHandle) -> Option<String> {
|
||||
let config = app_handle.state::<Mutex<Config>>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue