Merge pull request #609 from timoreo22/feature/fix-blocked-modpacks

This commit is contained in:
dada513 2022-05-21 12:22:45 +02:00 committed by GitHub
commit 9a0d6124f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -65,7 +65,15 @@ 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.downloadUrl = Json::requireString(version, "downloadUrl"); 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));
}
unsortedVersions.append(file); unsortedVersions.append(file);
} }

View File

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