mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-05 11:12:12 +00:00
Add fallback support for different names of Shadowsocks plugins
Fix compatibility problem with some non-standard v2rayN subscription. Fix running program from directory other than program folder may cause not using pref.yml as default. Optimize codes.
This commit is contained in:
5 files changed
+22
-4
No files matched your search
+4
-4
@@ -99,6 +99,10 @@ void signal_handler(int sig)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#ifndef _DEBUG
|
||||||
|
std::string prgpath = argv[0];
|
||||||
|
setcd(prgpath); //first switch to program directory
|
||||||
|
#endif // _DEBUG
|
||||||
if(fileExist("pref.yml"))
|
if(fileExist("pref.yml"))
|
||||||
pref_path = "pref.yml";
|
pref_path = "pref.yml";
|
||||||
chkArg(argc, argv);
|
chkArg(argc, argv);
|
||||||
@@ -125,10 +129,6 @@ int main(int argc, char *argv[])
|
|||||||
signal(SIGINT, signal_handler);
|
signal(SIGINT, signal_handler);
|
||||||
|
|
||||||
SetConsoleTitle("SubConverter " VERSION);
|
SetConsoleTitle("SubConverter " VERSION);
|
||||||
#ifndef _DEBUG
|
|
||||||
std::string prgpath = argv[0];
|
|
||||||
setcd(prgpath); //first switch to program directory
|
|
||||||
#endif // _DEBUG
|
|
||||||
readConf();
|
readConf();
|
||||||
if(!update_ruleset_on_request)
|
if(!update_ruleset_on_request)
|
||||||
refreshRulesets(rulesets, ruleset_content_array);
|
refreshRulesets(rulesets, ruleset_content_array);
|
||||||
|
|||||||
@@ -451,6 +451,20 @@ std::string getSystemProxy()
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void trim_self_of(std::string &str, char target, bool before, bool after)
|
||||||
|
{
|
||||||
|
if (!before && !after)
|
||||||
|
return;
|
||||||
|
std::string::size_type pos = str.size() - 1;
|
||||||
|
if (after)
|
||||||
|
pos = str.find_last_not_of(target);
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
str.erase(pos + 1);
|
||||||
|
if (before)
|
||||||
|
pos = str.find_first_not_of(target);
|
||||||
|
str.erase(0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
std::string trim_of(const std::string& str, char target, bool before, bool after)
|
std::string trim_of(const std::string& str, char target, bool before, bool after)
|
||||||
{
|
{
|
||||||
if (!before && !after)
|
if (!before && !after)
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ std::string ACPToUTF8(const std::string &str_src);
|
|||||||
std::string trim_of(const std::string& str, char target, bool before = true, bool after = true);
|
std::string trim_of(const std::string& str, char target, bool before = true, bool after = true);
|
||||||
std::string trim(const std::string& str, bool before = true, bool after = true);
|
std::string trim(const std::string& str, bool before = true, bool after = true);
|
||||||
std::string trim_quote(const std::string &str, bool before = true, bool after = true);
|
std::string trim_quote(const std::string &str, bool before = true, bool after = true);
|
||||||
|
void trim_self_of(std::string &str, char target, bool before = true, bool after = true);
|
||||||
std::string getSystemProxy();
|
std::string getSystemProxy();
|
||||||
std::string rand_str(const int len);
|
std::string rand_str(const int len);
|
||||||
bool is_str_utf8(const std::string &data);
|
bool is_str_utf8(const std::string &data);
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ void explodeVmess(std::string vmess, const std::string &custom_port, nodeInfo &n
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add = trim(add);
|
||||||
node.linkType = SPEEDTEST_MESSAGE_FOUNDVMESS;
|
node.linkType = SPEEDTEST_MESSAGE_FOUNDVMESS;
|
||||||
node.group = V2RAY_DEFAULT_GROUP;
|
node.group = V2RAY_DEFAULT_GROUP;
|
||||||
node.remarks = ps;
|
node.remarks = ps;
|
||||||
|
|||||||
@@ -1548,6 +1548,7 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, const std::string &base_c
|
|||||||
switch(hash_(plugin))
|
switch(hash_(plugin))
|
||||||
{
|
{
|
||||||
case "simple-obfs"_hash:
|
case "simple-obfs"_hash:
|
||||||
|
case "obfs-local"_hash:
|
||||||
if(pluginopts.size())
|
if(pluginopts.size())
|
||||||
proxy += "," + replace_all_distinct(pluginopts, ";", ",");
|
proxy += "," + replace_all_distinct(pluginopts, ";", ",");
|
||||||
break;
|
break;
|
||||||
@@ -2299,6 +2300,7 @@ void netchToQuanX(std::vector<nodeInfo> &nodes, INIReader &ini, std::vector<rule
|
|||||||
switch(hash_(plugin))
|
switch(hash_(plugin))
|
||||||
{
|
{
|
||||||
case "simple-obfs"_hash:
|
case "simple-obfs"_hash:
|
||||||
|
case "obfs-local"_hash:
|
||||||
if(pluginopts.size())
|
if(pluginopts.size())
|
||||||
proxyStr += ", " + replace_all_distinct(pluginopts, ";", ", ");
|
proxyStr += ", " + replace_all_distinct(pluginopts, ";", ", ");
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in new issue
Block a user