From 8e38fda1dc3fa60bfe939091252e2af2ca2fa37b Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 16 Aug 2020 00:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs=20TF]:=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AE=E5=A4=9A=E5=BC=A0?= =?UTF-8?q?=E5=A3=81=E7=BA=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.html | 32 +++++++++++++++++++++++++++++++- box/chavy.boxjs.js | 10 ++++++---- box/release/box.release.tf.json | 17 +++++++++++++++++ 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/box/chavy.boxjs.html b/box/chavy.boxjs.html index 7ac15ce12..aa924f0ff 100644 --- a/box/chavy.boxjs.html +++ b/box/chavy.boxjs.html @@ -191,6 +191,20 @@ + + + + + + v{{ver.versio isWallpaper() { return !!this.box.usercfgs.bgimg }, + // 是否存在多张壁纸 + isMutiWallpaper() { + return this.bgimgs && this.bgimgs.length > 2 + }, + // 背景图片列表 + bgimgs() { + const items = [] + const bgimgs = this.box.usercfgs.bgimgs + if (bgimgs) { + bgimgs.split('\n').forEach((img) => { + const [name, url] = img.split(',') + items.push({ name, url }) + }) + } + return items + }, // 样式 appStyle() { if (this.path !== '/') { @@ -1598,7 +1628,7 @@

v{{ver.versio }, // 运行远程脚本 runScript(url, timeout) { - const opts = { url, timeout } + const opts = { url, timeout, isRemote: true } axios.post('/api/runScript', opts) }, // 运行文本脚本 diff --git a/box/chavy.boxjs.js b/box/chavy.boxjs.js index a75cef125..bced806a5 100644 --- a/box/chavy.boxjs.js +++ b/box/chavy.boxjs.js @@ -1,6 +1,6 @@ const $ = new Env('BoxJs') -$.version = '0.7.18' +$.version = '0.7.19' $.versionType = 'beta' /** @@ -249,12 +249,14 @@ function getSystemApps() { descs: ['可设置 http-api 地址 & 超时时间 (Surge TF)', '可设置明暗两种主题下的主色调'], keys: [ '@chavy_boxjs_userCfgs.httpapi', + '@chavy_boxjs_userCfgs.bgimg', '@chavy_boxjs_userCfgs.color_dark_primary', '@chavy_boxjs_userCfgs.color_light_primary' ], settings: [ - { id: '@chavy_boxjs_userCfgs.httpapis', name: 'HTTP-API (Surge TF)', val: '', type: 'textarea', placeholder: ',examplekey@127.0.0.1:6166', autoGrow: true, rows: 2, desc: '示例: ,examplekey@127.0.0.1:6166! 注意: 以逗号开头, 逗号分隔多个地址, 可加回车' }, + { id: '@chavy_boxjs_userCfgs.httpapis', name: 'HTTP-API (Surge TF)', val: '', type: 'textarea', placeholder: ',examplekey@127.0.0.1:6166', autoGrow: true, rows: 2, persistentHint:true, desc: '示例: ,examplekey@127.0.0.1:6166! 注意: 以逗号开头, 逗号分隔多个地址, 可加回车' }, { id: '@chavy_boxjs_userCfgs.httpapi_timeout', name: 'HTTP-API Timeout (Surge TF)', val: 20, type: 'number', persistentHint:true, desc: '如果脚本作者指定了超时时间, 会优先使用脚本指定的超时时间.' }, + { id: '@chavy_boxjs_userCfgs.bgimgs', name: '背景图片清单', val: '无背景,\n妹子,http://api.btstu.cn/sjbz/zsy.php', type: 'textarea', placeholder: '无, {回车} 妹子,图片地址', persistentHint:true, autoGrow: true, rows: 2, desc: '逗号分隔名字和链接, 回车分隔多个地址' }, { id: '@chavy_boxjs_userCfgs.bgimg', name: '背景图片', val: '', type: 'text', placeholder: 'http://api.btstu.cn/sjbz/zsy.php', persistentHint:true, desc: '输入背景图标的在线链接' }, { id: '@chavy_boxjs_userCfgs.color_light_primary', name: '明亮色调', canvas: true, val: '#F7BB0E', type: 'colorpicker', desc: '' }, { id: '@chavy_boxjs_userCfgs.color_dark_primary', name: '暗黑色调', canvas: true, val: '#2196F3', type: 'colorpicker', desc: '' } @@ -502,7 +504,7 @@ async function apiRunScript() { } } else { // 对于手动执行的脚本, 把 $done 的时机交给脚本自主控制 - $.isSkipDone = false + $.isSkipDone = true $request = undefined eval(opts.script) } @@ -570,7 +572,7 @@ function upgradeUserData() { * =================================== */ function doneBox() { - if ($.isSkipDone) { + if ($.isSkipDone === true) { return } // 记录当前使用哪个域名访问 diff --git a/box/release/box.release.tf.json b/box/release/box.release.tf.json index 40aef7e64..371efaa20 100644 --- a/box/release/box.release.tf.json +++ b/box/release/box.release.tf.json @@ -1,5 +1,22 @@ { "releases": [ + { + "version": "0.7.19", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增", + "descs": ["可以设置多张壁纸 (偏好设置)"] + }, + { + "name": "注意", + "descs": ["设置多张壁纸后,在侧栏切换"] + } + ] + }, { "version": "0.7.18", "tags": ["beta"],