Skip to content

Commit ed9c8b2

Browse files
test
1 parent 1ef3930 commit ed9c8b2

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

Rewrite-Parser.beta.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
522522
}
523523

524524
//#!arguments参数
525-
if (/^#!arguments\s*=\s*.+/.test(x) || /=\s*input|select|switch/.test(x)) {
525+
if (/^#!arguments\s*=\s*.+/.test(x) || /^[^#]=\s*(input|select|switch)\s*,/.test(x)) {
526526
parseArguments(x)
527527
}
528528

@@ -1434,6 +1434,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
14341434

14351435
cronexp = reJsValue(nCron || 'null', ncronexp, jsname, ori, cronexp)
14361436

1437+
cronexp = /,/.test(cronexp) ? '"' + cronexp + '"' : cronexp
1438+
14371439
jsname = reJsValue(njsnametarget || 'null', njsname, jsname, ori, jsname)
14381440

14391441
timeout = reJsValue(timeoutt || 'null', timeoutv, jsname, ori, timeout)
@@ -1516,9 +1518,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
15161518
jsname +
15171519
' = type=' +
15181520
jstype +
1519-
', cronexp="' +
1521+
', cronexp=' +
15201522
cronexp +
1521-
'"' +
15221523
', script-path=' +
15231524
jsurl +
15241525
updatetime +
@@ -1532,9 +1533,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
15321533
mark +
15331534
noteK +
15341535
jstype +
1535-
' "' +
1536+
' ' +
15361537
cronexp +
1537-
'"' +
15381538
' script-path=' +
15391539
jsurl +
15401540
timeout +
@@ -1659,7 +1659,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
16591659
providers.push(`${noteK2}"` + jsname + '":' + `${noteKn4}url: ` + jsurl + `${noteKn4}interval: 86400`)
16601660
}
16611661
if (jstype == 'cron') {
1662-
cron.push(mark + `${noteK4}- name: "` + jsname + `"${noteKn6}cron: "` + cronexp + `"${timeout}` + jsarg)
1662+
cron.push(mark + `${noteK4}- name: "` + jsname + `"${noteKn6}cron: ` + cronexp + `${timeout}` + jsarg)
16631663
providers.push(`${noteK2}"` + jsname + '":' + `${noteKn4}url: ` + jsurl + `${noteKn4}interval: 86400`)
16641664
}
16651665
if (jstype == 'generic') {
@@ -1703,7 +1703,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
17031703
script = (script[0] || '') && `[Script]\n${script.join('\n\n')}`
17041704

17051705
if (isLooniOS) {
1706-
MITM = hnBox.length > 0 ? '[MITM]\nhostname = ' + hnBox : ''
1706+
MITM = hnBox.length > 0 ? `[MITM]\n${hn2name} = ` + hnBox : ''
17071707
fheBox.length > 0 && General.push('force-http-engine-hosts = ' + fheBox)
17081708
skipBox.length > 0 && General.push('skip-proxy = ' + skipBox)
17091709
realBox.length > 0 && General.push('real-ip = ' + realBox)
@@ -1828,9 +1828,10 @@ ${providers}
18281828
} //输出内容结束
18291829
body = body.replace(/\n{2,}/g, '\n\n')
18301830
if (!isSurgeiOS && !isLooniOS && sgArg.length > 0) {
1831+
body = body.replaceAll('{{{','{').replaceAll('}}}','}')
18311832
for (let i = 0; i < sgArg.length; i++) {
1832-
let e = '{{{' + sgArg[i].key + '}}}'
1833-
let r = sgArg[i].value
1833+
let e = '{' + sgArg[i].key + '}'
1834+
let r = sgArg[i].value.split(',')[0]
18341835
body = body.replaceAll(e, r)
18351836
} //for
18361837
} else if (isSurgeiOS) {
@@ -2327,7 +2328,7 @@ function parseArguments(str) {
23272328

23282329
if (value == "hostname") {
23292330
hn2 = true
2330-
hn2name = key
2331+
hn2name = '{{{' + key + '}}}'
23312332
}
23322333
}
23332334
} else {
@@ -2341,7 +2342,7 @@ function parseArguments(str) {
23412342

23422343
if (value == "hostname") {
23432344
hn2 = true
2344-
hn2name = key
2345+
hn2name = '{{{' + key + '}}}'
23452346
}
23462347
}
23472348
}

0 commit comments

Comments
 (0)