From f6bcd83b7234265b2a34e8eb6e9db73adab86004 Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Fri, 4 Jul 2025 16:07:10 +0100 Subject: [PATCH] Removed redundant code --- frontend/src-tauri/src/lib.rs | 28 +++------------------------- frontend/vite.config.ts | 15 --------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/frontend/src-tauri/src/lib.rs b/frontend/src-tauri/src/lib.rs index 5aaabfd9a..0f4142308 100644 --- a/frontend/src-tauri/src/lib.rs +++ b/frontend/src-tauri/src/lib.rs @@ -27,7 +27,6 @@ fn reset_starting_flag() { *starting_guard = false; } - // Command to start the backend with bundled JRE #[tauri::command] async fn start_backend(app: tauri::AppHandle) -> Result { @@ -205,10 +204,7 @@ async fn start_backend(app: tauri::AppHandle) -> Result { // Look for startup indicators if output_str.contains("Started SPDFApplication") || - output_str.contains("Tomcat started") || - output_str.contains("Started on port") || - output_str.contains("Netty started") || - output_str.contains("Started StirlingPDF") { + output_str.contains("Navigate to "){ _startup_detected = true; add_log(format!("🎉 Backend startup detected: {}", output_str)); } @@ -296,7 +292,7 @@ async fn check_backend_health() -> Result { println!("💓 Health check response status: {}", status); if status.is_success() { match response.text().await { - Ok(body) => { + Ok(_body) => { Ok(true) } Err(e) => { @@ -423,25 +419,7 @@ pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_fs::init()) - .setup(|app| { - - // Automatically start the backend when Tauri starts - // let app_handle = app.handle().clone(); - // tauri::async_runtime::spawn( - // async move { - // match start_backend(app_handle).await { - // Ok(result) => { - // add_log(format!("🚀 Auto-started backend on Tauri startup: {}", result)); - // } - // Err(error) => { - // add_log(format!("❌ Failed to auto-start backend: {}", error)); - // } - // } - // }); - - Ok(()) - } - ) + .setup(|_app| {Ok(())}) .invoke_handler(tauri::generate_handler![start_backend, check_backend_health, check_jar_exists, get_opened_file]) .build(tauri::generate_context!()) .expect("error while building tauri application") diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index b62b4b3d8..fc93dbc18 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -2,21 +2,6 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; export default defineConfig({ - // prevent vite from obscuring rust errors - // clearScreen: false, - // // Env variables starting with the item of `envPrefix` will be exposed in tauri's source code through `import.meta.env`. - // envPrefix: ['VITE_', 'TAURI_ENV_*'], - // build: { - // // Tauri uses Chromium on Windows and WebKit on macOS and Linux - // target: - // process.env.TAURI_ENV_PLATFORM == 'windows' - // ? 'chrome105' - // : 'safari13', - // // don't minify for debug builds - // minify: !process.env.TAURI_ENV_DEBUG ? 'esbuild' : false, - // // produce sourcemaps for debug builds - // sourcemap: !!process.env.TAURI_ENV_DEBUG, - // }, plugins: [react()], server: { // make sure this port matches the devUrl port in tauri.conf.json file