Add custom login support
This commit is contained in:
@@ -377,6 +377,13 @@ bool AccountData::resumeStateFromV3(QJsonObject data) {
|
||||
mojangservicesToken = tokenFromJSONV3(data, "xrp-mc");
|
||||
}
|
||||
|
||||
if(type == AccountType::Custom) {
|
||||
auto urlV = data.value("url");
|
||||
if (urlV.isString()) {
|
||||
customUrl = urlV.toString();
|
||||
}
|
||||
}
|
||||
|
||||
yggdrasilToken = tokenFromJSONV3(data, "ygg");
|
||||
minecraftProfile = profileFromJSONV3(data, "profile");
|
||||
if(!entitlementFromJSONV3(data, minecraftEntitlement)) {
|
||||
@@ -418,6 +425,7 @@ QJsonObject AccountData::saveState() const {
|
||||
}
|
||||
else if (type == AccountType::Custom) {
|
||||
output["type"] = "Custom";
|
||||
output["url"] = customUrl;
|
||||
}
|
||||
|
||||
tokenToJSONV3(output, yggdrasilToken, "ygg");
|
||||
|
@@ -128,6 +128,7 @@ MinecraftAccountPtr MinecraftAccount::createCustom(const QString &username, cons
|
||||
account->data.yggdrasilToken.extra["clientToken"] = QUuid::createUuid().toString().remove(QRegularExpression("[{}-]"));
|
||||
account->data.minecraftEntitlement.ownsMinecraft = true;
|
||||
account->data.minecraftEntitlement.canPlayMinecraft = true;
|
||||
account->data.customUrl = url;
|
||||
return account;
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,8 @@ void CustomProfileStep::perform() {
|
||||
|
||||
// m_data->
|
||||
|
||||
qWarning() << "Url: " << m_data->customUrl;
|
||||
|
||||
QUrl url = QUrl(m_data->customUrl + "/session/profile/" + m_data->minecraftProfile.id);
|
||||
QNetworkRequest req = QNetworkRequest(url);
|
||||
AuthRequest *request = new AuthRequest(this);
|
||||
|
@@ -23,11 +23,12 @@ void CustomStep::rehydrate() {
|
||||
}
|
||||
|
||||
void CustomStep::perform() {
|
||||
qWarning() << "url: " << m_url << " / " << m_data->customUrl;
|
||||
if(m_password.size()) {
|
||||
m_yggdrasil->login(m_password, m_url + "/auth/");
|
||||
}
|
||||
else {
|
||||
m_yggdrasil->refresh(m_url + "/auth/");
|
||||
m_yggdrasil->refresh(m_data->customUrl + "/auth/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ void CustomStep::onAuthFailed() {
|
||||
// NOTE: soft error in the first step means 'offline'
|
||||
if(state == AccountTaskState::STATE_FAILED_SOFT) {
|
||||
state = AccountTaskState::STATE_OFFLINE;
|
||||
errorMessage = tr("Custom user authentication ended with a network error. Is MutliFactor Auth current?");
|
||||
errorMessage = tr("Custom user authentication ended with a network error. Is MutliFactor Auth correct?");
|
||||
}
|
||||
emit finished(state, errorMessage);
|
||||
}
|
||||
|
Reference in New Issue
Block a user