Merge pull request #110 from SilentTiger/master

fix: proxy config with space character
This commit is contained in:
Shawn Wen
2024-01-15 12:31:22 +08:00
committed by GitHub

View File

@@ -2844,7 +2844,7 @@ function YAMLFix(cnt){
//2022-04-11 remove tls|skip from 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) console.log("1st:\n"+cnt)
cnt = cnt.replace(/{\s*name: (.*?), (.*?):/g,"{name: \"$1\", $2:") //cnt.replace(/{\s*name: /g,"{name: \"").replace(/, (.*?):/,"\", $1:") 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(/{\s*|\s*}/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") 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")
if(Pdbg == 1) { if(Pdbg == 1) {