Skip to content

Commit

Permalink
fix(boxjs): boxjs 自身的请求仍发出警告问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chavyleung committed Mar 4, 2024
1 parent 360cb89 commit 6ca6128
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
5 changes: 3 additions & 2 deletions box/chavy.boxjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const $ = new Env('BoxJs')
// 为 eval 准备的上下文环境
const $eval_env = {}

$.version = '0.14.0'
$.version = '0.14.1'
$.versionType = 'beta'

// 发出的请求需要需要 Surge、QuanX 的 rewrite
Expand Down Expand Up @@ -219,7 +219,8 @@ async function handlePage() {
* 处理`查询`请求
*/
async function handleQuery() {
if (!/^https?:\/\/(.+\.)?boxjs\.(com|net)\//.test($request.headers.referer)) {
const referer = $request.headers.referer || $request.headers.Referer
if (!/^https?:\/\/(.+\.)?boxjs\.(com|net)\//.test(referer)) {
const isMuteQueryAlert = [true, 'true'].includes(
$.getdata('@chavy_boxjs_userCfgs.isMuteQueryAlert')
)
Expand Down
19 changes: 19 additions & 0 deletions box/release/box.release.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
{
"releases": [
{
"version": "0.14.1",
"tags": ["beta"],
"author": "@chavyleung",
"msg": "fix(boxjs): boxjs 自身的请求仍发出警告问题",
"notes": [
{
"name": "数据查询警告",
"descs": [
"为保护用户数据,当发现不是 boxjs 自身发起的数据查询时,会发出警告 (默认开启)",
"可以在 boxjs 页面侧栏中关闭警告 (但仍会记录日志)"
]
},
{
"name": "感谢",
"descs": ["@xream 反馈"]
}
]
},
{
"version": "0.14.0",
"tags": ["beta"],
Expand Down
19 changes: 19 additions & 0 deletions box/release/box.release.tf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
{
"releases": [
{
"version": "0.14.1",
"tags": ["beta"],
"author": "@chavyleung",
"msg": "fix(boxjs): boxjs 自身的请求仍发出警告问题",
"notes": [
{
"name": "数据查询警告",
"descs": [
"为保护用户数据,当发现不是 boxjs 自身发起的数据查询时,会发出警告 (默认开启)",
"可以在 boxjs 页面侧栏中关闭警告 (但仍会记录日志)"
]
},
{
"name": "感谢",
"descs": ["@xream 反馈"]
}
]
},
{
"version": "0.14.0",
"tags": ["beta"],
Expand Down
5 changes: 3 additions & 2 deletions chavy.box.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const $ = new Env('BoxJs')
// 为 eval 准备的上下文环境
const $eval_env = {}

$.version = '0.14.0'
$.version = '0.14.1'
$.versionType = 'beta'

// 发出的请求需要需要 Surge、QuanX 的 rewrite
Expand Down Expand Up @@ -219,7 +219,8 @@ async function handlePage() {
* 处理`查询`请求
*/
async function handleQuery() {
if (!/^https?:\/\/(.+\.)?boxjs\.(com|net)\//.test($request.headers.referer)) {
const referer = $request.headers.referer || $request.headers.Referer
if (!/^https?:\/\/(.+\.)?boxjs\.(com|net)\//.test(referer)) {
const isMuteQueryAlert = [true, 'true'].includes(
$.getdata('@chavy_boxjs_userCfgs.isMuteQueryAlert')
)
Expand Down

0 comments on commit 6ca6128

Please sign in to comment.