fix: use ends_with instead of find when possible
This commit is contained in:
@@ -754,11 +754,14 @@ 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/dbd-character-data/get-all") != std::string::npos) return onGetAll(body);
|
if (url.ends_with("api/v1/dbd-inventories/all")) 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);
|
||||||
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 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);
|
return onBloodweb(body, respHeaders);
|
||||||
|
|
||||||
if (url.ends_with("api/v1/owned-products/get-update-entitlements")) return onUpdateEntitlements(url, body);
|
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;
|
if (url.find("bhvrdbd.com") == std::string::npos) return;
|
||||||
std::lock_guard<std::mutex> lock(_mtx);
|
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.ends_with("api/v1/dbd-character-data/get-all")) 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/bloodweb") ||
|
||||||
|
url.ends_with("api/v1/dbd-character-data/bulk-spending-bloodweb"))
|
||||||
return onBloodwebClient(body);
|
return onBloodwebClient(body);
|
||||||
|
|
||||||
if (url.ends_with("api/v1/owned-products/get-update-entitlements")) return onUpdateEntitlementsClient(url, body);
|
if (url.ends_with("api/v1/owned-products/get-update-entitlements")) return onUpdateEntitlementsClient(url, body);
|
||||||
|
|||||||
Reference in New Issue
Block a user