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:
Trial97 2023-08-05 19:16:57 +03:00
commit f9ebcb5d2e
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
17 changed files with 54 additions and 32 deletions

View File

@ -19,7 +19,7 @@ In an effort to ensure that the code you contribute is actually compatible with
This can be done by appending `-s` to your `git commit` call, or by manually appending the following text to your commit message:
```
```text
<commit message>
Signed-off-by: Author name <Author email>
@ -27,7 +27,7 @@ Signed-off-by: Author name <Author email>
By signing off your work, you agree to the terms below:
```
```text
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
@ -62,7 +62,6 @@ As a bonus, you can also [cryptographically sign your commits][gh-signing-commit
[gh-signing-commits]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
[gh-vigilant-mode]: https://docs.github.com/en/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits
## Backporting to Release Branches
We use [automated backports](https://github.com/PrismLauncher/PrismLauncher/blob/develop/.github/workflows/backport.yml) to merge specific contributions from develop into `release` branches.

View File

@ -91,11 +91,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1690026219,
"narHash": "sha256-oOduRk/kzQxOBknZXTLSEYd7tk+GoKvr8wV6Ab+t4AU=",
"lastModified": 1690630721,
"narHash": "sha256-Y04onHyBQT4Erfr2fc82dbJTfXGYrf4V0ysLUYnPOP8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f465da166263bc0d4b39dfd4ca28b777c92d4b73",
"rev": "d2b52322f35597c62abf56de91b0236746b2a03d",
"type": "github"
},
"original": {
@ -138,11 +138,11 @@
]
},
"locked": {
"lastModified": 1689668210,
"narHash": "sha256-XAATwDkaUxH958yXLs1lcEOmU6pSEIkatY3qjqk8X0E=",
"lastModified": 1690628027,
"narHash": "sha256-OTSbA2hM6VmxyZ/4siYPANffMBzIsKu04GLjXcv8ST0=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "eb433bff05b285258be76513add6f6c57b441775",
"rev": "1e2443dd3f669eb65433b2fc26a3065e05a7dc9c",
"type": "github"
},
"original": {

View File

@ -1,5 +1,6 @@
builds:
exclude: []
include:
- "devShells.*-linux.*"
- "packages.*-linux.*"
- "checks.x86_64-linux.*"
- "devShells.*.*"
- "packages.*.*"

View File

@ -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();

View File

@ -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;

View File

@ -27,7 +27,7 @@ namespace Net {
class ApiHeaderProxy : public HeaderProxy {
public:
ApiHeaderProxy() : HeaderProxy(){};
ApiHeaderProxy() : HeaderProxy() {}
virtual ~ApiHeaderProxy() = default;
public:

View File

@ -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;

View File

@ -43,7 +43,7 @@ class HeaderProxy {
for (auto header : headers(request)) {
request.setRawHeader(header.headerName, header.headerValue);
}
};
}
};
} // namespace Net

View File

@ -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;

View File

@ -27,7 +27,7 @@ namespace Net {
class RawHeaderProxy : public HeaderProxy {
public:
RawHeaderProxy() : HeaderProxy(){};
RawHeaderProxy() : HeaderProxy() {}
virtual ~RawHeaderProxy() = default;
public:

View File

@ -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))

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -61,7 +61,7 @@ The `standard` and `legacy` launchers are available.
Example (some parts have been censored):
```
```text
mod legacyjavafixer-1.0
mainClass net.minecraft.launchwrapper.Launch
param --username

View File

@ -53,7 +53,8 @@ home.packages = [ pkgs.prismlauncher ];
### Without flakes-enabled nix
#### Using channels
<details>
<summary>Using channels</summary>
```sh
nix-channel --add https://github.com/PrismLauncher/PrismLauncher/archive/master.tar.gz prismlauncher
@ -61,7 +62,10 @@ nix-channel --update prismlauncher
nix-env -iA prismlauncher
```
#### Using the overlay
</details>
<details>
<summary>Using the overlay</summary>
```nix
# In your configuration.nix:
@ -74,6 +78,8 @@ nix-env -iA prismlauncher
}
```
</details>
## Running ad-hoc
If you're on a flakes-enabled nix you can run the launcher in one-line

View File

@ -24,9 +24,9 @@
# Supported systems.
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
# Disabled due to qtbase being currently broken for "aarch64-darwin."
# Disabled due to our packages not supporting darwin yet.
# "x86_64-darwin"
# "aarch64-darwin"
];
}