revert: remove CurseForge workaround for packs too

Partial revert. Handles missing download URLs.
This commit is contained in:
Sefa Eyeoglu 2022-05-25 23:04:49 +02:00
parent 7f73e57c67
commit 938cae1130
No known key found for this signature in database
GPG Key ID: C10411294912A422
2 changed files with 4 additions and 9 deletions

View File

@ -65,17 +65,13 @@ void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr)
// pick the latest version supported // pick the latest version supported
file.mcVersion = versionArray[0].toString(); file.mcVersion = versionArray[0].toString();
file.version = Json::requireString(version, "displayName"); file.version = Json::requireString(version, "displayName");
file.fileName = Json::requireString(version, "fileName");
file.downloadUrl = Json::ensureString(version, "downloadUrl"); file.downloadUrl = Json::ensureString(version, "downloadUrl");
if(file.downloadUrl.isEmpty()){
//FIXME : HACK, MAY NOT WORK FOR LONG // only add if we have a download URL (third party distribution is enabled)
file.downloadUrl = QString("https://media.forgecdn.net/files/%1/%2/%3") if (!file.downloadUrl.isEmpty()) {
.arg(QString::number(QString::number(file.fileId).leftRef(4).toInt())
,QString::number(QString::number(file.fileId).rightRef(3).toInt())
,QUrl::toPercentEncoding(file.fileName));
}
unsortedVersions.append(file); unsortedVersions.append(file);
} }
}
auto orderSortPredicate = [](const IndexedVersion& a, const IndexedVersion& b) -> bool { return a.fileId > b.fileId; }; auto orderSortPredicate = [](const IndexedVersion& a, const IndexedVersion& b) -> bool { return a.fileId > b.fileId; };
std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate); std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate);

View File

@ -18,7 +18,6 @@ struct IndexedVersion {
QString version; QString version;
QString mcVersion; QString mcVersion;
QString downloadUrl; QString downloadUrl;
QString fileName;
}; };
struct IndexedPack struct IndexedPack