Debug pin macro (#118)

* debug pin macro

* Added debug pinning macro

* working on windows

* removed remaining box pins
This commit is contained in:
Wyatt Verchere
2023-05-18 10:31:52 -07:00
committed by GitHub
parent 0801d7a145
commit 16407060f0
35 changed files with 1133 additions and 990 deletions

View File

@@ -4,6 +4,7 @@ use theseus::prelude::*;
/// Authenticate a user with Hydra - part 1
/// This begins the authentication flow quasi-synchronously, returning a URL to visit (that the user will sign in at)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_authenticate_begin_flow() -> Result<url::Url> {
Ok(auth::authenticate_begin_flow().await?)
}
@@ -12,6 +13,7 @@ pub async fn auth_authenticate_begin_flow() -> Result<url::Url> {
/// This completes the authentication flow quasi-synchronously, returning the sign-in credentials
/// (and also adding the credentials to the state)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_authenticate_await_completion() -> Result<Credentials> {
Ok(auth::authenticate_await_complete_flow().await?)
}
@@ -19,13 +21,13 @@ pub async fn auth_authenticate_await_completion() -> Result<Credentials> {
/// Refresh some credentials using Hydra, if needed
// invoke('auth_refresh',user)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_refresh(user: uuid::Uuid) -> Result<Credentials> {
Ok(auth::refresh(user).await?)
}
/// Remove a user account from the database
// invoke('auth_remove_user',user)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_remove_user(user: uuid::Uuid) -> Result<()> {
Ok(auth::remove_user(user).await?)
}
@@ -33,6 +35,7 @@ pub async fn auth_remove_user(user: uuid::Uuid) -> Result<()> {
/// Check if a user exists in Theseus
// invoke('auth_has_user',user)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_has_user(user: uuid::Uuid) -> Result<bool> {
Ok(auth::has_user(user).await?)
}
@@ -40,6 +43,7 @@ pub async fn auth_has_user(user: uuid::Uuid) -> Result<bool> {
/// Get a copy of the list of all user credentials
// invoke('auth_users',user)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_users() -> Result<Vec<Credentials>> {
Ok(auth::users().await?)
}
@@ -48,6 +52,7 @@ pub async fn auth_users() -> Result<Vec<Credentials>> {
/// Prefer to use refresh instead, as it will refresh the credentials as well
// invoke('auth_users',user)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn auth_get_user(user: uuid::Uuid) -> Result<Credentials> {
Ok(auth::get_user(user).await?)
}

View File

@@ -6,24 +6,28 @@ use theseus::prelude::*;
/// Get all JREs that exist on the system
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_get_all_jre() -> Result<Vec<JavaVersion>> {
Ok(jre::get_all_jre().await?)
}
// Finds the isntallation of Java 7, if it exists
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_find_jre_8_jres() -> Result<Vec<JavaVersion>> {
Ok(jre::find_java8_jres().await?)
}
// finds the installation of Java 17, if it exists
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_find_jre_17_jres() -> Result<Vec<JavaVersion>> {
Ok(jre::find_java17_jres().await?)
}
// Finds the highest version of Java 18+, if it exists
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_find_jre_18plus_jres() -> Result<Vec<JavaVersion>> {
Ok(jre::find_java18plus_jres().await?)
}
@@ -31,6 +35,7 @@ pub async fn jre_find_jre_18plus_jres() -> Result<Vec<JavaVersion>> {
// Autodetect Java globals, by searching the users computer.
// Returns a *NEW* JavaGlobals that can be put into Settings
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_autodetect_java_globals() -> Result<JavaGlobals> {
Ok(jre::autodetect_java_globals().await?)
}
@@ -38,6 +43,7 @@ pub async fn jre_autodetect_java_globals() -> Result<JavaGlobals> {
// Validates java globals, by checking if the paths exist
// If false, recommend to direct them to reassign, or to re-guess
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_validate_globals() -> Result<bool> {
Ok(jre::validate_globals().await?)
}
@@ -45,18 +51,21 @@ pub async fn jre_validate_globals() -> Result<bool> {
// Validates JRE at a given path
// Returns None if the path is not a valid JRE
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_get_jre(path: PathBuf) -> Result<Option<JavaVersion>> {
jre::check_jre(path).await.map_err(|e| e.into())
}
// Auto installs java for the given java version
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_auto_install_java(java_version: u32) -> Result<PathBuf> {
Ok(jre::auto_install_java(java_version).await?)
}
// Gets the maximum memory a system has available.
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn jre_get_max_memory() -> Result<u64> {
Ok(jre::get_max_memory().await?)
}

View File

@@ -14,6 +14,7 @@ pub struct Logs {
/// Get all Logs for a profile, sorted by datetime
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn logs_get_logs(
profile_uuid: Uuid,
clear_contents: Option<bool>,
@@ -29,6 +30,7 @@ pub async fn logs_get_logs(
/// Get a Log struct for a profile by profile id and datetime string
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn logs_get_logs_by_datetime(
profile_uuid: Uuid,
datetime_string: String,
@@ -38,6 +40,7 @@ pub async fn logs_get_logs_by_datetime(
/// Get the stdout for a profile by profile id and datetime string
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn logs_get_stdout_by_datetime(
profile_uuid: Uuid,
datetime_string: String,
@@ -47,6 +50,7 @@ pub async fn logs_get_stdout_by_datetime(
/// Get the stderr for a profile by profile id and datetime string
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn logs_get_stderr_by_datetime(
profile_uuid: Uuid,
datetime_string: String,
@@ -56,12 +60,14 @@ pub async fn logs_get_stderr_by_datetime(
/// Delete all logs for a profile by profile id
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn logs_delete_logs(profile_uuid: Uuid) -> Result<()> {
Ok(logs::delete_logs(profile_uuid).await?)
}
/// Delete a log for a profile by profile id and datetime string
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn logs_delete_logs_by_datetime(
profile_uuid: Uuid,
datetime_string: String,

View File

@@ -4,24 +4,28 @@ use daedalus::modded::Manifest;
/// Gets the game versions from daedalus
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn metadata_get_game_versions() -> Result<VersionManifest> {
Ok(theseus::metadata::get_minecraft_versions().await?)
}
/// Gets the fabric versions from daedalus
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn metadata_get_fabric_versions() -> Result<Manifest> {
Ok(theseus::metadata::get_fabric_versions().await?)
}
/// Gets the forge versions from daedalus
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn metadata_get_forge_versions() -> Result<Manifest> {
Ok(theseus::metadata::get_forge_versions().await?)
}
/// Gets the quilt versions from daedalus
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn metadata_get_quilt_versions() -> Result<Manifest> {
Ok(theseus::metadata::get_quilt_versions().await?)
}

View File

@@ -47,6 +47,7 @@ where
// Create a new HashMap with the same keys
// Values provided should not be used directly, as they are not guaranteed to be up-to-date
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn progress_bars_list(
) -> Result<std::collections::HashMap<uuid::Uuid, theseus::LoadingBar>> {
let res = theseus::EventState::list_progress_bars().await?;

View File

@@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};
use theseus::prelude::*;
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn pack_install_version_id(
version_id: String,
pack_title: String,
@@ -15,6 +16,7 @@ pub async fn pack_install_version_id(
}
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn pack_install_file(path: &Path) -> Result<PathBuf> {
let res = pack::install_pack_from_file(path.to_path_buf()).await?;
Ok(res)

View File

@@ -6,12 +6,14 @@ use uuid::Uuid;
// Checks if a process has finished by process UUID
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_has_finished_by_uuid(uuid: Uuid) -> Result<bool> {
Ok(process::has_finished_by_uuid(&uuid).await?)
}
// Gets process exit status by process UUID
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_exit_status_by_uuid(
uuid: Uuid,
) -> Result<Option<i32>> {
@@ -20,18 +22,21 @@ pub async fn process_get_exit_status_by_uuid(
// Gets all process UUIDs
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_all_uuids() -> Result<Vec<Uuid>> {
Ok(process::get_all_uuids().await?)
}
// Gets all running process UUIDs
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_all_running_uuids() -> Result<Vec<Uuid>> {
Ok(process::get_all_running_uuids().await?)
}
// Gets all process UUIDs by profile path
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_uuids_by_profile_path(
profile_path: &Path,
) -> Result<Vec<Uuid>> {
@@ -40,36 +45,42 @@ pub async fn process_get_uuids_by_profile_path(
// Gets the Profile paths of each *running* stored process in the state
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_all_running_profile_paths() -> Result<Vec<PathBuf>> {
Ok(process::get_all_running_profile_paths().await?)
}
// Gets the Profiles (cloned) of each *running* stored process in the state
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_all_running_profiles() -> Result<Vec<Profile>> {
Ok(process::get_all_running_profiles().await?)
}
// Gets process stderr by process UUID
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_stderr_by_uuid(uuid: Uuid) -> Result<String> {
Ok(process::get_stderr_by_uuid(&uuid).await?)
}
// Gets process stdout by process UUID
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_get_stdout_by_uuid(uuid: Uuid) -> Result<String> {
Ok(process::get_stdout_by_uuid(&uuid).await?)
}
// Kill a process by process UUID
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_kill_by_uuid(uuid: Uuid) -> Result<()> {
Ok(process::kill_by_uuid(&uuid).await?)
}
// Wait for a process to finish by process UUID
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn process_wait_for_by_uuid(uuid: Uuid) -> Result<()> {
Ok(process::wait_for_by_uuid(&uuid).await?)
}

View File

@@ -8,6 +8,7 @@ use uuid::Uuid;
// Remove a profile
// invoke('profile_add_path',path)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_remove(path: &Path) -> Result<()> {
profile::remove(path).await?;
Ok(())
@@ -16,6 +17,7 @@ pub async fn profile_remove(path: &Path) -> Result<()> {
// Get a profile by path
// invoke('profile_add_path',path)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_get(
path: &Path,
clear_projects: Option<bool>,
@@ -27,6 +29,7 @@ pub async fn profile_get(
// Get a copy of the profile set
// invoke('profile_list')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_list(
clear_projects: Option<bool>,
) -> Result<std::collections::HashMap<PathBuf, Profile>> {
@@ -35,6 +38,7 @@ pub async fn profile_list(
}
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_check_installed(
path: &Path,
project_id: String,
@@ -57,6 +61,7 @@ pub async fn profile_check_installed(
/// Installs/Repairs a profile
/// invoke('profile_install')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_install(path: &Path) -> Result<()> {
profile::install(path).await?;
Ok(())
@@ -65,6 +70,7 @@ pub async fn profile_install(path: &Path) -> Result<()> {
/// Updates all of the profile's projects
/// invoke('profile_update_all')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_update_all(path: &Path) -> Result<()> {
profile::update_all(path).await?;
Ok(())
@@ -73,6 +79,7 @@ pub async fn profile_update_all(path: &Path) -> Result<()> {
/// Updates a specified project
/// invoke('profile_update_project')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_update_project(
path: &Path,
project_path: &Path,
@@ -84,6 +91,7 @@ pub async fn profile_update_project(
// Adds a project to a profile from a version ID
// invoke('profile_add_project_from_version')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_add_project_from_version(
path: &Path,
version_id: String,
@@ -95,6 +103,7 @@ pub async fn profile_add_project_from_version(
// Adds a project to a profile from a path
// invoke('profile_add_project_from_path')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_add_project_from_path(
path: &Path,
project_path: &Path,
@@ -108,6 +117,7 @@ pub async fn profile_add_project_from_path(
// Toggles disabling a project from its path
// invoke('profile_toggle_disable_project')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_toggle_disable_project(
path: &Path,
project_path: &Path,
@@ -119,6 +129,7 @@ pub async fn profile_toggle_disable_project(
// Removes a project from a profile
// invoke('profile_remove_project')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_remove_project(
path: &Path,
project_path: &Path,
@@ -131,6 +142,7 @@ pub async fn profile_remove_project(
// for the actual Child in the state.
// invoke('profile_run', path)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_run(path: &Path) -> Result<Uuid> {
let minecraft_child = profile::run(path).await?;
let uuid = minecraft_child.read().await.uuid;
@@ -140,6 +152,7 @@ pub async fn profile_run(path: &Path) -> Result<Uuid> {
// Run Minecraft using a profile using the default credentials, and wait for the result
// invoke('profile_run_wait', path)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_run_wait(path: &Path) -> Result<()> {
let proc_lock = profile::run(path).await?;
let mut proc = proc_lock.write().await;
@@ -151,6 +164,7 @@ pub async fn profile_run_wait(path: &Path) -> Result<()> {
// for the actual Child in the state.
// invoke('profile_run_credentials', {path, credentials})')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_run_credentials(
path: &Path,
credentials: Credentials,
@@ -163,6 +177,7 @@ pub async fn profile_run_credentials(
// Run Minecraft using a profile using the chosen credentials, and wait for the result
// invoke('profile_run_wait', {path, credentials)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_run_wait_credentials(
path: &Path,
credentials: Credentials,
@@ -192,6 +207,7 @@ pub struct EditProfileMetadata {
// Edits a profile
// invoke('profile_edit', {path, editProfile})
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_edit(
path: &Path,
edit_profile: EditProfile,

View File

@@ -5,6 +5,7 @@ use theseus::prelude::*;
// Generic basic profile creation tool.
// Creates an essentially empty dummy profile with profile_create
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_create_empty() -> Result<PathBuf> {
let res = profile_create::profile_create_empty().await?;
Ok(res)
@@ -13,6 +14,7 @@ pub async fn profile_create_empty() -> Result<PathBuf> {
// Creates a profile at the given filepath and adds it to the in-memory state
// invoke('profile_add',profile)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn profile_create(
name: String, // the name of the profile, and relative path
game_version: String, // the game version of the profile

View File

@@ -23,6 +23,7 @@ pub struct FrontendSettings {
// Get full settings
// invoke('settings_get')
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn settings_get() -> Result<FrontendSettings> {
let backend_settings = settings::get().await?;
let frontend_settings = FrontendSettings {
@@ -50,6 +51,7 @@ pub async fn settings_get() -> Result<FrontendSettings> {
// Set full settings
// invoke('settings_set', settings)
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn settings_set(settings: FrontendSettings) -> Result<()> {
let custom_env_args: Vec<(String, String)> = settings
.custom_env_args

View File

@@ -3,36 +3,42 @@ use theseus::tags::{Category, DonationPlatform, GameVersion, Loader, Tags};
/// Gets cached category tags from the database
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn tags_get_categories() -> Result<Vec<Category>> {
Ok(theseus::tags::get_category_tags().await?)
}
/// Gets cached report type tags from the database
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn tags_get_report_types() -> Result<Vec<String>> {
Ok(theseus::tags::get_report_type_tags().await?)
}
/// Gets cached loader tags from the database
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn tags_get_loaders() -> Result<Vec<Loader>> {
Ok(theseus::tags::get_loader_tags().await?)
}
/// Gets cached game version tags from the database
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn tags_get_game_versions() -> Result<Vec<GameVersion>> {
Ok(theseus::tags::get_game_version_tags().await?)
}
/// Gets cached donation platform tags from the database
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn tags_get_donation_platforms() -> Result<Vec<DonationPlatform>> {
Ok(theseus::tags::get_donation_platform_tags().await?)
}
/// Gets cached tag bundle from the database
#[tauri::command]
#[theseus_macros::debug_pin]
pub async fn tags_get_tag_bundle() -> Result<Tags> {
Ok(theseus::tags::get_tag_bundle().await?)
}