fix singbox parser bug.(#4)

This commit is contained in:
asdlokj1qpi23
2023-12-30 19:18:30 +08:00
parent 7bd6670448
commit 897dc5ed43

View File

@@ -2709,15 +2709,22 @@ void explodeSub(std::string sub, std::vector<Proxy> &nodes) {
throw;
}
try {
std::string pattern = "\"?(inbounds)\"?:";
if (!processed &&
regFind(sub, "^(?=.*(\"?(inbounds)\"?:))(?=.*(\"?(outbounds)\"?:))(?=.*(\"?(route)\"?:)).*")) {
rapidjson::Document document;
document.Parse(sub.c_str());
if (!document.HasParseError() || document.IsObject()) {
rapidjson::Value &value = document["outbounds"];
if (value.IsArray() && !value.Empty()) {
explodeSingbox(value, nodes);
processed = true;
regFind(sub, pattern)) {
pattern = "\"?(outbounds)\"?:";
if (regFind(sub, pattern)) {
pattern = "\"?(route)\"?:";
if (regFind(sub, pattern)) {
rapidjson::Document document;
document.Parse(sub.c_str());
if (!document.HasParseError() || document.IsObject()) {
rapidjson::Value &value = document["outbounds"];
if (value.IsArray() && !value.Empty()) {
explodeSingbox(value, nodes);
processed = true;
}
}
}
}
}