Skip to content

Commit 440a8d2

Browse files
committed
更新[BoxJs]: 新增入口 http://1.1.1.1/home
1 parent 5aa1a7d commit 440a8d2

5 files changed

Lines changed: 21 additions & 9 deletions

File tree

‎QuantumultX.box.local.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
hostname = 8.8.8.8
1+
hostname = 8.8.8.8, 1.1.1.1
22

33
^https://8.8.8.8/api url script-request-body chavyleung/chavy.box.js
44
^https://8.8.8.8/(home|sub|my|app|log|revert)($|\/) url script-response-body chavyleung/chavy.box.js
5+
^https?://1.1.1.1/api url script-request-body chavy.box.js
6+
^https?://1.1.1.1/(home|sub|my|app|log\/) url script-echo-response chavy.box.js

‎QuantumultX.box.remote.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
hostname = 8.8.8.8
1+
hostname = 8.8.8.8, 1.1.1.1
22

33
^https://8.8.8.8/api url script-request-body https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js
44
^https://8.8.8.8/(home|sub|my|app|log|revert)($|\/) url script-response-body https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js
5+
^https?://1.1.1.1/api url script-request-body https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js
6+
^https?://1.1.1.1/(home|sub|my|app|log\/) url script-echo-response https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js

‎chavy.box.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ $.html = $.name
4747
if ($.isapi) {
4848
$done({ body: $.json })
4949
} else {
50-
$.done({ status: 200, body: $.html })
50+
if ($.isSurge() || $.isLoon()) {
51+
$.done({ response: { status: 200, body: $.html } })
52+
} else if ($.isQuanX()) {
53+
$.done({ status: 'HTTP/1.1 200', headers: { 'Content-Type': 'text/html; charset=utf-8' }, body: $.html })
54+
} else {
55+
$.done()
56+
}
5157
}
5258
})
5359

‎loon.box.conf‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
hostname = 8.8.8.8
22

33
http-request ^https://8.8.8.8/api script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js, requires-body=true
4-
http-response ^https://8.8.8.8/(home|sub|my|app|log|revert)($|\/) script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js, requires-body=true
4+
http-response ^https://8.8.8.8/(home|sub|my|app|log|revert)($|\/) script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js, requires-body=true
5+
http-request ^https?://1.1.1.1/(api|home|sub|my|app|log|revert)($|\/) script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js, requires-body=true, timeout=120, tag=chavy.box.js

‎surge.box.sgmodule‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#!name=Chavy Box Module
2-
#!desc=Chavy 应用盒模块
1+
#!name=Chavy BoxJs Module
2+
#!desc=Chavy BoxJs 模块
33

44
[Script]
5-
Rewrite: Scripts Manager = type=http-request,pattern=^https://8.8.8.8/api,script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js,requires-body=true,max-size=0,timeout=120
6-
Rewrite: Scripts Manager = type=http-response,pattern=^https://8.8.8.8/(home|sub|my|app|log|revert)($|\/),script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js,requires-body=true,max-size=0,timeout=120
5+
Rewrite: BoxJs = type=http-request,pattern=^https://8.8.8.8/api,script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js,requires-body=true,max-size=0,timeout=120
6+
Rewrite: BoxJs = type=http-response,pattern=^https://8.8.8.8/(home|sub|my|app|log|revert)($|\/),script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js,requires-body=true,max-size=0,timeout=120
7+
Rewrite: BoxJs = type=http-request,pattern=^https?://1.1.1.1/(api|home|sub|my|app|log|revert)($|\/),script-path=https://gitee.com/chavyleung/scripts/raw/master/chavy.box.js,requires-body=true,max-size=0,timeout=120
78

89
[MITM]
9-
hostname = %INSERT%, 8.8.8.8
10+
hostname = %INSERT%, 8.8.8.8, 1.1.1.1

0 commit comments

Comments
 (0)