diff --git a/theseus/src/api/shared_profile.rs b/theseus/src/api/shared_profile.rs index 15c630a33..c7436bb57 100644 --- a/theseus/src/api/shared_profile.rs +++ b/theseus/src/api/shared_profile.rs @@ -58,7 +58,7 @@ pub struct SharedProfileOverrideHashes { } // Simplified version of SharedProfile- this is what is returned from the Labrinth API -// This is not used, except for requests where we are not a member of the shared profile +// This is not used, except for requests where we are not a member of the shared profile // (ie: previewing a shared profile from a link, before accepting it) #[derive(Deserialize, Serialize, Debug)] pub struct SharedProfileResponse { @@ -68,19 +68,18 @@ pub struct SharedProfileResponse { pub created: DateTime, pub updated: DateTime, pub icon_url: Option, - + pub loader: ModLoader, - pub game : String, - + pub game: String, + pub loader_version: String, pub game_version: String, - + // Present only if we are the owner pub share_links: Option>, pub users: Option>, } - // Create a new shared profile from ProfilePathId // This converts the LinkedData to a SharedProfile and uploads it to the Labrinth API #[tracing::instrument] @@ -253,7 +252,10 @@ pub fn project_file_type(ext: &str) -> Option<&str> { pub async fn get_all() -> crate::Result> { let state = crate::State::get().await?; let creds = state.credentials.read().await; - let creds = creds.0.as_ref().ok_or_else(|| crate::ErrorKind::NoCredentialsError)?; + let creds = creds + .0 + .as_ref() + .ok_or_else(|| crate::ErrorKind::NoCredentialsError)?; let response = REQWEST_CLIENT .get(format!("{MODRINTH_API_URL_INTERNAL}client/user")) @@ -325,7 +327,13 @@ pub async fn install( shared_profile_id: String, ) -> crate::Result { let state = crate::State::get().await?; - let shared_profile = get_all().await?.into_iter().find(|x| x.id == shared_profile_id).ok_or_else(|| crate::ErrorKind::OtherError("Profile not found".to_string()))?; + let shared_profile = get_all() + .await? + .into_iter() + .find(|x| x.id == shared_profile_id) + .ok_or_else(|| { + crate::ErrorKind::OtherError("Profile not found".to_string()) + })?; let linked_data = LinkedData::SharedProfile { profile_id: shared_profile.id, @@ -858,21 +866,24 @@ pub async fn accept_share_link(link: String) -> crate::Result<()> { // Gets a shared profile from a share link // This is done without accepting it- so would not include any link information, and is only usable for basic info pub async fn get_from_link( - link: String + link: String, ) -> crate::Result { let state = crate::State::get().await?; let creds = state.credentials.read().await; - let creds = creds.0.as_ref().ok_or_else(|| crate::ErrorKind::NoCredentialsError)?; + let creds = creds + .0 + .as_ref() + .ok_or_else(|| crate::ErrorKind::NoCredentialsError)?; let response = REQWEST_CLIENT - .get( - format!("{MODRINTH_API_URL_INTERNAL}client/share/{link}"), - ) - .header("Authorization", &creds.session) - .send().await?.error_for_status()?; + .get(format!("{MODRINTH_API_URL_INTERNAL}client/share/{link}")) + .header("Authorization", &creds.session) + .send() + .await? + .error_for_status()?; let profile = response.json::().await?; Ok(profile) -} \ No newline at end of file +} diff --git a/theseus_gui/src-tauri/src/api/profile_share.rs b/theseus_gui/src-tauri/src/api/profile_share.rs index e8dcb6936..76f8470d2 100644 --- a/theseus_gui/src-tauri/src/api/profile_share.rs +++ b/theseus_gui/src-tauri/src/api/profile_share.rs @@ -1,5 +1,8 @@ use crate::api::Result; -use theseus::{prelude::*, shared_profile::{SharedProfile,SharedProfileResponse}}; +use theseus::{ + prelude::*, + shared_profile::{SharedProfile, SharedProfileResponse}, +}; pub fn init() -> tauri::plugin::TauriPlugin { tauri::plugin::Builder::new("profile_share") @@ -29,8 +32,7 @@ pub async fn profile_share_get_all() -> Result> { pub async fn profile_share_install( shared_profile_id: String, ) -> Result { - let res = shared_profile::install(shared_profile_id) - .await?; + let res = shared_profile::install(shared_profile_id).await?; Ok(res) } @@ -70,13 +72,12 @@ pub async fn profile_share_accept_share_link(link: String) -> Result<()> { // This is done without accepting it- so would not include any link information, and is only usable for basic info #[tauri::command] pub async fn profile_share_get_link_id( - link : String + link: String, ) -> Result { let res = shared_profile::get_from_link(link).await?; Ok(res) } - #[tauri::command] pub async fn profile_share_remove_users( path: ProfilePathId, diff --git a/theseus_gui/src-tauri/src/api/utils.rs b/theseus_gui/src-tauri/src/api/utils.rs index 007a7af0e..70931662d 100644 --- a/theseus_gui/src-tauri/src/api/utils.rs +++ b/theseus_gui/src-tauri/src/api/utils.rs @@ -162,7 +162,7 @@ pub async fn get_opening_command() -> Result> { #[tauri::command] pub async fn test_command(command: String) -> Result<()> { - Ok(handle_command(command).await?) + handle_command(command).await } // helper function called when redirected by a weblink (ie: modrith://do-something) or when redirected by a .mrpack file (in which case its a filepath) diff --git a/theseus_gui/src/main.js b/theseus_gui/src/main.js index 938e2f924..7d1584640 100644 --- a/theseus_gui/src/main.js +++ b/theseus_gui/src/main.js @@ -30,7 +30,7 @@ const raw_invoke = async (plugin, fn, args) => { } } const test_command = async (command) => { - return await raw_invoke('utils', 'test_command', {command }) + return await raw_invoke('utils', 'test_command', { command }) } isDev() diff --git a/theseus_gui/src/pages/instance/Options.vue b/theseus_gui/src/pages/instance/Options.vue index b20976fe1..9e1bd2162 100644 --- a/theseus_gui/src/pages/instance/Options.vue +++ b/theseus_gui/src/pages/instance/Options.vue @@ -527,7 +527,13 @@ You are not up to date with the shared profile. Click the button to update your instance. - + {{ props.instance.sync_update_version }}