diff --git a/Cargo.lock b/Cargo.lock
index e840ed110..1da86669b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8877,6 +8877,7 @@ dependencies = [
"flate2",
"fs4",
"futures",
+ "heck 0.5.0",
"hickory-resolver",
"indicatif",
"notify",
diff --git a/Cargo.toml b/Cargo.toml
index 10fba76e4..96477b8d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -91,6 +91,7 @@ rand = "=0.8.5" # Locked on 0.8 until argon2 and p256 update to 0.9
rand_chacha = "=0.3.1" # Locked on 0.3 until we can update rand to 0.9
redis = "=0.29.5" # Locked on 0.29 until deadpool-redis updates to 0.30
regex = "1.11.1"
+heck = "0.5.0"
reqwest = { version = "0.12.15", default-features = false }
rust-s3 = { version = "0.35.1", default-features = false, features = [
"fail-on-err",
diff --git a/apps/app-frontend/src/components/ui/AccountsCard.vue b/apps/app-frontend/src/components/ui/AccountsCard.vue
index fe1defb0f..1451dcb71 100644
--- a/apps/app-frontend/src/components/ui/AccountsCard.vue
+++ b/apps/app-frontend/src/components/ui/AccountsCard.vue
@@ -10,12 +10,12 @@
size="36px"
:src="
selectedAccount
- ? `https://mc-heads.net/avatar/${selectedAccount.id}/128`
+ ? `https://mc-heads.net/avatar/${selectedAccount.profile.id}/128`
: 'https://launcher-files.modrinth.com/assets/steve_head.png'
"
/>
- {{ selectedAccount ? selectedAccount.username : 'Select account' }}
+ {{ selectedAccount ? selectedAccount.profile.name : 'Select account' }}
Minecraft account
@@ -28,12 +28,17 @@
:class="{ expanded: mode === 'expanded', isolated: mode === 'isolated' }"
>
-
+
-
{{ selectedAccount.username }}
+
{{ selectedAccount.profile.name }}
Selected
-
@@ -44,12 +49,12 @@
-
+
-
- {{ account.username }}
+
+ {{ account.profile.name }}
-
+
@@ -101,16 +106,16 @@ defineExpose({
await refreshValues()
const displayAccounts = computed(() =>
- accounts.value.filter((account) => defaultUser.value !== account.id),
+ accounts.value.filter((account) => defaultUser.value !== account.profile.id),
)
const selectedAccount = computed(() =>
- accounts.value.find((account) => account.id === defaultUser.value),
+ accounts.value.find((account) => account.profile.id === defaultUser.value),
)
async function setAccount(account) {
- defaultUser.value = account.id
- await set_default_user(account.id).catch(handleError)
+ defaultUser.value = account.profile.id
+ await set_default_user(account.profile.id).catch(handleError)
emit('change')
}
diff --git a/apps/app-frontend/src/components/ui/ErrorModal.vue b/apps/app-frontend/src/components/ui/ErrorModal.vue
index 3daac536e..7d4538053 100644
--- a/apps/app-frontend/src/components/ui/ErrorModal.vue
+++ b/apps/app-frontend/src/components/ui/ErrorModal.vue
@@ -92,7 +92,7 @@ async function loginMinecraft() {
const loggedIn = await login_flow()
if (loggedIn) {
- await set_default_user(loggedIn.id).catch(handleError)
+ await set_default_user(loggedIn.profile.id).catch(handleError)
}
await trackEvent('AccountLogIn', { source: 'ErrorModal' })
diff --git a/apps/app-playground/src/main.rs b/apps/app-playground/src/main.rs
index 24019b125..a2c2b8922 100644
--- a/apps/app-playground/src/main.rs
+++ b/apps/app-playground/src/main.rs
@@ -27,7 +27,10 @@ pub async fn authenticate_run() -> theseus::Result
{
let credentials = minecraft_auth::finish_login(&input, login).await?;
- println!("Logged in user {}.", credentials.username);
+ println!(
+ "Logged in user {}.",
+ credentials.maybe_online_profile().await.name
+ );
Ok(credentials)
}
diff --git a/apps/app/build.rs b/apps/app/build.rs
index 644d22b68..4fe82cfbc 100644
--- a/apps/app/build.rs
+++ b/apps/app/build.rs
@@ -151,7 +151,6 @@ fn main() {
"profile_update_managed_modrinth_version",
"profile_repair_managed_modrinth",
"profile_run",
- "profile_run_credentials",
"profile_kill",
"profile_edit",
"profile_edit_icon",
diff --git a/apps/app/src/api/profile.rs b/apps/app/src/api/profile.rs
index db979be35..1d812639e 100644
--- a/apps/app/src/api/profile.rs
+++ b/apps/app/src/api/profile.rs
@@ -28,7 +28,6 @@ pub fn init() -> tauri::plugin::TauriPlugin {
profile_update_managed_modrinth_version,
profile_repair_managed_modrinth,
profile_run,
- profile_run_credentials,
profile_kill,
profile_edit,
profile_edit_icon,
@@ -256,22 +255,6 @@ pub async fn profile_run(path: &str) -> Result {
Ok(process)
}
-// Run Minecraft using a profile using chosen credentials
-// Returns the UUID, which can be used to poll
-// for the actual Child in the state.
-// invoke('plugin:profile|profile_run_credentials', {path, credentials})')
-#[tauri::command]
-pub async fn profile_run_credentials(
- path: &str,
- credentials: Credentials,
-) -> Result {
- let process =
- profile::run_credentials(path, &credentials, &QuickPlayType::None)
- .await?;
-
- Ok(process)
-}
-
#[tauri::command]
pub async fn profile_kill(path: &str) -> Result<()> {
profile::kill(path).await?;
diff --git a/packages/app-lib/Cargo.toml b/packages/app-lib/Cargo.toml
index 275a31c06..fdaabe32e 100644
--- a/packages/app-lib/Cargo.toml
+++ b/packages/app-lib/Cargo.toml
@@ -35,6 +35,7 @@ tracing-subscriber = { workspace = true, features = ["chrono", "env-filter"] }
tracing-error.workspace = true
paste.workspace = true
+heck.workspace = true
tauri = { workspace = true, optional = true }
indicatif = { workspace = true, optional = true }
diff --git a/packages/app-lib/src/api/logs.rs b/packages/app-lib/src/api/logs.rs
index 7d24418b5..efbd8b7ea 100644
--- a/packages/app-lib/src/api/logs.rs
+++ b/packages/app-lib/src/api/logs.rs
@@ -39,21 +39,27 @@ pub struct LatestLogCursor {
#[serde(transparent)]
pub struct CensoredString(String);
impl CensoredString {
- pub fn censor(mut s: String, credentials_set: &Vec) -> Self {
+ pub fn censor(mut s: String, credentials_list: &[Credentials]) -> Self {
let username = whoami::username();
s = s
.replace(&format!("/{username}/"), "/{COMPUTER_USERNAME}/")
.replace(&format!("\\{username}\\"), "\\{COMPUTER_USERNAME}\\");
- for credentials in credentials_set {
+ for credentials in credentials_list {
+ // Use the offline profile to guarantee that this function is does not cause
+ // Mojang API request, and is never delayed by a network request. The offline
+ // profile is optimistically updated on upsert from time to time anyway
s = s
.replace(&credentials.access_token, "{MINECRAFT_ACCESS_TOKEN}")
- .replace(&credentials.username, "{MINECRAFT_USERNAME}")
.replace(
- &credentials.id.as_simple().to_string(),
+ &credentials.offline_profile.name,
+ "{MINECRAFT_USERNAME}",
+ )
+ .replace(
+ &credentials.offline_profile.id.as_simple().to_string(),
"{MINECRAFT_UUID}",
)
.replace(
- &credentials.id.as_hyphenated().to_string(),
+ &credentials.offline_profile.id.as_hyphenated().to_string(),
"{MINECRAFT_UUID}",
);
}
@@ -210,7 +216,7 @@ pub async fn get_output_by_filename(
.await?
.into_iter()
.map(|x| x.1)
- .collect();
+ .collect::>();
// Load .gz file into String
if let Some(ext) = path.extension() {
@@ -350,7 +356,7 @@ pub async fn get_generic_live_log_cursor(
.await?
.into_iter()
.map(|x| x.1)
- .collect();
+ .collect::>();
let output = CensoredString::censor(output, &credentials);
Ok(LatestLogCursor {
cursor,
diff --git a/packages/app-lib/src/api/minecraft_auth.rs b/packages/app-lib/src/api/minecraft_auth.rs
index 4fa75a4c8..568a6aca1 100644
--- a/packages/app-lib/src/api/minecraft_auth.rs
+++ b/packages/app-lib/src/api/minecraft_auth.rs
@@ -23,8 +23,8 @@ pub async fn finish_login(
#[tracing::instrument]
pub async fn get_default_user() -> crate::Result