CefInject: Steam table title matching by substring instead of startsWith

pull/239/head
Peter Repukat 1 year ago
parent ffdb227d2b
commit b9cb0414a7

@ -169,7 +169,7 @@ namespace CEFInject
if (res->status == 200) { if (res->status == 200) {
const auto json = nlohmann::json::parse(res->body); const auto json = nlohmann::json::parse(res->body);
for (const auto& tab : json) { for (const auto& tab : json) {
if (tab["title"].get<std::wstring>().starts_with(tabname)) { if (tab["title"].get<std::wstring>().find(tabname) != std::string::npos) {
return InjectJs(tab["title"].get<std::string>(), tab["webSocketDebuggerUrl"].get<std::string>(), js, port); return InjectJs(tab["title"].get<std::string>(), tab["webSocketDebuggerUrl"].get<std::string>(), js, port);
} }
} }
@ -213,7 +213,7 @@ namespace CEFInject
return [&info](const nlohmann::json::array_t& tabList) return [&info](const nlohmann::json::array_t& tabList)
{ {
for (const auto& tab : tabList) { for (const auto& tab : tabList) {
if (tab["title"].get<std::string>().starts_with(info.name.data())) { if (tab["title"].get<std::string>().find(info.name.data()) != std::string::npos) {
return tab; return tab;
} }
} }
@ -347,7 +347,7 @@ namespace CEFInject
const auto dir_name = path.parent_path().filename(); const auto dir_name = path.parent_path().filename();
if (path_tab_map_.contains(dir_name.wstring())) { if (path_tab_map_.contains(dir_name.wstring())) {
if (tab["title"].get<std::string>().starts_with(path_tab_map_.at(dir_name.wstring()))) { if (tab["title"].get<std::string>().find(path_tab_map_.at(dir_name.wstring())) != std::string::npos) {
InjectJs(tab["title"].get<std::string>(), tab["webSocketDebuggerUrl"].get<std::string>(), js); InjectJs(tab["title"].get<std::string>(), tab["webSocketDebuggerUrl"].get<std::string>(), js);
} }
} }

Loading…
Cancel
Save