|
1 | 1 | const $ = new Env('BoxJs') |
2 | 2 | $.domain = '8.8.8.8' |
3 | 3 |
|
4 | | -$.version = '0.4.0' |
| 4 | +$.version = '0.4.1' |
5 | 5 | $.versionType = 'beta' |
6 | 6 | $.KEY_sessions = 'chavy_boxjs_sessions' |
7 | 7 | $.KEY_versions = 'chavy_boxjs_versions' |
@@ -362,6 +362,11 @@ function getSessions() { |
362 | 362 |
|
363 | 363 | async function getVersions() { |
364 | 364 | let vers = [] |
| 365 | + // 如果启用了修复功能, 则直接返回, 不发送检查版本请求 |
| 366 | + // const usercfgs = getUserCfgs() |
| 367 | + // if (['true', true].includes(usercfgs.isFixVPN)) { |
| 368 | + // return vers |
| 369 | + // } |
365 | 370 | await new Promise((resolve) => { |
366 | 371 | setTimeout(resolve, 1000) |
367 | 372 | const verurl = 'https://raw.githubusercontent.com/chavyleung/scripts/master/box/release/box.release.json' |
@@ -424,7 +429,6 @@ async function handleApi() { |
424 | 429 | const sessiondat = data.val |
425 | 430 | const sessions = getSessions() |
426 | 431 | const session = sessions.find((s) => s.id === sessiondat.id) |
427 | | - $.log(JSON.stringify(session)) |
428 | 432 | session.name = sessiondat.name |
429 | 433 | session.datas = sessiondat.datas |
430 | 434 | const savesuc = $.setdata(JSON.stringify(sessions), $.KEY_sessions) |
@@ -736,6 +740,38 @@ function printHtml(data, curapp = null, curview = 'app') { |
736 | 740 | </v-list-item-content> |
737 | 741 | <v-list-item-action>{{ box.usercfgs.refreshsecs }} 秒</v-list-item-action> |
738 | 742 | </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> |
739 | 775 | <v-list-item> |
740 | 776 | <v-list-item-content> |
741 | 777 | <v-switch label="透明图标" v-model="box.usercfgs.isTransparentIcons" @change="onUserCfgsChange"></v-switch> |
@@ -1635,13 +1671,19 @@ function printHtml(data, curapp = null, curview = 'app') { |
1635 | 1671 | this.onReload() |
1636 | 1672 | }, |
1637 | 1673 | 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 | + } |
1638 | 1678 | this.onReload() |
1639 | 1679 | }, |
1640 | 1680 | reload() { |
1641 | 1681 | window.location.reload() |
1642 | 1682 | }, |
1643 | 1683 | 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 | + } |
1645 | 1687 | const refreshsecs = this.box.usercfgs.refreshsecs |
1646 | 1688 | const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1 |
1647 | 1689 | if (sec === 0) { |
|
0 commit comments