Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/handler/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <string>
#include <mutex>
#include <numeric>
#include <regex>

#include <yaml-cpp/yaml.h>

Expand Down Expand Up @@ -43,6 +44,12 @@ std::string parseProxy(const std::string &source)
return proxy;
}

std::string quoteRealityShortID(const std::string &content)
{
static const std::regex short_id_pattern(R"(short-id:\s*(?!["'])([^,}\]\s#]+))");
return std::regex_replace(content, short_id_pattern, R"(short-id: "$1")");
}

extern string_array ClashRuleTypes, SurgeRuleTypes, QuanXRuleTypes;

struct UAProfile
Expand Down Expand Up @@ -781,6 +788,8 @@ std::string subconverter(RESPONSE_CALLBACK_ARGS)
output_content = proxyToClash(nodes, base_content, lRulesetContent, lCustomProxyGroups, argTarget == "clashr", ext);
}

output_content = quoteRealityShortID(output_content);

if(argUpload)
uploadGist(argTarget, argUploadPath, output_content, false);
break;
Expand Down