Fix inconsistency SS plugin name

Clean up codes.
This commit is contained in:
Tindy X 2021-07-29 01:52:36 +08:00
parent 5f5615d2b8
commit 3ad1c0078e
No known key found for this signature in database
GPG Key ID: C6AD413169968D58
2 changed files with 35 additions and 28 deletions

View File

@ -262,6 +262,8 @@ void preprocessNodes(std::vector<Proxy> &nodes, extra_settings &ext)
if(startsWith(script, "path:"))
script = fileGet(script.substr(5), false);
script_safe_runner(ext.js_runtime, ext.js_context, [&](qjs::Context &ctx)
{
try
{
ctx.eval(script);
auto compare = (std::function<int(const Proxy&, const Proxy&)>) ctx.eval("compare");
@ -275,6 +277,11 @@ void preprocessNodes(std::vector<Proxy> &nodes, extra_settings &ext)
};
std::stable_sort(nodes.begin(), nodes.end(), comparer);
failed = false;
}
catch(qjs::exception)
{
script_print_stack(ctx);
}
}, gScriptCleanContext);
}
if(failed) std::stable_sort(nodes.begin(), nodes.end(), [](const Proxy &a, const Proxy &b)
@ -1164,7 +1171,7 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<ruleset_
else
{
proxyStr = remark + " = shadowsocks, " + hostname + ", " + port + ", " + method + ", \"" + password + "\", group=" + x.Group;
if(plugin == "simple-obfs" && pluginopts.size())
if(plugin == "obfs-local" && pluginopts.size())
{
proxyStr += ", " + replaceAllDistinct(pluginopts, ";", ", ");
}

View File

@ -1010,7 +1010,7 @@ void explodeClash(Node yamlnode, std::vector<Proxy> &nodes)
}
else if(singleproxy["obfs"].IsDefined())
{
plugin = "simple-obfs";
plugin = "obfs-local";
singleproxy["obfs"] >>= pluginopts_mode;
singleproxy["obfs-host"] >>= pluginopts_host;
}