1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 20:47:45 +00:00

Remove botched json-fixing Dalamud asset update code

The JSON seems to be fixed now, later on I will be implementing a better
"asset update" failed mechanism to handle edge cases like these.
This commit is contained in:
Joshua Goins 2022-03-28 10:33:00 -04:00
parent 3b8f66be66
commit 212f073c33

View file

@ -66,19 +66,8 @@ void AssetUpdater::update(const ProfileSettings& profile) {
connect(reply, &QNetworkReply::finished, [reply, this, profile] {
dialog->setLabelText("Checking for Dalamud asset updates...");
// lol, they actually provide invalid json. let's fix it if it's borked
QString badJson = reply->readAll();
auto lastCommaLoc = badJson.lastIndexOf(',');
auto lastBracketLoc = badJson.lastIndexOf('{');
// basically, if { supersedes the last ,
if (lastCommaLoc > lastBracketLoc) {
qInfo() << "Dalamud server gave bad json, attempting to fix...";
badJson.remove(lastCommaLoc, 1);
}
QJsonDocument doc = QJsonDocument::fromJson(badJson.toUtf8());
// TODO: handle asset failure
QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
qInfo() << "Dalamud asset remote version" << doc.object()["Version"].toInt();
qInfo() << "Dalamud asset local version" << launcher.dalamudAssetVersion;