revert: remove CurseForge workaround for packs too
Partial revert. Handles missing download URLs.
This commit is contained in:
parent
7f73e57c67
commit
938cae1130
@ -65,17 +65,13 @@ void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr)
|
||||
// pick the latest version supported
|
||||
file.mcVersion = versionArray[0].toString();
|
||||
file.version = Json::requireString(version, "displayName");
|
||||
file.fileName = Json::requireString(version, "fileName");
|
||||
file.downloadUrl = Json::ensureString(version, "downloadUrl");
|
||||
if(file.downloadUrl.isEmpty()){
|
||||
//FIXME : HACK, MAY NOT WORK FOR LONG
|
||||
file.downloadUrl = QString("https://media.forgecdn.net/files/%1/%2/%3")
|
||||
.arg(QString::number(QString::number(file.fileId).leftRef(4).toInt())
|
||||
,QString::number(QString::number(file.fileId).rightRef(3).toInt())
|
||||
,QUrl::toPercentEncoding(file.fileName));
|
||||
}
|
||||
|
||||
// only add if we have a download URL (third party distribution is enabled)
|
||||
if (!file.downloadUrl.isEmpty()) {
|
||||
unsortedVersions.append(file);
|
||||
}
|
||||
}
|
||||
|
||||
auto orderSortPredicate = [](const IndexedVersion& a, const IndexedVersion& b) -> bool { return a.fileId > b.fileId; };
|
||||
std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate);
|
||||
|
@ -18,7 +18,6 @@ struct IndexedVersion {
|
||||
QString version;
|
||||
QString mcVersion;
|
||||
QString downloadUrl;
|
||||
QString fileName;
|
||||
};
|
||||
|
||||
struct IndexedPack
|
||||
|
Loading…
Reference in New Issue
Block a user