Skip to content

Commit cb69869

Browse files
committed
revert: remove CurseForge workaround
We have been asked by CurseForge to remove this workaround as it violates their terms of service. This is just a partial revert, as the UI changes were otherwise unrelated. This reverts commit 92e8aaf, reversing changes made to 88a9394.
1 parent 7d91db6 commit cb69869

3 files changed

Lines changed: 7 additions & 33 deletions

File tree

launcher/modplatform/flame/FileResolvingTask.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,7 @@ void Flame::FileResolvingTask::netJobFinished()
3131
for (auto& bytes : results) {
3232
auto& out = m_toProcess.files[index];
3333
try {
34-
bool fail = (!out.parseFromBytes(bytes));
35-
if(fail){
36-
//failed :( probably disabled mod, try to add to the list
37-
auto doc = Json::requireDocument(bytes);
38-
if (!doc.isObject()) {
39-
throw JSONValidationError(QString("data is not an object? that's not supposed to happen"));
40-
}
41-
auto obj = Json::ensureObject(doc.object(), "data");
42-
//FIXME : HACK, MAY NOT WORK FOR LONG
43-
out.url = QUrl(QString("https://media.forgecdn.net/files/%1/%2/%3")
44-
.arg(QString::number(QString::number(out.fileId).leftRef(4).toInt())
45-
,QString::number(QString::number(out.fileId).rightRef(3).toInt())
46-
,QUrl::toPercentEncoding(out.fileName)), QUrl::TolerantMode);
47-
}
48-
failed &= fail;
34+
failed &= (!out.parseFromBytes(bytes));
4935
} catch (const JSONValidationError& e) {
5036
qCritical() << "Resolving of" << out.projectId << out.fileId << "failed because of a parsing error:";
5137
qCritical() << e.cause();

launcher/modplatform/flame/FlameModIndex.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,8 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
5656
file.fileId = Json::requireInteger(obj, "id");
5757
file.date = Json::requireString(obj, "fileDate");
5858
file.version = Json::requireString(obj, "displayName");
59+
file.downloadUrl = Json::requireString(obj, "downloadUrl");
5960
file.fileName = Json::requireString(obj, "fileName");
60-
file.downloadUrl = Json::ensureString(obj, "downloadUrl", "");
61-
if(file.downloadUrl.isEmpty()){
62-
//FIXME : HACK, MAY NOT WORK FOR LONG
63-
file.downloadUrl = QString("https://media.forgecdn.net/files/%1/%2/%3")
64-
.arg(QString::number(QString::number(file.fileId.toInt()).leftRef(4).toInt())
65-
,QString::number(QString::number(file.fileId.toInt()).rightRef(3).toInt())
66-
,QUrl::toPercentEncoding(file.fileName));
67-
}
6861

6962
unsortedVersions.append(file);
7063
}

launcher/modplatform/flame/PackManifest.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ bool Flame::File::parseFromBytes(const QByteArray& bytes)
7171

7272
fileName = Json::requireString(obj, "fileName");
7373

74+
QString rawUrl = Json::requireString(obj, "downloadUrl");
75+
url = QUrl(rawUrl, QUrl::TolerantMode);
76+
if (!url.isValid()) {
77+
throw JSONValidationError(QString("Invalid URL: %1").arg(rawUrl));
78+
}
7479
// This is a piece of a Flame project JSON pulled out into the file metadata (here) for convenience
7580
// It is also optional
7681
type = File::Type::SingleFile;
@@ -82,17 +87,7 @@ bool Flame::File::parseFromBytes(const QByteArray& bytes)
8287
// this is probably a mod, dunno what else could modpacks download
8388
targetFolder = "mods";
8489
}
85-
QString rawUrl = Json::ensureString(obj, "downloadUrl");
8690

87-
if(rawUrl.isEmpty()){
88-
//either there somehow is an emtpy string as a link, or it's null either way it's invalid
89-
//soft failing
90-
return false;
91-
}
92-
url = QUrl(rawUrl, QUrl::TolerantMode);
93-
if (!url.isValid()) {
94-
throw JSONValidationError(QString("Invalid URL: %1").arg(rawUrl));
95-
}
9691
resolved = true;
9792
return true;
9893
}

0 commit comments

Comments
 (0)