Skip to content

Commit

Permalink
Add support for converting some groups to proxies in Surge subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tindy2013 committed Aug 11, 2020
1 parent f6bb9bd commit a90ceb4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/subexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,11 +1740,24 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, const std::string &base_c
if(!filtered_nodelist.size())
filtered_nodelist.emplace_back("DIRECT");

if(filtered_nodelist.size() == 1)
{
proxy = toLower(filtered_nodelist[0]);
bool match_flag = false;
switch(hash_(proxy))
{
case "direct"_hash:
case "reject"_hash:
case "reject-tinygif"_hash:
ini.Set("Proxy", "{NONAME}", vArray[0] + " = " + proxy);
match_flag = true;
break;
}
if(match_flag)
continue;
}

proxy = vArray[1] + ",";
/*
for(std::string &y : filtered_nodelist)
proxy += "," + y;
*/
proxy += std::accumulate(std::next(filtered_nodelist.cbegin()), filtered_nodelist.cend(), filtered_nodelist[0], [](std::string a, std::string b)
{
return std::move(a) + "," + std::move(b);
Expand Down

0 comments on commit a90ceb4

Please sign in to comment.