This commit is contained in:
+22
-13
@@ -103,19 +103,6 @@ bool Spoofer::parseCatalog(std::string data)
|
|||||||
return false;
|
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
|
try
|
||||||
{
|
{
|
||||||
const auto& catalogData = doc.at("data");
|
const auto& catalogData = doc.at("data");
|
||||||
@@ -367,6 +354,26 @@ void Spoofer::modifyCharacterData(json& js)
|
|||||||
/*
|
/*
|
||||||
endpoint handlers
|
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)
|
void Spoofer::onGetAll(std::string& body)
|
||||||
{
|
{
|
||||||
json doc = json::parse(body, nullptr, false);
|
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);
|
Log::verbose("BHVR api res @ {}", url);
|
||||||
#endif
|
#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-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/dbd-inventories/all") != std::string::npos) return onInventoryAll(body);
|
||||||
if (url.find("/api/v1/messages/listV2") != std::string::npos) return onMessageList(body);
|
if (url.find("/api/v1/messages/listV2") != std::string::npos) return onMessageList(body);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class Spoofer
|
|||||||
void generateBloodweb(nlohmann::json& data);
|
void generateBloodweb(nlohmann::json& data);
|
||||||
void modifyCharacterData(nlohmann::json& js);
|
void modifyCharacterData(nlohmann::json& js);
|
||||||
|
|
||||||
|
void onGetCatalogItems(std::string& body);
|
||||||
void onGetAll(std::string& body);
|
void onGetAll(std::string& body);
|
||||||
void onInventoryAll(std::string& body);
|
void onInventoryAll(std::string& body);
|
||||||
void onMessageList(std::string& body);
|
void onMessageList(std::string& body);
|
||||||
|
|||||||
Reference in New Issue
Block a user