diff options
author | flow <thiagodonato300@gmail.com> | 2022-03-02 23:01:23 -0300 |
---|---|---|
committer | flow <thiagodonato300@gmail.com> | 2022-03-02 23:13:04 -0300 |
commit | 2d68308d4920be4c28a73d7646814765eee7b7a2 (patch) | |
tree | ac0c9abf5a1f33bc13b8f885070904e7e7bfe43d /launcher/modplatform/flame/FlameAPI.h | |
parent | 0dd1c26cf3cd68cd83f5d9da6cf34d4aa3f30db2 (diff) | |
download | PrismLauncher-2d68308d4920be4c28a73d7646814765eee7b7a2.tar.gz PrismLauncher-2d68308d4920be4c28a73d7646814765eee7b7a2.tar.bz2 PrismLauncher-2d68308d4920be4c28a73d7646814765eee7b7a2.zip |
refactor: move url creation for mods to modplatform/
Moves all things related to creating the URLs of the mod platforms
that go to network tasks to a single place, so that:
1. Maintaining and fixing eventual issues is more straightforward.
2. Makes it possible to factor out more common code between the
different modplatform pages
Diffstat (limited to 'launcher/modplatform/flame/FlameAPI.h')
-rw-r--r-- | launcher/modplatform/flame/FlameAPI.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/launcher/modplatform/flame/FlameAPI.h b/launcher/modplatform/flame/FlameAPI.h new file mode 100644 index 00000000..6e2b9e25 --- /dev/null +++ b/launcher/modplatform/flame/FlameAPI.h @@ -0,0 +1,27 @@ +#pragma once + +#include "modplatform/ModAPI.h" + +class FlameAPI : public ModAPI { + public: + inline QString getModSearchURL(int index, QString searchFilter, QString sort, bool fabricCompatible, QString version) const override + { + return QString("https://addons-ecs.forgesvc.net/api/v2/addon/search?" + "gameId=432&" "categoryId=0&" "sectionId=6&" + + "index=%1&" "pageSize=25&" "searchFilter=%2&" + "sort=%3&" "modLoaderType=%4&" "gameVersion=%5") + .arg(index) + .arg(searchFilter) + .arg(sort) + .arg(fabricCompatible ? 4 : 1) // Enum: https://docs.curseforge.com/?http#tocS_ModLoaderType + .arg(version); + }; + + inline QString getVersionsURL(const QString& addonId) const override + { + return QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId); + }; + + inline QString getAuthorURL(const QString& name) const override { return ""; }; +}; |