mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-03-24 12:05:10 +00:00
Update resource-parser.js
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2026-02-06 15:37⟧
|
||||
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2026-02-06 16:40⟧
|
||||
----------------------------------------------------------
|
||||
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/ShawnKOP_Parser_Bot
|
||||
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
||||
@@ -3050,7 +3050,7 @@ function YAMLFix(cnt){
|
||||
cnt = cnt.replace(/\[/g,"yaml@bug1").replace(/\\r/g,"").replace(/\*/g,"yaml@bug2")
|
||||
//2022-08-08 增加 .replace(/\*/g,"🌟@bug2") 以解决名字以 * 开始时引起的部分问题
|
||||
if (cnt.indexOf("{") != -1 && /\{\s*\"*(name|type|server)/.test(cnt)){ // - { } 类型 yaml
|
||||
cnt = cnt.replace(/ +/g," ").replace(/ \- \{/g," - {") // 2026-02-06 部分空格解析错误
|
||||
cnt = cleanYamlSpaces(cnt) // 2026-02-06 部分空格解析错误
|
||||
cnt = cnt.replace(/(^|\n)- /g, "$1 - ").replace(/ - /g," - ").replace(/:(?!\s)/g,": ").replace(/\,\"/g,", \"").replace(/: {\s{0,1}/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)
|
||||
@@ -3090,6 +3090,15 @@ function YAMLFix(cnt){
|
||||
return cnt
|
||||
}
|
||||
|
||||
// 2026-02-06 {} yaml 空格问题修复
|
||||
function cleanYamlSpaces(yamlText) {
|
||||
return yamlText.split('\n').map(line => {
|
||||
if (line.includes('{') && line.includes('}')) {
|
||||
return ' ' + line.trim().replace(/ {2,}/g, ' ');
|
||||
}
|
||||
return line;
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
function yamlcheck(cnt){
|
||||
if (cnt.indexOf("name") !=-1){ //名字以某些数字结尾时,解析有 bug
|
||||
|
||||
Reference in New Issue
Block a user