diff --git a/Cargo.lock b/Cargo.lock
index 2a1c0c54f6..1e6bbec743 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8889,6 +8889,7 @@ dependencies = [
"flate2",
"fs4",
"futures",
+ "heck 0.5.0",
"hickory-resolver",
"indicatif",
"notify",
diff --git a/Cargo.toml b/Cargo.toml
index b612f75ae1..68880f0a2b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -60,6 +60,7 @@ flate2 = "1.1.2"
fs4 = { version = "0.13.1", default-features = false }
futures = { version = "0.3.31", default-features = false }
futures-util = "0.3.31"
+heck = "0.5.0"
hex = "0.4.3"
hickory-resolver = "0.25.2"
hmac = "0.12.1"
diff --git a/apps/app-frontend/src/components/ui/AccountsCard.vue b/apps/app-frontend/src/components/ui/AccountsCard.vue
index fe1defb0f7..1451dcb71c 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 3daac536eb..7d4538053a 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 24019b1257..a2c2b89224 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 644d22b681..4fe82cfbc4 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 db979be35c..1d812639e4 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 7d00b15590..0d870bd9f1 100644
--- a/packages/app-lib/Cargo.toml
+++ b/packages/app-lib/Cargo.toml
@@ -38,6 +38,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 7d24418b5e..efbd8b7ead 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 4fa75a4c8e..568a6aca12 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