diff --git a/Cargo.lock b/Cargo.lock
index 2a1c0c54f..1e6bbec74 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 b612f75ae..68880f0a2 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 fe1defb0f..2a33c2a6f 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,12 @@
:class="{ expanded: mode === 'expanded', isolated: mode === 'isolated' }"
>
-
+
-
{{ selectedAccount.username }}
+
{{ selectedAccount.profile.name }}
Selected
-
@@ -44,12 +44,12 @@
-
+
-
- {{ account.username }}
+
+ {{ account.profile.name }}
-
+
@@ -101,16 +101,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/packages/app-lib/Cargo.toml b/packages/app-lib/Cargo.toml
index 7d00b1559..0d870bd9f 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 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