Skip to content

Commit c2e6a61

Browse files
支持qx的jsonjq类型作为输入
1 parent fb4e6d4 commit c2e6a61

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Rewrite-Parser.beta.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ let name,
165165
size,
166166
proto,
167167
engine,
168+
jsenable,
168169
jsptn,
169170
jsarg,
170171
rebody,
@@ -557,8 +558,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
557558
rw_redirect(x, mark)
558559
}
559560

560-
if (/\s((request|response)-body-json-jq)\s/.test(_x)) {
561-
let [_, regex, type, value] = _x.match(/^(.*?)\s+?(?:(request|response)-body-json-jq)\s+?(.*?)\s*$/)
561+
if (/\s((request|response)-body-json-jq)\s|\surl\sjsonjq-(response|request)-body/.test(_x)) {
562+
let [_, regex, type, value] = _x.match(/^(.*?)\s+?(?:url\s+?jsonjq-)?(request|response)-body(?:-json-jq)?\s+?(.*?)\s*$/)
562563
if (jqEnabled && (isSurgeiOS || isStashiOS)) {
563564
const jqPath = value.match(/jq-path="(.+?)"/)?.[1]
564565
if (jqPath) {
@@ -576,7 +577,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
576577
rwbodyBox.push({ type: `http-${type}-jq`, regex, value })
577578
}
578579
} else if (isLooniOS) {
579-
URLRewrite.push(x)
580+
/body-json-jq/.test(_x) ? URLRewrite.push(_x) : URLRewrite.push(`${regex} ${type}-body-json-jq ${value}`)
580581
}
581582
}
582583

@@ -821,6 +822,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
821822
: ''
822823
ability = getJsInfo(x, /[=,\s]\s*ability\s*=\s*/)
823824
engine = getJsInfo(x, /[=,\s]\s*engine\s*=\s*/)
825+
jsenable = getJsInfo(x, /[=,\s]\s*enable\s*=\s*/)
824826
updatetime = getJsInfo(x, /[=,\s]\s*script-update-interval\s*=\s*/)
825827
timeout = getJsInfo(x, /[=,\s]\s*timeout\s*=\s*/)
826828
tilesicon = jstype == 'generic' && /icon=/.test(x) ? x.split('icon=')[1].split('&')[0] : ''
@@ -843,6 +845,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
843845
timeout: '120',
844846
jsarg: '',
845847
rebody: '',
848+
jsenable,
846849
ori: x,
847850
num: y,
848851
})
@@ -872,6 +875,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
872875
tilescolor,
873876
eventname,
874877
engine,
878+
jsenable,
875879
ori: x,
876880
num: y,
877881
})
@@ -1448,6 +1452,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
14481452
rebody = jsBox[i].rebody ? istrue(jsBox[i].rebody) : ''
14491453
proto = jsBox[i].proto ? istrue(jsBox[i].proto) : ''
14501454
engine = jsBox[i].engine ? jsBox[i].engine : ''
1455+
jsenable = jsBox[i].jsenable ? jsBox[i].jsenable : ''
14511456
size = jsBox[i].size ? jsBox[i].size : ''
14521457
ability = jsBox[i].ability ? ', ability=' + jsBox[i].ability : ''
14531458
updatetime = jsBox[i].updatetime ? ', script-update-interval=' + jsBox[i].updatetime : ''
@@ -1480,6 +1485,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
14801485
size = size ? ', max-size=' + size : ''
14811486
timeout = timeout ? ', timeout=' + timeout : ''
14821487
engine = engine && isSurgeiOS ? ', engine=' + engine : ''
1488+
jsenable = jsenable && isLooniOS ? ', enable=' + jsenable : ''
14831489
if (jsarg != '' && /,/.test(jsarg) && !/^".+"$/.test(jsarg)) jsarg = ', argument="' + jsarg + '"'
14841490
if (jsarg != '' && (!/,/.test(jsarg) || /^".+"$/.test(jsarg))) jsarg = ', argument=' + jsarg
14851491

@@ -1500,6 +1506,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
15001506
timeout +
15011507
', tag=' +
15021508
jsname +
1509+
jsenable +
15031510
img +
15041511
jsarg
15051512
)
@@ -1569,6 +1576,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
15691576
timeout +
15701577
', tag=' +
15711578
jsname +
1579+
jsenable +
15721580
img +
15731581
jsarg
15741582
)

Rewrite-Parser.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ let name,
165165
size,
166166
proto,
167167
engine,
168+
jsenable,
168169
jsptn,
169170
jsarg,
170171
rebody,
@@ -557,8 +558,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
557558
rw_redirect(x, mark)
558559
}
559560

560-
if (/\s((request|response)-body-json-jq)\s/.test(_x)) {
561-
let [_, regex, type, value] = _x.match(/^(.*?)\s+?(?:(request|response)-body-json-jq)\s+?(.*?)\s*$/)
561+
if (/\s((request|response)-body-json-jq)\s|\surl\sjsonjq-(response|request)-body/.test(_x)) {
562+
let [_, regex, type, value] = _x.match(/^(.*?)\s+?(?:url\s+?jsonjq-)?(request|response)-body(?:-json-jq)?\s+?(.*?)\s*$/)
562563
if (jqEnabled && (isSurgeiOS || isStashiOS)) {
563564
const jqPath = value.match(/jq-path="(.+?)"/)?.[1]
564565
if (jqPath) {
@@ -576,7 +577,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
576577
rwbodyBox.push({ type: `http-${type}-jq`, regex, value })
577578
}
578579
} else if (isLooniOS) {
579-
URLRewrite.push(x)
580+
/body-json-jq/.test(_x) ? URLRewrite.push(_x) : URLRewrite.push(`${regex} ${type}-body-json-jq ${value}`)
580581
}
581582
}
582583

@@ -821,6 +822,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
821822
: ''
822823
ability = getJsInfo(x, /[=,\s]\s*ability\s*=\s*/)
823824
engine = getJsInfo(x, /[=,\s]\s*engine\s*=\s*/)
825+
jsenable = getJsInfo(x, /[=,\s]\s*enable\s*=\s*/)
824826
updatetime = getJsInfo(x, /[=,\s]\s*script-update-interval\s*=\s*/)
825827
timeout = getJsInfo(x, /[=,\s]\s*timeout\s*=\s*/)
826828
tilesicon = jstype == 'generic' && /icon=/.test(x) ? x.split('icon=')[1].split('&')[0] : ''
@@ -843,6 +845,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
843845
timeout: '120',
844846
jsarg: '',
845847
rebody: '',
848+
jsenable,
846849
ori: x,
847850
num: y,
848851
})
@@ -872,6 +875,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
872875
tilescolor,
873876
eventname,
874877
engine,
878+
jsenable,
875879
ori: x,
876880
num: y,
877881
})
@@ -1448,6 +1452,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
14481452
rebody = jsBox[i].rebody ? istrue(jsBox[i].rebody) : ''
14491453
proto = jsBox[i].proto ? istrue(jsBox[i].proto) : ''
14501454
engine = jsBox[i].engine ? jsBox[i].engine : ''
1455+
jsenable = jsBox[i].jsenable ? jsBox[i].jsenable : ''
14511456
size = jsBox[i].size ? jsBox[i].size : ''
14521457
ability = jsBox[i].ability ? ', ability=' + jsBox[i].ability : ''
14531458
updatetime = jsBox[i].updatetime ? ', script-update-interval=' + jsBox[i].updatetime : ''
@@ -1480,6 +1485,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
14801485
size = size ? ', max-size=' + size : ''
14811486
timeout = timeout ? ', timeout=' + timeout : ''
14821487
engine = engine && isSurgeiOS ? ', engine=' + engine : ''
1488+
jsenable = jsenable && isLooniOS ? ', enable=' + jsenable : ''
14831489
if (jsarg != '' && /,/.test(jsarg) && !/^".+"$/.test(jsarg)) jsarg = ', argument="' + jsarg + '"'
14841490
if (jsarg != '' && (!/,/.test(jsarg) || /^".+"$/.test(jsarg))) jsarg = ', argument=' + jsarg
14851491

@@ -1500,6 +1506,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
15001506
timeout +
15011507
', tag=' +
15021508
jsname +
1509+
jsenable +
15031510
img +
15041511
jsarg
15051512
)
@@ -1569,6 +1576,7 @@ if (binaryInfo != null && binaryInfo.length > 0) {
15691576
timeout +
15701577
', tag=' +
15711578
jsname +
1579+
jsenable +
15721580
img +
15731581
jsarg
15741582
)

0 commit comments

Comments
 (0)