mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-04-22 23:08:53 +02:00
Fix backend issues in desktop app (#4995)
# Description of Changes Fixes two distinct but related issues in the backend of the desktop app: - Correctly shows tools as unavaialable when the backend doesn't have the dependencies or has disabled them etc. (same as web version - this primarily didn't work on desktop because the app spawns before the backend is running) - Fixes infinite re-rendering issues caused by the app polling whether the backend is healthy or not
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
use reqwest;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn check_backend_health(port: u16) -> Result<bool, String> {
|
||||
let url = format!("http://localhost:{}/api/v1/info/status", port);
|
||||
|
||||
match reqwest::Client::new()
|
||||
.get(&url)
|
||||
.timeout(std::time::Duration::from_secs(5))
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
Ok(response) => Ok(response.status().is_success()),
|
||||
Err(_) => Ok(false), // Return false instead of error for connection failures
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ pub mod files;
|
||||
pub mod connection;
|
||||
pub mod auth;
|
||||
pub mod default_app;
|
||||
pub mod health;
|
||||
|
||||
pub use backend::{cleanup_backend, get_backend_port, start_backend};
|
||||
pub use files::{add_opened_file, clear_opened_files, get_opened_files};
|
||||
@@ -24,4 +23,3 @@ pub use auth::{
|
||||
start_oauth_login,
|
||||
};
|
||||
pub use default_app::{is_default_pdf_handler, set_as_default_pdf_handler};
|
||||
pub use health::check_backend_health;
|
||||
|
||||
@@ -6,7 +6,6 @@ mod state;
|
||||
|
||||
use commands::{
|
||||
add_opened_file,
|
||||
check_backend_health,
|
||||
cleanup_backend,
|
||||
clear_auth_token,
|
||||
clear_opened_files,
|
||||
@@ -94,7 +93,6 @@ pub fn run() {
|
||||
set_as_default_pdf_handler,
|
||||
is_first_launch,
|
||||
reset_setup_completion,
|
||||
check_backend_health,
|
||||
login,
|
||||
save_auth_token,
|
||||
get_auth_token,
|
||||
|
||||
Reference in New Issue
Block a user