feat(settings): add debug page

* Create debug.rs

* Update settings.vue to add tab for debug

* Update main.scss to add light theme

* Update interface.vue to add light mode

* Create debug.vue

* Update debug.vue too add open log button

* Update lib.rs

* Update debug.rs

* Update debug.rs

* Update lib.rs

* Update lib.rs

* Update debug.rs

* Update debug.vue

* fix(debug): refactor and cleanup

* revert(theme): revert light theming

---------

Co-authored-by: DecDuck <declanahofmeyr@gmail.com>
This commit is contained in:
Aden Lindsay
2025-01-05 17:26:33 +10:30
committed by GitHub
parent 0a0d9d6294
commit 02f8591a60
5 changed files with 206 additions and 5 deletions

23
src-tauri/src/debug.rs Normal file
View File

@ -0,0 +1,23 @@
use crate::{DATA_ROOT_DIR, DB};
use serde::Serialize;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SystemData {
client_id: String,
base_url: String,
data_dir: String,
}
#[tauri::command]
pub fn fetch_system_data() -> Result<SystemData, String> {
let db_handle = DB.borrow_data().map_err(|e| e.to_string())?;
let system_data = SystemData {
client_id: db_handle.auth.as_ref().unwrap().client_id.clone(),
base_url: db_handle.base_url.clone(),
data_dir: DATA_ROOT_DIR.lock().unwrap().to_string_lossy().to_string(),
};
drop(db_handle);
Ok(system_data)
}

View File

@ -3,21 +3,27 @@ mod db;
mod downloads;
mod library;
mod autostart;
mod cleanup;
mod debug;
mod process;
mod remote;
mod state;
#[cfg(test)]
mod tests;
mod autostart;
use crate::autostart::{get_autostart_enabled, toggle_autostart};
use crate::db::DatabaseImpls;
use auth::{auth_initiate, generate_authorization_header, manual_recieve_handshake, recieve_handshake, retry_connect, sign_out};
use auth::{
auth_initiate, generate_authorization_header, manual_recieve_handshake, recieve_handshake,
retry_connect, sign_out,
};
use cleanup::{cleanup_and_exit, quit};
use db::{
add_download_dir, delete_download_dir, fetch_download_dir_stats, DatabaseInterface, GameStatus,
DATA_ROOT_DIR,
};
use debug::fetch_system_data;
use downloads::download_commands::*;
use downloads::download_manager::DownloadManager;
use downloads::download_manager_builder::DownloadManagerBuilder;
@ -47,7 +53,6 @@ use tauri::menu::{Menu, MenuItem, PredefinedMenuItem};
use tauri::tray::TrayIconBuilder;
use tauri::{AppHandle, Manager, RunEvent, WindowEvent};
use tauri_plugin_deep_link::DeepLinkExt;
use crate::autostart::{get_autostart_enabled, toggle_autostart};
#[derive(Clone, Copy, Serialize)]
pub enum AppStatus {
@ -217,6 +222,7 @@ pub fn run() {
// Core utils
fetch_state,
quit,
fetch_system_data,
// Auth
auth_initiate,
retry_connect,
@ -250,7 +256,7 @@ pub fn run() {
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_autostart::init(
tauri_plugin_autostart::MacosLauncher::LaunchAgent,
Some(vec!["--minimize"])
Some(vec!["--minimize"]),
))
.setup(|app| {
let handle = app.handle().clone();