diff --git a/src/handler/interfaces.cpp b/src/handler/interfaces.cpp index 0aa502310..8431ad982 100644 --- a/src/handler/interfaces.cpp +++ b/src/handler/interfaces.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -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 @@ -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;