From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Modrinth Enhanced Date: Mon, 14 Sep 2026 10:27:34 +0200 Subject: [PATCH] Add offline accounts Adds a second way to add a Minecraft account that never talks to Microsoft or Mojang, for playing singleplayer worlds and servers running in offline mode. An offline account is an ordinary row in `minecraft_users`, marked by a sentinel in the refresh token column, so no database migration is needed. `Credentials::refresh` and the online profile lookup both return early for such an account, which keeps every existing code path - launching, account switching, serialisation to the frontend - working without further changes. The player UUID is derived the way Minecraft itself derives it, as an MD5 name UUID over `OfflinePlayer:`. That is what vanilla servers in offline mode and other launchers use, so worlds keep the same player data when they are opened elsewhere. Usernames are validated the way Mojang validates them: 3 to 16 characters of letters, numbers and underscores. Three places had to be opened up for any of this to be reachable, all of which offered Microsoft and nothing else: * The account card was hidden until a Microsoft account had been added, which left offline sign-in unreachable for exactly the people who want it. * The "Minecraft required" modal - what you hit on pressing Play with no account - now lists the alternatives too. It is no longer only about something being required, so it is titled "Sign in to Minecraft". * "Sign in to Minecraft" in the getting started checklist went straight to Microsoft. It opens that same modal now, so every way in offers the same choice. --- Cargo.lock | 1 + apps/app-frontend/src/App.vue | 12 +- .../src/components/ui/AccountsCard.vue | 30 ++++ .../src/components/ui/OfflineAccountModal.vue | 136 ++++++++++++++++++ .../MinecraftRequiredModal.vue | 30 +++- apps/app-frontend/src/helpers/auth.js | 13 ++ apps/app/build.rs | 1 + apps/app/src/api/auth.rs | 7 + packages/app-lib/Cargo.toml | 1 + packages/app-lib/src/api/minecraft_auth.rs | 39 +++++ packages/app-lib/src/state/minecraft_auth.rs | 66 +++++++++ 11 files changed, 328 insertions(+), 8 deletions(-) create mode 100644 apps/app-frontend/src/components/ui/OfflineAccountModal.vue diff --git a/Cargo.lock b/Cargo.lock index 28231e3..f94d0fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12361,6 +12361,7 @@ dependencies = [ "indicatif", "itertools 0.14.0", "json5", + "md5", "modrinth-content-management", "notify", "notify-debouncer-mini", diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index 447f636..d750a5f 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -2467,15 +2467,17 @@ provideAppUpdateDownloadProgress(appUpdateDownload) > + diff --git a/apps/app-frontend/src/components/ui/minecraft-required-modal/MinecraftRequiredModal.vue b/apps/app-frontend/src/components/ui/minecraft-required-modal/MinecraftRequiredModal.vue index 73293f5..8e6b275 100644 --- a/apps/app-frontend/src/components/ui/minecraft-required-modal/MinecraftRequiredModal.vue +++ b/apps/app-frontend/src/components/ui/minecraft-required-modal/MinecraftRequiredModal.vue @@ -43,6 +43,16 @@ {{ formatMessage(messages.signIn) }} +
+

+ {{ formatMessage(messages.offlineHint) }} +

+ +
+

{{ formatMessage(messages.dontHaveAccount) }}