fix: add author page url
This commit is contained in:
parent
a43f882d48
commit
4a0e4fdb85
@ -16,9 +16,13 @@
|
|||||||
#include "ModrinthPackManifest.h"
|
#include "ModrinthPackManifest.h"
|
||||||
#include "Json.h"
|
#include "Json.h"
|
||||||
|
|
||||||
|
#include "modplatform/modrinth/ModrinthAPI.h"
|
||||||
|
|
||||||
#include "minecraft/MinecraftInstance.h"
|
#include "minecraft/MinecraftInstance.h"
|
||||||
#include "minecraft/PackProfile.h"
|
#include "minecraft/PackProfile.h"
|
||||||
|
|
||||||
|
static ModrinthAPI api;
|
||||||
|
|
||||||
namespace Modrinth {
|
namespace Modrinth {
|
||||||
|
|
||||||
void loadIndexedPack(Modpack& pack, QJsonObject& obj)
|
void loadIndexedPack(Modpack& pack, QJsonObject& obj)
|
||||||
@ -27,7 +31,8 @@ void loadIndexedPack(Modpack& pack, QJsonObject& obj)
|
|||||||
|
|
||||||
pack.name = Json::ensureString(obj, "title");
|
pack.name = Json::ensureString(obj, "title");
|
||||||
pack.description = Json::ensureString(obj, "description");
|
pack.description = Json::ensureString(obj, "description");
|
||||||
pack.authors << Json::ensureString(obj, "author");
|
auto temp_author_name = Json::ensureString(obj, "author");
|
||||||
|
pack.author = std::make_tuple(temp_author_name, api.getAuthorURL(temp_author_name));
|
||||||
pack.iconName = QString("modrinth_%1").arg(Json::ensureString(obj, "slug"));
|
pack.iconName = QString("modrinth_%1").arg(Json::ensureString(obj, "slug"));
|
||||||
pack.iconUrl = Json::ensureString(obj, "icon_url");
|
pack.iconUrl = Json::ensureString(obj, "icon_url");
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ struct Modpack {
|
|||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QStringList authors;
|
std::tuple<QString, QUrl> author;
|
||||||
QString iconName;
|
QString iconName;
|
||||||
QUrl iconUrl;
|
QUrl iconUrl;
|
||||||
|
|
||||||
|
@ -221,10 +221,8 @@ void ModrinthPage::updateUI()
|
|||||||
else
|
else
|
||||||
text = "<a href=\"" + current.extra.projectUrl + "\">" + current.name + "</a>";
|
text = "<a href=\"" + current.extra.projectUrl + "\">" + current.name + "</a>";
|
||||||
|
|
||||||
if (!current.authors.empty()) {
|
|
||||||
// TODO: Implement multiple authors with links
|
// TODO: Implement multiple authors with links
|
||||||
text += "<br>" + tr(" by ") + current.authors.at(0);
|
text += "<br>" + tr(" by ") + QString("<a href=%1>%2</a>").arg(std::get<1>(current.author).toString(), std::get<0>(current.author));
|
||||||
}
|
|
||||||
|
|
||||||
text += "<br>";
|
text += "<br>";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user