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:
		| @@ -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: | 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> | <commit message> | ||||||
|  |  | ||||||
| Signed-off-by: Author name <Author email> | 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: | By signing off your work, you agree to the terms below: | ||||||
|  |  | ||||||
| ``` | ```text | ||||||
| Developer's Certificate of Origin 1.1 | Developer's Certificate of Origin 1.1 | ||||||
|  |  | ||||||
| By making a contribution to this project, I certify that: | 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-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 | [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 | ## 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. | We use [automated backports](https://github.com/PrismLauncher/PrismLauncher/blob/develop/.github/workflows/backport.yml) to merge specific contributions from develop into `release` branches. | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										12
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @@ -91,11 +91,11 @@ | |||||||
|     }, |     }, | ||||||
|     "nixpkgs": { |     "nixpkgs": { | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1690026219, |         "lastModified": 1690630721, | ||||||
|         "narHash": "sha256-oOduRk/kzQxOBknZXTLSEYd7tk+GoKvr8wV6Ab+t4AU=", |         "narHash": "sha256-Y04onHyBQT4Erfr2fc82dbJTfXGYrf4V0ysLUYnPOP8=", | ||||||
|         "owner": "nixos", |         "owner": "nixos", | ||||||
|         "repo": "nixpkgs", |         "repo": "nixpkgs", | ||||||
|         "rev": "f465da166263bc0d4b39dfd4ca28b777c92d4b73", |         "rev": "d2b52322f35597c62abf56de91b0236746b2a03d", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
| @@ -138,11 +138,11 @@ | |||||||
|         ] |         ] | ||||||
|       }, |       }, | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1689668210, |         "lastModified": 1690628027, | ||||||
|         "narHash": "sha256-XAATwDkaUxH958yXLs1lcEOmU6pSEIkatY3qjqk8X0E=", |         "narHash": "sha256-OTSbA2hM6VmxyZ/4siYPANffMBzIsKu04GLjXcv8ST0=", | ||||||
|         "owner": "cachix", |         "owner": "cachix", | ||||||
|         "repo": "pre-commit-hooks.nix", |         "repo": "pre-commit-hooks.nix", | ||||||
|         "rev": "eb433bff05b285258be76513add6f6c57b441775", |         "rev": "1e2443dd3f669eb65433b2fc26a3065e05a7dc9c", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| builds: | builds: | ||||||
|   exclude: [] |   exclude: [] | ||||||
|   include: |   include: | ||||||
|     - "devShells.*-linux.*" |     - "checks.x86_64-linux.*" | ||||||
|     - "packages.*-linux.*" |     - "devShells.*.*" | ||||||
|  |     - "packages.*.*" | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| #include "LocalModParseTask.h" | #include "LocalModParseTask.h" | ||||||
|  |  | ||||||
|  | #include <qdcss.h> | ||||||
| #include <quazip/quazip.h> | #include <quazip/quazip.h> | ||||||
| #include <quazip/quazipfile.h> | #include <quazip/quazipfile.h> | ||||||
| #include <toml++/toml.h> | #include <toml++/toml.h> | ||||||
| #include <qdcss.h> |  | ||||||
| #include <QJsonArray> | #include <QJsonArray> | ||||||
| #include <QJsonDocument> | #include <QJsonDocument> | ||||||
| #include <QJsonObject> | #include <QJsonObject> | ||||||
| @@ -369,12 +369,11 @@ ModDetails ReadQuiltModInfo(QByteArray contents) | |||||||
|                 details.icon_file = icon.toString(); |                 details.icon_file = icon.toString(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     } |     } | ||||||
|     return details; |     return details; | ||||||
| } | } | ||||||
|  |  | ||||||
| ModDetails ReadForgeInfo(QString fileName) | ModDetails ReadForgeInfo(QByteArray contents) | ||||||
| { | { | ||||||
|     ModDetails details; |     ModDetails details; | ||||||
|     // Read the data |     // Read the data | ||||||
| @@ -382,7 +381,7 @@ ModDetails ReadForgeInfo(QString fileName) | |||||||
|     details.mod_id = "Forge"; |     details.mod_id = "Forge"; | ||||||
|     details.homeurl = "http://www.minecraftforge.net/forum/"; |     details.homeurl = "http://www.minecraftforge.net/forum/"; | ||||||
|     INIFile ini; |     INIFile ini; | ||||||
|     if (!ini.loadFile(fileName)) |     if (!ini.loadFile(contents)) | ||||||
|         return details; |         return details; | ||||||
|  |  | ||||||
|     QString major = ini.get("forge.major.number", "0").toString(); |     QString major = ini.get("forge.major.number", "0").toString(); | ||||||
| @@ -554,7 +553,7 @@ bool processZIP(Mod& mod, ProcessingLevel level) | |||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         details = ReadForgeInfo(file.getFileName()); |         details = ReadForgeInfo(file.readAll()); | ||||||
|         file.close(); |         file.close(); | ||||||
|         zip.close(); |         zip.close(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -61,7 +61,6 @@ | |||||||
| #include "meta/VersionList.h" | #include "meta/VersionList.h" | ||||||
| #include "minecraft/World.h" | #include "minecraft/World.h" | ||||||
| #include "minecraft/mod/tasks/LocalResourceParse.h" | #include "minecraft/mod/tasks/LocalResourceParse.h" | ||||||
|  |  | ||||||
| #include "net/ApiDownload.h" | #include "net/ApiDownload.h" | ||||||
|  |  | ||||||
| static const FlameAPI api; | static const FlameAPI api; | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ namespace Net { | |||||||
|  |  | ||||||
| class ApiHeaderProxy : public HeaderProxy { | class ApiHeaderProxy : public HeaderProxy { | ||||||
|    public: |    public: | ||||||
|     ApiHeaderProxy() : HeaderProxy(){}; |     ApiHeaderProxy() : HeaderProxy() {} | ||||||
|     virtual ~ApiHeaderProxy() = default; |     virtual ~ApiHeaderProxy() = default; | ||||||
|  |  | ||||||
|    public: |    public: | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ class Download : public NetRequest { | |||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
|    public: |    public: | ||||||
|     using Ptr = shared_qobject_ptr<class Download>; |     using Ptr = shared_qobject_ptr<class Download>; | ||||||
|     explicit Download() : NetRequest() { logCat = taskDownloadLogC; }; |     explicit Download() : NetRequest() { logCat = taskDownloadLogC; } | ||||||
|  |  | ||||||
| #if defined(LAUNCHER_APPLICATION) | #if defined(LAUNCHER_APPLICATION) | ||||||
|     static auto makeCached(QUrl url, MetaEntryPtr entry, Options options = Option::NoOptions) -> Download::Ptr; |     static auto makeCached(QUrl url, MetaEntryPtr entry, Options options = Option::NoOptions) -> Download::Ptr; | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ class HeaderProxy { | |||||||
|         for (auto header : headers(request)) { |         for (auto header : headers(request)) { | ||||||
|             request.setRawHeader(header.headerName, header.headerValue); |             request.setRawHeader(header.headerName, header.headerValue); | ||||||
|         } |         } | ||||||
|     }; |     } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| }  // namespace Net | }  // namespace Net | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ class NetRequest : public NetAction { | |||||||
|    public: |    public: | ||||||
|     void addValidator(Validator* v); |     void addValidator(Validator* v); | ||||||
|     auto abort() -> bool override; |     auto abort() -> bool override; | ||||||
|     auto canAbort() const -> bool override { return true; }; |     auto canAbort() const -> bool override { return true; } | ||||||
|  |  | ||||||
|    private: |    private: | ||||||
|     auto handleRedirect() -> bool; |     auto handleRedirect() -> bool; | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ namespace Net { | |||||||
|  |  | ||||||
| class RawHeaderProxy : public HeaderProxy { | class RawHeaderProxy : public HeaderProxy { | ||||||
|    public: |    public: | ||||||
|     RawHeaderProxy() : HeaderProxy(){}; |     RawHeaderProxy() : HeaderProxy() {} | ||||||
|     virtual ~RawHeaderProxy() = default; |     virtual ~RawHeaderProxy() = default; | ||||||
|  |  | ||||||
|    public: |    public: | ||||||
|   | |||||||
| @@ -37,11 +37,12 @@ | |||||||
| #include "settings/INIFile.h" | #include "settings/INIFile.h" | ||||||
| #include <FileSystem.h> | #include <FileSystem.h> | ||||||
|  |  | ||||||
| #include <QFile> |  | ||||||
| #include <QTextStream> |  | ||||||
| #include <QStringList> |  | ||||||
| #include <QSaveFile> |  | ||||||
| #include <QDebug> | #include <QDebug> | ||||||
|  | #include <QFile> | ||||||
|  | #include <QSaveFile> | ||||||
|  | #include <QStringList> | ||||||
|  | #include <QTemporaryFile> | ||||||
|  | #include <QTextStream> | ||||||
|  |  | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
|  |  | ||||||
| @@ -71,6 +72,7 @@ bool INIFile::saveFile(QString fileName) | |||||||
|  |  | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| QString unescape(QString orig) | QString unescape(QString orig) | ||||||
| { | { | ||||||
|     QString out; |     QString out; | ||||||
| @@ -185,6 +187,19 @@ bool INIFile::loadFile(QString fileName) | |||||||
|     return true; |     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 | QVariant INIFile::get(QString key, QVariant def) const | ||||||
| { | { | ||||||
|     if (!this->contains(key)) |     if (!this->contains(key)) | ||||||
|   | |||||||
| @@ -50,6 +50,7 @@ public: | |||||||
|     explicit INIFile(); |     explicit INIFile(); | ||||||
|  |  | ||||||
|     bool loadFile(QString fileName); |     bool loadFile(QString fileName); | ||||||
|  |     bool loadFile(QByteArray data); | ||||||
|     bool saveFile(QString fileName); |     bool saveFile(QString fileName); | ||||||
|  |  | ||||||
|     QVariant get(QString key, QVariant def) const; |     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()); |     auto prefix = QDir(instance->instanceRoot()).relativeFilePath(instance->gameRoot()); | ||||||
|     proxyModel->ignoreFilesWithPath().insert({ FS::PathCombine(prefix, "logs"), FS::PathCombine(prefix, "crash-reports") }); |     proxyModel->ignoreFilesWithPath().insert({ FS::PathCombine(prefix, "logs"), FS::PathCombine(prefix, "crash-reports") }); | ||||||
|     proxyModel->ignoreFilesWithName().append({ ".DS_Store", "thumbs.db", "Thumbs.db" }); |     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(); |     loadPackIgnore(); | ||||||
|  |  | ||||||
|     ui->treeView->setModel(proxyModel); |     ui->treeView->setModel(proxyModel); | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ ExportPackDialog::ExportPackDialog(InstancePtr instance, QWidget* parent, ModPla | |||||||
|     // use the game root - everything outside cannot be exported |     // use the game root - everything outside cannot be exported | ||||||
|     const QDir root(instance->gameRoot()); |     const QDir root(instance->gameRoot()); | ||||||
|     proxy = new FileIgnoreProxy(instance->gameRoot(), this); |     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->ignoreFilesWithName().append({ ".DS_Store", "thumbs.db", "Thumbs.db" }); | ||||||
|     proxy->setSourceModel(model); |     proxy->setSourceModel(model); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ The `standard` and `legacy` launchers are available. | |||||||
|  |  | ||||||
| Example (some parts have been censored): | Example (some parts have been censored): | ||||||
|  |  | ||||||
| ``` | ```text | ||||||
| mod legacyjavafixer-1.0 | mod legacyjavafixer-1.0 | ||||||
| mainClass net.minecraft.launchwrapper.Launch | mainClass net.minecraft.launchwrapper.Launch | ||||||
| param --username | param --username | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								nix/NIX.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								nix/NIX.md
									
									
									
									
									
								
							| @@ -53,7 +53,8 @@ home.packages = [ pkgs.prismlauncher ]; | |||||||
|  |  | ||||||
| ### Without flakes-enabled nix | ### Without flakes-enabled nix | ||||||
|  |  | ||||||
| #### Using channels | <details> | ||||||
|  | <summary>Using channels</summary> | ||||||
|  |  | ||||||
| ```sh | ```sh | ||||||
| nix-channel --add https://github.com/PrismLauncher/PrismLauncher/archive/master.tar.gz prismlauncher | 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 | nix-env -iA prismlauncher | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| #### Using the overlay | </details> | ||||||
|  |  | ||||||
|  | <details> | ||||||
|  | <summary>Using the overlay</summary> | ||||||
|  |  | ||||||
| ```nix | ```nix | ||||||
| # In your configuration.nix: | # In your configuration.nix: | ||||||
| @@ -74,6 +78,8 @@ nix-env -iA prismlauncher | |||||||
| } | } | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | </details> | ||||||
|  |  | ||||||
| ## Running ad-hoc | ## Running ad-hoc | ||||||
|  |  | ||||||
| If you're on a flakes-enabled nix you can run the launcher in one-line | If you're on a flakes-enabled nix you can run the launcher in one-line | ||||||
|   | |||||||
| @@ -24,9 +24,9 @@ | |||||||
|   # Supported systems. |   # Supported systems. | ||||||
|   systems = [ |   systems = [ | ||||||
|     "x86_64-linux" |     "x86_64-linux" | ||||||
|     "x86_64-darwin" |  | ||||||
|     "aarch64-linux" |     "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" |     # "aarch64-darwin" | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Trial97
					Trial97