clean up validateDownloadUrl
This commit is contained in:
parent
b5e00027d1
commit
abd240468e
@ -42,6 +42,8 @@
|
|||||||
#include "minecraft/MinecraftInstance.h"
|
#include "minecraft/MinecraftInstance.h"
|
||||||
#include "minecraft/PackProfile.h"
|
#include "minecraft/PackProfile.h"
|
||||||
|
|
||||||
|
#include <QSet>
|
||||||
|
|
||||||
static ModrinthAPI api;
|
static ModrinthAPI api;
|
||||||
|
|
||||||
namespace Modrinth {
|
namespace Modrinth {
|
||||||
@ -95,17 +97,15 @@ void loadIndexedVersions(Modpack& pack, QJsonDocument& doc)
|
|||||||
|
|
||||||
auto validateDownloadUrl(QUrl url) -> bool
|
auto validateDownloadUrl(QUrl url) -> bool
|
||||||
{
|
{
|
||||||
auto domain = url.host();
|
static QSet<QString> domainWhitelist{
|
||||||
if(domain == "cdn.modrinth.com")
|
"cdn.modrinth.com",
|
||||||
return true;
|
"github.com",
|
||||||
if(domain == "github.com")
|
"raw.githubusercontent.com",
|
||||||
return true;
|
"gitlab.com"
|
||||||
if(domain == "raw.githubusercontent.com")
|
};
|
||||||
return true;
|
|
||||||
if(domain == "gitlab.com")
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
auto domain = url.host();
|
||||||
|
return domainWhitelist.contains(domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
|
auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
|
||||||
|
Loading…
Reference in New Issue
Block a user