Format short-id in node list

This commit is contained in:
AkariiinMKII committed 2026-03-30 14:22:53 +08:00
1 parent cd74f4dc22
commit a9183c27ad
3 files changed
+6 -5

No files matched your search

+3 -3
View File
@@ -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:";
size_t startPos = input.find(target);
@@ -830,6 +830,7 @@ void formatterShortId(std::string &input) {
// 继续查找下一个实例
startPos = input.find(target, startPos + 1);
}
return input;
}
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);
//std::string output_content = YAML::Dump(yamlnode);
replaceAll(output_content, "!<str> ", "");
formatterShortId(output_content);
return output_content;
return formatterShortId(std::move(output_content));
}
void replaceAll(std::string &input, const std::string &search, const std::string &replace) {
+2 -1
View File
@@ -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 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);
#endif // SUBEXPORT_H_INCLUDED
std::string formatterShortId(std::string input);
#endif // SUBEXPORT_H_INCLUDED
+1 -1
View File
@@ -703,7 +703,7 @@ std::string subconverter(RESPONSE_CALLBACK_ARGS) {
if (ext.nodelist) {
YAML::Node yamlnode;
proxyToClash(nodes, yamlnode, dummy_group, argTarget == "clashr", ext);
output_content = YAML::Dump(yamlnode);
output_content = formatterShortId(YAML::Dump(yamlnode));
} else {
if (render_template(fetchFile(lClashBase, proxy, global.cacheConfig), tpl_args, base_content,
global.templatePath) != 0) {