Skip to content

Commit 80d57fa

Browse files
committed
feat: 脚本转换时也使用自定义请求 Headers
1 parent bf3b475 commit 80d57fa

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Rewrite-Parser.beta.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,13 @@ if (binaryInfo != null && binaryInfo.length > 0) {
492492
jsPre = 'http://script.hub/convert/_start_/'
493493
}
494494
if (jscStatus == true) {
495-
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script`
495+
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script&header=${encodeURIComponent(
496+
decodeURIComponent(queryObject.headers || '')
497+
)}`
496498
} else if (jsc2Status == true) {
497-
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script&wrap_response=true`
499+
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script&wrap_response=true&header=${encodeURIComponent(
500+
decodeURIComponent(queryObject.headers || '')
501+
)}`
498502
}
499503

500504
if (compatibilityOnly == true && (jscStatus == true || jsc2Status == true)) {
@@ -2304,7 +2308,9 @@ function getMockInfo(x, mark, y) {
23042308
: ''
23052309
if (keepHeader == false) mockheader = ''
23062310

2307-
mockurl = `http://script.hub/convert/_start_/${mockurl}/_end_/${mfile}?type=mock&target-app=${targetApp}${mockheader}${sufkeepHeader}${sufjsDelivr}`
2311+
mockurl = `http://script.hub/convert/_start_/${mockurl}/_end_/${mfile}?type=mock&target-app=${targetApp}&header=${encodeURIComponent(
2312+
decodeURIComponent(queryObject.headers || '')
2313+
)}${mockheader}${sufkeepHeader}${sufjsDelivr}`
23082314
jsBox.push({
23092315
mark,
23102316
noteK,

Rewrite-Parser.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,13 @@ if (binaryInfo != null && binaryInfo.length > 0) {
492492
jsPre = 'http://script.hub/convert/_start_/'
493493
}
494494
if (jscStatus == true) {
495-
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script`
495+
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script&header=${encodeURIComponent(
496+
decodeURIComponent(queryObject.headers || '')
497+
)}`
496498
} else if (jsc2Status == true) {
497-
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script&wrap_response=true`
499+
jsSuf = `/_end_/_yuliu_.js?type=_js_from_-script&target=${app}-script&wrap_response=true&header=${encodeURIComponent(
500+
decodeURIComponent(queryObject.headers || '')
501+
)}`
498502
}
499503

500504
if (compatibilityOnly == true && (jscStatus == true || jsc2Status == true)) {
@@ -2304,7 +2308,9 @@ function getMockInfo(x, mark, y) {
23042308
: ''
23052309
if (keepHeader == false) mockheader = ''
23062310

2307-
mockurl = `http://script.hub/convert/_start_/${mockurl}/_end_/${mfile}?type=mock&target-app=${targetApp}${mockheader}${sufkeepHeader}${sufjsDelivr}`
2311+
mockurl = `http://script.hub/convert/_start_/${mockurl}/_end_/${mfile}?type=mock&target-app=${targetApp}&header=${encodeURIComponent(
2312+
decodeURIComponent(queryObject.headers || '')
2313+
)}${mockheader}${sufkeepHeader}${sufjsDelivr}`
23082314
jsBox.push({
23092315
mark,
23102316
noteK,

0 commit comments

Comments
 (0)