From a90ceb4b8e58c974fb28f65c0381b3c84a899c35 Mon Sep 17 00:00:00 2001 From: Tindy X <49061470+tindy2013@users.noreply.github.com> Date: Tue, 11 Aug 2020 13:49:31 +0800 Subject: [PATCH] Add support for converting some groups to proxies in Surge subscriptions --- src/subexport.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/subexport.cpp b/src/subexport.cpp index b26ba3bd0..94504d6fe 100644 --- a/src/subexport.cpp +++ b/src/subexport.cpp @@ -1740,11 +1740,24 @@ std::string netchToSurge(std::vector &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);