mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-02 09:43:45 +00:00
Format short-id in node list
This commit is contained in:
1 parent
cd74f4dc22
commit
a9183c27ad
3 files changed
+5
-4
No files matched your search
@@ -805,7 +805,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void formatterShortId(std::string &input) {
|
std::string formatterShortId(std::string input) {
|
||||||
std::string target = "short-id:";
|
std::string target = "short-id:";
|
||||||
size_t startPos = input.find(target);
|
size_t startPos = input.find(target);
|
||||||
|
|
||||||
@@ -830,6 +830,7 @@ void formatterShortId(std::string &input) {
|
|||||||
// 继续查找下一个实例
|
// 继续查找下一个实例
|
||||||
startPos = input.find(target, startPos + 1);
|
startPos = input.find(target, startPos + 1);
|
||||||
}
|
}
|
||||||
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
|
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
@@ -879,8 +880,7 @@ std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
//rulesetToClash(yamlnode, ruleset_content_array, ext.overwrite_original_rules, ext.clash_new_field_name);
|
//rulesetToClash(yamlnode, ruleset_content_array, ext.overwrite_original_rules, ext.clash_new_field_name);
|
||||||
//std::string output_content = YAML::Dump(yamlnode);
|
//std::string output_content = YAML::Dump(yamlnode);
|
||||||
replaceAll(output_content, "!<str> ", "");
|
replaceAll(output_content, "!<str> ", "");
|
||||||
formatterShortId(output_content);
|
return formatterShortId(std::move(output_content));
|
||||||
return output_content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceAll(std::string &input, const std::string &search, const std::string &replace) {
|
void replaceAll(std::string &input, const std::string &search, const std::string &replace) {
|
||||||
|
|||||||
@@ -74,4 +74,5 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
std::string proxyToSSD(std::vector<Proxy> &nodes, std::string &group, std::string &userinfo, extra_settings &ext);
|
std::string proxyToSSD(std::vector<Proxy> &nodes, std::string &group, std::string &userinfo, extra_settings &ext);
|
||||||
std::string proxyToSingBox(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext);
|
std::string proxyToSingBox(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext);
|
||||||
void replaceAll(std::string& input, const std::string& search, const std::string& replace);
|
void replaceAll(std::string& input, const std::string& search, const std::string& replace);
|
||||||
|
std::string formatterShortId(std::string input);
|
||||||
#endif // SUBEXPORT_H_INCLUDED
|
#endif // SUBEXPORT_H_INCLUDED
|
||||||
@@ -703,7 +703,7 @@ std::string subconverter(RESPONSE_CALLBACK_ARGS) {
|
|||||||
if (ext.nodelist) {
|
if (ext.nodelist) {
|
||||||
YAML::Node yamlnode;
|
YAML::Node yamlnode;
|
||||||
proxyToClash(nodes, yamlnode, dummy_group, argTarget == "clashr", ext);
|
proxyToClash(nodes, yamlnode, dummy_group, argTarget == "clashr", ext);
|
||||||
output_content = YAML::Dump(yamlnode);
|
output_content = formatterShortId(YAML::Dump(yamlnode));
|
||||||
} else {
|
} else {
|
||||||
if (render_template(fetchFile(lClashBase, proxy, global.cacheConfig), tpl_args, base_content,
|
if (render_template(fetchFile(lClashBase, proxy, global.cacheConfig), tpl_args, base_content,
|
||||||
global.templatePath) != 0) {
|
global.templatePath) != 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user