feat: add getCatalogItems listener
Build / build (push) Successful in 3m32s

This commit is contained in:
2026-04-09 23:23:10 -03:00
parent a1a123054f
commit 0fa2e0540b
2 changed files with 23 additions and 13 deletions
+22 -13
View File
@@ -103,19 +103,6 @@ bool Spoofer::parseCatalog(std::string data)
return false;
}
std::thread t([&data]() {
std::string outPath = utils::getExePath() + "catalog.json";
std::ofstream file(outPath);
if (file.is_open())
{
file << data;
file.close();
Log::verbose("Raw catalog saved to {}", outPath);
}
else
Log::error("Unable to write to catalog.json");
});
try
{
const auto& catalogData = doc.at("data");
@@ -367,6 +354,26 @@ void Spoofer::modifyCharacterData(json& js)
/*
endpoint handlers
*/
void Spoofer::onGetCatalogItems(std::string& body)
{
std::thread t([body]() {
std::string outPath = utils::getExePath() + "catalog.json";
std::ofstream file(outPath);
if (file.is_open())
{
file << body;
file.close();
Log::verbose("Raw catalog saved to {}", outPath);
}
else
Log::error("Unable to write to catalog.json");
});
t.detach();
parseCatalog(body);
}
void Spoofer::onGetAll(std::string& body)
{
json doc = json::parse(body, nullptr, false);
@@ -550,6 +557,8 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
Log::verbose("BHVR api res @ {}", url);
#endif
if (url.find("api/v1/extensions/store/getCatalogItems") != std::string::npos) return onGetCatalogItems(body);
if (url.find("api/v1/dbd-character-data/get-all") != std::string::npos) return onGetAll(body);
if (url.find("api/v1/dbd-character-data/get-all") != std::string::npos) return onGetAll(body);
if (url.find("api/v1/dbd-inventories/all") != std::string::npos) return onInventoryAll(body);
if (url.find("/api/v1/messages/listV2") != std::string::npos) return onMessageList(body);
+1
View File
@@ -28,6 +28,7 @@ class Spoofer
void generateBloodweb(nlohmann::json& data);
void modifyCharacterData(nlohmann::json& js);
void onGetCatalogItems(std::string& body);
void onGetAll(std::string& body);
void onInventoryAll(std::string& body);
void onMessageList(std::string& body);