mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2025-10-26 10:52:21 +00:00
Fix a bug which will cause directly-added rules to not appear in Clash subscriptions.
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -83,7 +83,7 @@ std::string refreshRulesets()
|
|||||||
if(rule_url.find("[]") == 0)
|
if(rule_url.find("[]") == 0)
|
||||||
{
|
{
|
||||||
std::cerr<<"Adding rule '"<<rule_url.substr(2)<<","<<rule_group<<"'."<<std::endl;
|
std::cerr<<"Adding rule '"<<rule_url.substr(2)<<","<<rule_group<<"'."<<std::endl;
|
||||||
rc = {rule_group, rule_url};
|
rc = {rule_group, "", rule_url};
|
||||||
ruleset_content_array.emplace_back(rc);
|
ruleset_content_array.emplace_back(rc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,10 +288,10 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
|
|||||||
for(ruleset_content &x : ruleset_content_array)
|
for(ruleset_content &x : ruleset_content_array)
|
||||||
{
|
{
|
||||||
rule_group = x.rule_group;
|
rule_group = x.rule_group;
|
||||||
rule_path = x.rule_path;
|
retrived_rules = x.rule_content;
|
||||||
if(rule_path.find("[]") == 0)
|
if(retrived_rules.find("[]") == 0)
|
||||||
{
|
{
|
||||||
strLine = rule_path.substr(2);
|
strLine = retrived_rules.substr(2);
|
||||||
if(strLine == "MATCH")
|
if(strLine == "MATCH")
|
||||||
strLine = "FINAL";
|
strLine = "FINAL";
|
||||||
allRules.emplace_back(strLine + "," + rule_group);
|
allRules.emplace_back(strLine + "," + rule_group);
|
||||||
@@ -299,6 +299,7 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
rule_path = x.rule_path;
|
||||||
if(!fileExist(rule_path))
|
if(!fileExist(rule_path))
|
||||||
{
|
{
|
||||||
if(surge_ver > 2)
|
if(surge_ver > 2)
|
||||||
@@ -308,7 +309,6 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retrived_rules = x.rule_content;
|
|
||||||
char delimiter = count(retrived_rules.begin(), retrived_rules.end(), '\n') < 1 ? '\r' : '\n';
|
char delimiter = count(retrived_rules.begin(), retrived_rules.end(), '\n') < 1 ? '\r' : '\n';
|
||||||
|
|
||||||
strStrm.clear();
|
strStrm.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user