yaml parse bug fixed

This commit is contained in:
Shawn
2023-07-05 21:26:07 +08:00
parent 728b8e8c43
commit e8152d8a7d

View File

@@ -1,5 +1,5 @@
/**
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-06-24 21:10⟧
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-07-05 21:20⟧
----------------------------------------------------------
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/Shawn_Parser_Bot
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
@@ -2812,7 +2812,7 @@ function YAMLFix(cnt){
cnt = cnt.replace(/(^|\n)- /g, "$1 - ").replace(/ - /g," - ").replace(/:(?!\s)/g,": ").replace(/\,\"/g,", \"").replace(/: {/g, ": {, ").replace(/, (Host|host|path|mux)/g,", $1")
//2022-04-11 remove tls|skip from replace(/, (Host|host|path|mux)/g,", $1")
console.log("1st:\n"+cnt)
cnt = cnt.replace(/{\s*name: /g,"{name: \"").replace(/, server:/g,"\", server:")
cnt = cnt.replace(/{\s*name: (.*?), (.*?):/g,"{name: \"$1\", $2:") //cnt.replace(/{\s*name: /g,"{name: \"").replace(/, (.*?):/,"\", $1:")
cnt = cnt.replace(/{|}/g,"").replace(/,/g,"\n ")
}
cnt = cnt.replace(/\n\s*\-\s*\n.*name/g,"\n - name").replace(/\$|\`/g,"").split("proxy-providers:")[0].split("proxy-groups:")[0].replace(/\"(name|type|server|port|cipher|password|uuid|alterId|udp)(\"*)/g,"$1")