Merge branch 'refactor/net-split-headers-to-proxy-class' of https://github.com/Ryex/PrismLauncher into refactor/NetActions
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
#include "LocalModParseTask.h"
|
||||
|
||||
#include <qdcss.h>
|
||||
#include <quazip/quazip.h>
|
||||
#include <quazip/quazipfile.h>
|
||||
#include <toml++/toml.h>
|
||||
#include <qdcss.h>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
@ -369,12 +369,11 @@ ModDetails ReadQuiltModInfo(QByteArray contents)
|
||||
details.icon_file = icon.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
ModDetails ReadForgeInfo(QString fileName)
|
||||
ModDetails ReadForgeInfo(QByteArray contents)
|
||||
{
|
||||
ModDetails details;
|
||||
// Read the data
|
||||
@ -382,7 +381,7 @@ ModDetails ReadForgeInfo(QString fileName)
|
||||
details.mod_id = "Forge";
|
||||
details.homeurl = "http://www.minecraftforge.net/forum/";
|
||||
INIFile ini;
|
||||
if (!ini.loadFile(fileName))
|
||||
if (!ini.loadFile(contents))
|
||||
return details;
|
||||
|
||||
QString major = ini.get("forge.major.number", "0").toString();
|
||||
@ -554,7 +553,7 @@ bool processZIP(Mod& mod, ProcessingLevel level)
|
||||
return false;
|
||||
}
|
||||
|
||||
details = ReadForgeInfo(file.getFileName());
|
||||
details = ReadForgeInfo(file.readAll());
|
||||
file.close();
|
||||
zip.close();
|
||||
|
||||
|
@ -61,7 +61,6 @@
|
||||
#include "meta/VersionList.h"
|
||||
#include "minecraft/World.h"
|
||||
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||
|
||||
#include "net/ApiDownload.h"
|
||||
|
||||
static const FlameAPI api;
|
||||
|
@ -27,7 +27,7 @@ namespace Net {
|
||||
|
||||
class ApiHeaderProxy : public HeaderProxy {
|
||||
public:
|
||||
ApiHeaderProxy() : HeaderProxy(){};
|
||||
ApiHeaderProxy() : HeaderProxy() {}
|
||||
virtual ~ApiHeaderProxy() = default;
|
||||
|
||||
public:
|
||||
|
@ -48,7 +48,7 @@ class Download : public NetRequest {
|
||||
Q_OBJECT
|
||||
public:
|
||||
using Ptr = shared_qobject_ptr<class Download>;
|
||||
explicit Download() : NetRequest() { logCat = taskDownloadLogC; };
|
||||
explicit Download() : NetRequest() { logCat = taskDownloadLogC; }
|
||||
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
static auto makeCached(QUrl url, MetaEntryPtr entry, Options options = Option::NoOptions) -> Download::Ptr;
|
||||
|
@ -43,7 +43,7 @@ class HeaderProxy {
|
||||
for (auto header : headers(request)) {
|
||||
request.setRawHeader(header.headerName, header.headerValue);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Net
|
||||
|
@ -67,7 +67,7 @@ class NetRequest : public NetAction {
|
||||
public:
|
||||
void addValidator(Validator* v);
|
||||
auto abort() -> bool override;
|
||||
auto canAbort() const -> bool override { return true; };
|
||||
auto canAbort() const -> bool override { return true; }
|
||||
|
||||
private:
|
||||
auto handleRedirect() -> bool;
|
||||
|
@ -27,7 +27,7 @@ namespace Net {
|
||||
|
||||
class RawHeaderProxy : public HeaderProxy {
|
||||
public:
|
||||
RawHeaderProxy() : HeaderProxy(){};
|
||||
RawHeaderProxy() : HeaderProxy() {}
|
||||
virtual ~RawHeaderProxy() = default;
|
||||
|
||||
public:
|
||||
|
@ -37,11 +37,12 @@
|
||||
#include "settings/INIFile.h"
|
||||
#include <FileSystem.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QStringList>
|
||||
#include <QSaveFile>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QSaveFile>
|
||||
#include <QStringList>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
@ -71,6 +72,7 @@ bool INIFile::saveFile(QString fileName)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString unescape(QString orig)
|
||||
{
|
||||
QString out;
|
||||
@ -185,6 +187,19 @@ bool INIFile::loadFile(QString fileName)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool INIFile::loadFile(QByteArray data)
|
||||
{
|
||||
QTemporaryFile file;
|
||||
if (!file.open())
|
||||
return false;
|
||||
file.write(data);
|
||||
file.flush();
|
||||
file.close();
|
||||
auto loaded = loadFile(file.fileName());
|
||||
file.remove();
|
||||
return loaded;
|
||||
}
|
||||
|
||||
QVariant INIFile::get(QString key, QVariant def) const
|
||||
{
|
||||
if (!this->contains(key))
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
explicit INIFile();
|
||||
|
||||
bool loadFile(QString fileName);
|
||||
bool loadFile(QByteArray data);
|
||||
bool saveFile(QString fileName);
|
||||
|
||||
QVariant get(QString key, QVariant def) const;
|
||||
|
@ -70,6 +70,8 @@ ExportInstanceDialog::ExportInstanceDialog(InstancePtr instance, QWidget* parent
|
||||
auto prefix = QDir(instance->instanceRoot()).relativeFilePath(instance->gameRoot());
|
||||
proxyModel->ignoreFilesWithPath().insert({ FS::PathCombine(prefix, "logs"), FS::PathCombine(prefix, "crash-reports") });
|
||||
proxyModel->ignoreFilesWithName().append({ ".DS_Store", "thumbs.db", "Thumbs.db" });
|
||||
proxyModel->ignoreFilesWithPath().insert(
|
||||
{ FS::PathCombine(prefix, ".cache"), FS::PathCombine(prefix, ".fabric"), FS::PathCombine(prefix, ".quilt") });
|
||||
loadPackIgnore();
|
||||
|
||||
ui->treeView->setModel(proxyModel);
|
||||
|
@ -61,7 +61,7 @@ ExportPackDialog::ExportPackDialog(InstancePtr instance, QWidget* parent, ModPla
|
||||
// use the game root - everything outside cannot be exported
|
||||
const QDir root(instance->gameRoot());
|
||||
proxy = new FileIgnoreProxy(instance->gameRoot(), this);
|
||||
proxy->ignoreFilesWithPath().insert({ "logs", "crash-reports" });
|
||||
proxy->ignoreFilesWithPath().insert({ "logs", "crash-reports", ".cache", ".fabric", ".quilt" });
|
||||
proxy->ignoreFilesWithName().append({ ".DS_Store", "thumbs.db", "Thumbs.db" });
|
||||
proxy->setSourceModel(model);
|
||||
|
||||
|
Reference in New Issue
Block a user