Skip to content

Commit

Permalink
fix(boxjs): 修复 /api/update 不存在 key:val 的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
gideonsenku committed Jul 23, 2024
1 parent 6a25023 commit 7936103
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 20 deletions.
21 changes: 11 additions & 10 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.19.9'
$.version = '0.19.10'
$.versionType = 'beta'

// 发出的请求需要需要 Surge、QuanX 的 rewrite
Expand Down Expand Up @@ -714,15 +714,16 @@ async function apiUpdate() {
const path = data.path.split('.')
const val = data.val
const key = path.shift()

switch (key) {
case 'usercfgs':
const usercfgs = getUserCfgs()
update(usercfgs, path.join('.'), val)
$.setjson(usercfgs, $.KEY_usercfgs)
break
default:
break
if (data.val && path.join('.')) {
switch (key) {
case 'usercfgs':
const usercfgs = getUserCfgs()
update(usercfgs, path.join('.'), val)
$.setjson(usercfgs, $.KEY_usercfgs)
break
default:
break
}
}
$.json = getBoxData()
}
Expand Down
7 changes: 7 additions & 0 deletions box/release/box.release.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"releases": [
{
"version": "0.19.10",
"tags": ["beta"],
"author": "@GideonSenku",
"msg": "fix(boxjs): 修复 /api/update 进行局部数据更新",
"notes": ["修复不存在 key 和 val 的情况"]
},
{
"version": "0.19.9",
"tags": ["beta"],
Expand Down
7 changes: 7 additions & 0 deletions box/release/box.release.tf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"releases": [
{
"version": "0.19.10",
"tags": ["beta"],
"author": "@GideonSenku",
"msg": "fix(boxjs): 修复 /api/update 进行局部数据更新",
"notes": ["修复不存在 key 和 val 的情况"]
},
{
"version": "0.19.7",
"tags": ["beta"],
Expand Down
21 changes: 11 additions & 10 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.19.9'
$.version = '0.19.10'
$.versionType = 'beta'

// 发出的请求需要需要 Surge、QuanX 的 rewrite
Expand Down Expand Up @@ -714,15 +714,16 @@ async function apiUpdate() {
const path = data.path.split('.')
const val = data.val
const key = path.shift()

switch (key) {
case 'usercfgs':
const usercfgs = getUserCfgs()
update(usercfgs, path.join('.'), val)
$.setjson(usercfgs, $.KEY_usercfgs)
break
default:
break
if (data.val && path.join('.')) {
switch (key) {
case 'usercfgs':
const usercfgs = getUserCfgs()
update(usercfgs, path.join('.'), val)
$.setjson(usercfgs, $.KEY_usercfgs)
break
default:
break
}
}
$.json = getBoxData()
}
Expand Down

0 comments on commit 7936103

Please sign in to comment.