removed some duplicate code

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2025-03-30 00:32:59 +02:00
parent ab3bfb0f74
commit 29cff14fd6
52 changed files with 928 additions and 2318 deletions

View File

@@ -5,12 +5,14 @@
#pragma once
#include "BuildConfig.h"
#include "Json.h"
#include "modplatform/ModIndex.h"
#include "modplatform/helpers/NetworkResourceAPI.h"
#include "modplatform/ResourceAPI.h"
#include "modplatform/modrinth/ModrinthPackIndex.h"
#include <QDebug>
class ModrinthAPI : public NetworkResourceAPI {
class ModrinthAPI : public ResourceAPI {
public:
Task::Ptr currentVersion(QString hash, QString hash_format, std::shared_ptr<QByteArray> response);
@@ -214,4 +216,12 @@ class ModrinthAPI : public NetworkResourceAPI {
.arg(mapMCVersionToModrinth(args.mcVersion))
.arg(getModLoaderStrings(args.loader).join("\",\""));
};
QJsonArray documentToArray(QJsonDocument& obj) const override { return obj.object().value("hits").toArray(); }
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) const override { Modrinth::loadIndexedPack(m, obj); }
ModPlatform::IndexedVersion loadIndexedPackVersion(QJsonObject& obj, ModPlatform::ResourceType) const override
{
return Modrinth::loadIndexedPackVersion(obj);
};
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) const override { Modrinth::loadExtraPackData(m, obj); }
};