diff --git a/loader/src/server/Server.cpp b/loader/src/server/Server.cpp index 79fde660..abb92c3c 100644 --- a/loader/src/server/Server.cpp +++ b/loader/src/server/Server.cpp @@ -206,8 +206,17 @@ std::string server::getServerAPIBaseURL() { return "https://api.geode-sdk.org/v1"; } +std::string server::getServerUserAgent() { + // this may change in the future.. + return fmt::format("Geode {}/{}", + Loader::get()->getVersion().toString(), + PlatformID::toShortString(GEODE_PLATFORM_TARGET) + ); +} + ServerPromise server::getMods(ModsQuery query) { auto req = web::WebRequest(); + req.userAgent(getServerUserAgent()); // Always target current GD version and Loader version req.param("gd", GEODE_GD_VERSION_STR); @@ -274,6 +283,8 @@ ServerPromise server::getMods(ModsQuery query) { ServerPromise server::getModLogo(std::string const& id) { auto req = web::WebRequest(); + req.userAgent(getServerUserAgent()); + req.param("id", id); return ServerPromise([req = std::move(req), id](auto resolve, auto reject, auto progress, auto cancel) mutable { req.get(getServerAPIBaseURL() + "/mods/" + id + "/logo") diff --git a/loader/src/server/Server.hpp b/loader/src/server/Server.hpp index 8476fc80..b5aac852 100644 --- a/loader/src/server/Server.hpp +++ b/loader/src/server/Server.hpp @@ -75,6 +75,7 @@ namespace server { using ServerPromise = Promise; std::string getServerAPIBaseURL(); + std::string getServerUserAgent(); ServerPromise getMods(ModsQuery query); ServerPromise getModLogo(std::string const& id); }