fix: use ends_with instead of find when possible

This commit is contained in:
2026-04-13 01:08:27 -03:00
parent b7aa912e1b
commit bda519e70a
+12 -8
View File
@@ -754,11 +754,14 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
Log::verbose("BHVR api res @ {}", url);
#endif
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);
if (url.find("api/v1/dbd-character-data/bloodweb") != std::string::npos ||
url.find("api/v1/dbd-character-data/bulk-spending-bloodweb") != std::string::npos)
if (url.ends_with("api/v1/dbd-inventories/all")) return onInventoryAll(body);
if (url.find("api/v1/messages/listV2") != std::string::npos) return onMessageList(body);
if (url.ends_with("api/v1/dbd-character-data/get-all")) return onGetAll(body);
if (url.ends_with("api/v1/dbd-character-data/bloodweb") ||
url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb"))
return onBloodweb(body, respHeaders);
if (url.ends_with("api/v1/owned-products/get-update-entitlements")) return onUpdateEntitlements(url, body);
@@ -769,9 +772,10 @@ void Spoofer::clientRequestHandler(const std::string& url, std::string& body, st
if (url.find("bhvrdbd.com") == std::string::npos) return;
std::lock_guard<std::mutex> lock(_mtx);
if (url.find("api/v1/dbd-character-data/get-all") != std::string::npos) return onGetAllClient(body);
if (url.find("api/v1/dbd-character-data/bloodweb") != std::string::npos ||
url.find("api/v1/dbd-character-data/bulk-spending-bloodweb") != std::string::npos)
if (url.ends_with("api/v1/dbd-character-data/get-all")) return onGetAllClient(body);
if (url.ends_with("api/v1/dbd-character-data/bloodweb") ||
url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb"))
return onBloodwebClient(body);
if (url.ends_with("api/v1/owned-products/get-update-entitlements")) return onUpdateEntitlementsClient(url, body);