| 423 | } |
| 424 | |
| 425 | bool parseRolloutResponse(QByteArray & data, bool& result) { |
| 426 | qDebug() << "Parsing Rollout response..."; |
| 427 | #ifndef NDEBUG |
| 428 | qDebug() << data; |
| 429 | #endif |
| 430 | |
| 431 | QJsonParseError jsonError; |
| 432 | QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError); |
| 433 | if(jsonError.error) { |
| 434 | qWarning() << "Failed to parse response from https://api.minecraftservices.com/rollout/v1/msamigration as JSON: " << jsonError.errorString(); |
| 435 | return false; |
| 436 | } |
| 437 | |
| 438 | auto obj = doc.object(); |
| 439 | QString feature; |
| 440 | if(!getString(obj.value("feature"), feature)) { |
| 441 | qWarning() << "Rollout feature is not a string"; |
| 442 | return false; |
| 443 | } |
| 444 | if(feature != "msamigration") { |
| 445 | qWarning() << "Rollout feature is not what we expected (msamigration), but is instead \"" << feature << "\""; |
| 446 | return false; |
| 447 | } |
| 448 | if(!getBool(obj.value("rollout"), result)) { |
| 449 | qWarning() << "Rollout feature is not a string"; |
| 450 | return false; |
| 451 | } |
| 452 | return true; |
| 453 | } |
| 454 | |
| 455 | bool parseMojangResponse(QByteArray & data, Katabasis::Token &output) { |
| 456 | QJsonParseError jsonError; |
no test coverage detected