Skip to content

Commit

Permalink
feat: Re-implement opening repair window
Browse files Browse the repository at this point in the history
  • Loading branch information
GeckoEidechse committed Jan 3, 2025
1 parent 5e2959e commit d8c220f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn run() {
util::get_flightcore_version_number,
util::get_server_player_count,
util::is_debug_mode,
util::open_repair_window,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down
23 changes: 23 additions & 0 deletions src-tauri/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@ pub async fn get_flightcore_version_number() -> String {
}
}

/// Spawns repair window
#[tauri::command]
pub async fn open_repair_window(handle: tauri::AppHandle) -> Result<(), String> {
// Spawn new window
let repair_window = match tauri::WebviewWindowBuilder::new(
&handle,
"RepairWindow",
tauri::WebviewUrl::App("/#/repair".into()),
)
.build()
{
Ok(res) => res,
Err(err) => return Err(err.to_string()),
};

// Set window title
match repair_window.set_title("FlightCore Repair Window") {
Ok(()) => (),
Err(err) => return Err(err.to_string()),
};
Ok(())
}

/// Fetches `/client/servers` endpoint from master server
async fn fetch_server_list() -> Result<String, anyhow::Error> {
let url = format!("{MASTER_SERVER_URL}{SERVER_BROWSER_ENDPOINT}");
Expand Down

0 comments on commit d8c220f

Please sign in to comment.