aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/AccountData.cpp
diff options
context:
space:
mode:
authorswirl <swurl@swurl.xyz>2022-02-03 13:54:27 -0500
committerswirl <swurl@swurl.xyz>2022-02-03 13:54:27 -0500
commit2177aa2a6b248088f76b463c43d04c65126195bf (patch)
treedfa09fc140c9757b52ceffff9a61c19accd22036 /launcher/minecraft/auth/AccountData.cpp
parente8a4902a3dddd08d65bd1284951ae5954439d1f5 (diff)
parente0a04c50316089b9a443355394c5babf39a1771d (diff)
downloadPrismLauncher-2177aa2a6b248088f76b463c43d04c65126195bf.tar.gz
PrismLauncher-2177aa2a6b248088f76b463c43d04c65126195bf.tar.bz2
PrismLauncher-2177aa2a6b248088f76b463c43d04c65126195bf.zip
Merge branch 'offline-mode-accounts' of git://github.com/NyaomiDEV/PolyMC into feature/offline_mode
Diffstat (limited to 'launcher/minecraft/auth/AccountData.cpp')
-rw-r--r--launcher/minecraft/auth/AccountData.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/launcher/minecraft/auth/AccountData.cpp b/launcher/minecraft/auth/AccountData.cpp
index 7526c951..9b84fe1a 100644
--- a/launcher/minecraft/auth/AccountData.cpp
+++ b/launcher/minecraft/auth/AccountData.cpp
@@ -314,6 +314,8 @@ bool AccountData::resumeStateFromV3(QJsonObject data) {
type = AccountType::MSA;
} else if (typeS == "Mojang") {
type = AccountType::Mojang;
+ } else if (typeS == "Offline") {
+ type = AccountType::Offline;
} else {
qWarning() << "Failed to parse account data: type is not recognized.";
return false;
@@ -363,6 +365,9 @@ QJsonObject AccountData::saveState() const {
tokenToJSONV3(output, xboxApiToken, "xrp-main");
tokenToJSONV3(output, mojangservicesToken, "xrp-mc");
}
+ else if (type == AccountType::Offline) {
+ output["type"] = "Offline";
+ }
tokenToJSONV3(output, yggdrasilToken, "ygg");
profileToJSONV3(output, minecraftProfile, "profile");
@@ -371,7 +376,7 @@ QJsonObject AccountData::saveState() const {
}
QString AccountData::userName() const {
- if(type != AccountType::Mojang) {
+ if(type == AccountType::MSA) {
return QString();
}
return yggdrasilToken.extra["userName"].toString();
@@ -427,6 +432,9 @@ QString AccountData::accountDisplayString() const {
case AccountType::Mojang: {
return userName();
}
+ case AccountType::Offline: {
+ return userName();
+ }
case AccountType::MSA: {
if(xboxApiToken.extra.contains("gtg")) {
return xboxApiToken.extra["gtg"].toString();