Skip to content

Commit

Permalink
更新[BoxJs]: 修复订阅为 null 时数据加载报错
Browse files Browse the repository at this point in the history
  • Loading branch information
chavyleung committed Jan 10, 2021
1 parent 8922569 commit 3515a93
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
9 changes: 8 additions & 1 deletion 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.7.60'
$.version = '0.7.61'
$.versionType = 'beta'

// 发出的请求需要需要 Surge、QuanX 的 rewrite
Expand Down Expand Up @@ -343,6 +343,13 @@ function getSystemApps() {
function getUserCfgs() {
const defcfgs = { favapps: [], appsubs: [], isPinedSearchBar: true, httpapi: '[email protected]:6166' }
const usercfgs = Object.assign(defcfgs, $.getjson($.KEY_usercfgs, {}))

// 处理异常数据:删除所有为 null 的订阅
if (usercfgs.appsubs.includes(null)) {
usercfgs.appsubs = usercfgs.appsubs.filter((sub) => sub)
$.setjson(usercfgs, $.KEY_usercfgs)
}

return usercfgs
}

Expand Down
12 changes: 12 additions & 0 deletions box/release/box.release.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"releases": [
{
"version": "0.7.61",
"tags": ["beta"],
"author": "@chavyleung",
"msg": "更新[BoxJs]: 修复订阅为 null 时数据加载报错",
"notes": [
{
"name": "修复",
"descs": ["由于网络问题,导致订阅数据异常后,访问页面时仅显示 BoxJs 字样问题。"]
}
]
},
{
"version": "0.7.60",
"tags": ["beta"],
Expand Down
12 changes: 12 additions & 0 deletions box/release/box.release.tf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"releases": [
{
"version": "0.7.61",
"tags": ["beta"],
"author": "@chavyleung",
"msg": "更新[BoxJs]: 修复订阅为 null 时数据加载报错",
"notes": [
{
"name": "修复",
"descs": ["由于网络问题,导致订阅数据异常后,访问页面时仅显示 BoxJs 字样问题。"]
}
]
},
{
"version": "0.7.60",
"tags": ["beta"],
Expand Down
9 changes: 8 additions & 1 deletion 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.7.60'
$.version = '0.7.61'
$.versionType = 'beta'

// 发出的请求需要需要 Surge、QuanX 的 rewrite
Expand Down Expand Up @@ -343,6 +343,13 @@ function getSystemApps() {
function getUserCfgs() {
const defcfgs = { favapps: [], appsubs: [], isPinedSearchBar: true, httpapi: '[email protected]:6166' }
const usercfgs = Object.assign(defcfgs, $.getjson($.KEY_usercfgs, {}))

// 处理异常数据:删除所有为 null 的订阅
if (usercfgs.appsubs.includes(null)) {
usercfgs.appsubs = usercfgs.appsubs.filter((sub) => sub)
$.setjson(usercfgs, $.KEY_usercfgs)
}

return usercfgs
}

Expand Down

0 comments on commit 3515a93

Please sign in to comment.