Skip to content

Commit eaa40bd

Browse files
committed
更新[BoxJs]: 尝试修复vpn断连问题 (有此问题请在侧栏中打开"修复断连")
1 parent 1a8341c commit eaa40bd

2 files changed

Lines changed: 58 additions & 3 deletions

File tree

‎box/release/box.release.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.4.1",
5+
"tags": ["beta"],
6+
"author": "@chavyleung",
7+
"icon": "https://avatars3.githubusercontent.com/u/29748519",
8+
"repo": "https://github.com/chavyleung",
9+
"notes": [
10+
{
11+
"name": "增加",
12+
"descs": ["修复VPN断连设置项 (实验)"]
13+
}
14+
]
15+
},
316
{
417
"version": "0.4.0",
518
"tags": ["beta"],

‎chavy.box.js‎

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const $ = new Env('BoxJs')
22
$.domain = '8.8.8.8'
33

4-
$.version = '0.4.0'
4+
$.version = '0.4.1'
55
$.versionType = 'beta'
66
$.KEY_sessions = 'chavy_boxjs_sessions'
77
$.KEY_versions = 'chavy_boxjs_versions'
@@ -362,6 +362,11 @@ function getSessions() {
362362

363363
async function getVersions() {
364364
let vers = []
365+
// 如果启用了修复功能, 则直接返回, 不发送检查版本请求
366+
// const usercfgs = getUserCfgs()
367+
// if (['true', true].includes(usercfgs.isFixVPN)) {
368+
// return vers
369+
// }
365370
await new Promise((resolve) => {
366371
setTimeout(resolve, 1000)
367372
const verurl = 'https://raw.githubusercontent.com/chavyleung/scripts/master/box/release/box.release.json'
@@ -424,7 +429,6 @@ async function handleApi() {
424429
const sessiondat = data.val
425430
const sessions = getSessions()
426431
const session = sessions.find((s) => s.id === sessiondat.id)
427-
$.log(JSON.stringify(session))
428432
session.name = sessiondat.name
429433
session.datas = sessiondat.datas
430434
const savesuc = $.setdata(JSON.stringify(sessions), $.KEY_sessions)
@@ -736,6 +740,38 @@ function printHtml(data, curapp = null, curview = 'app') {
736740
</v-list-item-content>
737741
<v-list-item-action>{{ box.usercfgs.refreshsecs }} 秒</v-list-item-action>
738742
</v-list-item>
743+
<v-list-item>
744+
<v-list-item-content>
745+
<v-switch label="修复断连" v-model="box.usercfgs.isFixVPN" @change="onUserCfgsChange"></v-switch>
746+
</v-list-item-content>
747+
<v-list-item-action>
748+
<v-dialog v-model="ui.fixvpnDialog" persistent max-width="290">
749+
<template v-slot:activator="{ on, attrs }">
750+
<v-btn fab small text v-on="on" v-bind="attrs">
751+
<v-icon>mdi-information-variant</v-icon>
752+
</v-btn>
753+
</template>
754+
<v-card>
755+
<v-card-title class="headline">修复 VPN 断连 (实验)</v-card-title>
756+
<v-card-text>
757+
打开会导致:
758+
<ul>
759+
<!-- <li>无法自动检查 BoxJs 版本</li> -->
760+
<li>无法自动刷新应用订阅</li>
761+
</ul>
762+
<p class="mt-4">
763+
注意: 仍可手动刷新订阅 <br />
764+
路径: 底栏 > 订阅 > 刷新 (右上)
765+
</p>
766+
</v-card-text>
767+
<v-card-actions>
768+
<v-spacer></v-spacer>
769+
<v-btn color="green darken-1" text @click="ui.fixvpnDialog = false">朕, 知道了!</v-btn>
770+
</v-card-actions>
771+
</v-card>
772+
</v-dialog>
773+
</v-list-item-action>
774+
</v-list-item>
739775
<v-list-item>
740776
<v-list-item-content>
741777
<v-switch label="透明图标" v-model="box.usercfgs.isTransparentIcons" @change="onUserCfgsChange"></v-switch>
@@ -1635,13 +1671,19 @@ function printHtml(data, curapp = null, curview = 'app') {
16351671
this.onReload()
16361672
},
16371673
onRefreshAppSubs(){
1674+
if (['true', true].includes(this.box.usercfgs.isFixVPN)) {
1675+
axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null }))
1676+
this.box.usercfgs.refreshsecs = 3
1677+
}
16381678
this.onReload()
16391679
},
16401680
reload() {
16411681
window.location.reload()
16421682
},
16431683
onReload() {
1644-
axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null }))
1684+
if (!['true', true].includes(this.box.usercfgs.isFixVPN)) {
1685+
axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null }))
1686+
}
16451687
const refreshsecs = this.box.usercfgs.refreshsecs
16461688
const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1
16471689
if (sec === 0) {

0 commit comments

Comments
 (0)