feat: add the settings window

This commit is contained in:
Kevin Yue
2023-07-09 10:06:44 +08:00
parent 963b7d5407
commit bf96a88e21
45 changed files with 1470 additions and 641 deletions

View File

@@ -1,7 +1,12 @@
use crate::auth::{self, AuthData, AuthRequest, SamlBinding, SamlLoginParams};
use crate::{
auth::{self, AuthData, AuthRequest, SamlBinding, SamlLoginParams},
utils::get_openssl_conf,
utils::get_openssl_conf_path,
};
use gpcommon::{Client, ServerApiError, VpnStatus};
use std::sync::Arc;
use tauri::{AppHandle, State};
use tokio::fs;
#[tauri::command]
pub(crate) async fn service_online<'a>(client: State<'a, Arc<Client>>) -> Result<bool, ()> {
@@ -47,3 +52,22 @@ pub(crate) async fn saml_login(
};
auth::saml_login(params).await
}
#[tauri::command]
pub(crate) fn os_version() -> String {
whoami::distro()
}
#[tauri::command]
pub(crate) fn openssl_config() -> String {
get_openssl_conf()
}
#[tauri::command]
pub(crate) async fn update_openssl_config(app_handle: AppHandle) -> tauri::Result<()> {
let openssl_conf = get_openssl_conf();
let openssl_conf_path = get_openssl_conf_path(&app_handle);
fs::write(openssl_conf_path, openssl_conf).await?;
Ok(())
}