fix(#17): checking if the site connection is secure

This commit is contained in:
lencx
2022-12-12 12:30:13 +08:00
parent 325dbb305c
commit 5e295aeb1d
7 changed files with 155 additions and 31 deletions

View File

@@ -4,6 +4,7 @@ use std::{
path::{Path, PathBuf},
process::Command,
};
use tauri::Manager;
// use tauri::utils::config::Config;
pub fn chat_root() -> PathBuf {
@@ -61,3 +62,20 @@ pub fn open_file(path: PathBuf) {
#[cfg(target_os = "linux")]
Command::new("xdg-open").arg(path).spawn().unwrap();
}
pub fn clear_conf(app: &tauri::AppHandle) {
let root = chat_root();
let app2 = app.clone();
let msg = format!("Path: {}\nAre you sure to clear all ChatGPT configurations? Please backup in advance if necessary!", root.to_string_lossy());
tauri::api::dialog::ask(
app.get_window("core").as_ref(),
"Clear Config",
msg,
move |is_ok| {
if is_ok {
fs::remove_dir_all(root).unwrap();
tauri::api::process::restart(&app2.env());
}
},
);
}