Merge remote-tracking branch 'upstream/develop' into no-ensure

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-11-10 18:56:32 +00:00
28 changed files with 139 additions and 112 deletions

View File

@@ -45,7 +45,8 @@ class ModrinthAPI : public ResourceAPI {
{
QStringList l;
for (auto loader : { ModPlatform::NeoForge, ModPlatform::Forge, ModPlatform::Fabric, ModPlatform::Quilt, ModPlatform::LiteLoader,
ModPlatform::DataPack, ModPlatform::Babric, ModPlatform::BTA, ModPlatform::LegacyFabric, ModPlatform::Ornithe, ModPlatform::Rift }) {
ModPlatform::DataPack, ModPlatform::Babric, ModPlatform::BTA, ModPlatform::LegacyFabric, ModPlatform::Ornithe,
ModPlatform::Rift }) {
if (types & loader) {
l << getModLoaderAsString(loader);
}
@@ -188,7 +189,7 @@ class ModrinthAPI : public ResourceAPI {
get_arguments.append(QString("loaders=[\"%1\"]").arg(getModLoaderStrings(args.loaders.value()).join("\",\"")));
return QString("%1/project/%2/version%3%4")
.arg(BuildConfig.MODRINTH_PROD_URL, args.pack.addonId.toString(), get_arguments.isEmpty() ? "" : "?", get_arguments.join('&'));
.arg(BuildConfig.MODRINTH_PROD_URL, args.pack->addonId.toString(), get_arguments.isEmpty() ? "" : "?", get_arguments.join('&'));
};
QString getGameVersionsArray(std::list<Version> mcVersions) const
@@ -204,7 +205,8 @@ class ModrinthAPI : public ResourceAPI {
static inline auto validateModLoaders(ModPlatform::ModLoaderTypes loaders) -> bool
{
return loaders & (ModPlatform::NeoForge | ModPlatform::Forge | ModPlatform::Fabric | ModPlatform::Quilt | ModPlatform::LiteLoader |
ModPlatform::DataPack | ModPlatform::Babric | ModPlatform::BTA | ModPlatform::LegacyFabric | ModPlatform::Ornithe | ModPlatform::Rift);
ModPlatform::DataPack | ModPlatform::Babric | ModPlatform::BTA | ModPlatform::LegacyFabric |
ModPlatform::Ornithe | ModPlatform::Rift);
}
std::optional<QString> getDependencyURL(DependencySearchArgs const& args) const override

View File

@@ -249,7 +249,7 @@ bool ModrinthCreationTask::createInstance()
auto root_modpack_url = QUrl::fromLocalFile(root_modpack_path);
// TODO make this work with other sorts of resource
QHash<QString, Resource*> resources;
for (auto file : m_files) {
for (auto& file : m_files) {
auto fileName = file.path;
fileName = FS::RemoveInvalidPathChars(fileName);
auto file_path = FS::PathCombine(root_modpack_path, fileName);

View File

@@ -33,7 +33,7 @@ bool shouldDownloadOnSide(QString side)
return side == "required" || side == "optional";
}
// https://docs.modrinth.com/api-spec/#tag/projects/operation/getProject
// https://docs.modrinth.com/api/operations/getproject/
void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
{
pack.addonId = obj["project_id"].toString();
@@ -54,10 +54,12 @@ void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
pack.logoUrl = obj["icon_url"].toString("");
pack.logoName = QString("%1.%2").arg(obj["slug"].toString()), QFileInfo(QUrl(pack.logoUrl).fileName()).suffix();
ModPlatform::ModpackAuthor modAuthor;
modAuthor.name = obj["author"].toString(QObject::tr("No author(s)"));
modAuthor.url = api.getAuthorURL(modAuthor.name);
pack.authors.append(modAuthor);
if (obj.contains("author")) {
ModPlatform::ModpackAuthor modAuthor;
modAuthor.name = obj["author"].toString();
modAuthor.url = api.getAuthorURL(modAuthor.name);
pack.authors = { modAuthor };
}
auto client = shouldDownloadOnSide(obj["client_side"].toString());
auto server = shouldDownloadOnSide(obj["server_side"].toString());