11const $ = new Env ( 'BoxJs' )
22$ . domain = '8.8.8.8'
33
4- $ . version = '0.4.1 '
4+ $ . version = '0.4.2 '
55$ . versionType = 'beta'
66$ . KEY_sessions = 'chavy_boxjs_sessions'
77$ . KEY_versions = 'chavy_boxjs_versions'
@@ -740,38 +740,6 @@ function printHtml(data, curapp = null, curview = 'app') {
740740 </v-list-item-content>
741741 <v-list-item-action>{{ box.usercfgs.refreshsecs }} 秒</v-list-item-action>
742742 </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>
775743 <v-list-item>
776744 <v-list-item-content>
777745 <v-switch label="透明图标" v-model="box.usercfgs.isTransparentIcons" @change="onUserCfgsChange"></v-switch>
@@ -1222,9 +1190,6 @@ function printHtml(data, curapp = null, curview = 'app') {
12221190 </v-card-actions>
12231191 </v-card>
12241192 </v-dialog>
1225- <v-overlay v-model="ui.overlay.show">
1226- <v-progress-circular indeterminate size="64"></v-progress-circular>
1227- </v-overlay>
12281193 </v-main>
12291194 <v-expand-transition>
12301195 <v-bottom-navigation v-model="ui.curview" app v-show="ui.navi.show && !box.usercfgs.isHideNavi">
@@ -1357,6 +1322,9 @@ function printHtml(data, curapp = null, curview = 'app') {
13571322 </v-card>
13581323 </v-sheet>
13591324 </v-bottom-sheet>
1325+ <v-overlay v-model="ui.overlay.show" :opacity="0.7">
1326+ <v-progress-circular indeterminate size="64"></v-progress-circular>
1327+ </v-overlay>
13601328 </v-app>
13611329 </div>
13621330 <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
@@ -1586,20 +1554,26 @@ function printHtml(data, curapp = null, curview = 'app') {
15861554 },
15871555 onClearCurAppSessionData(app, datas, data) {
15881556 data.val = ''
1589- axios.post('/api', JSON.stringify({ cmd: 'saveCurAppSession', val: app }))
1590- this.onReload()
1557+ this.ui.overlay.show = true
1558+ axios.post('/api', JSON.stringify({ cmd: 'saveCurAppSession', val: app })).finally(() => {
1559+ this.onReload()
1560+ })
15911561 },
15921562 onSaveSessionTo(session) {
15931563 const val = {
15941564 fromapp: this.ui.curapp,
15951565 toSession: session
15961566 }
1597- axios.post('/api', JSON.stringify({ cmd: 'saveSessionTo', val }))
1598- this.onReload()
1567+ this.ui.overlay.show = true
1568+ axios.post('/api', JSON.stringify({ cmd: 'saveSessionTo', val })).finally(() => {
1569+ this.onReload()
1570+ })
15991571 },
16001572 onModSession () {
1601- axios.post('/api', JSON.stringify({ cmd: 'onModSession', val: this.ui.modSessionDialog.session }))
1602- this.onReload()
1573+ this.ui.overlay.show = true
1574+ axios.post('/api', JSON.stringify({ cmd: 'onModSession', val: this.ui.modSessionDialog.session })).finally(() => {
1575+ this.onReload()
1576+ })
16031577 },
16041578 onSaveSession() {
16051579 const session = {
@@ -1616,8 +1590,10 @@ function printHtml(data, curapp = null, curview = 'app') {
16161590 axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session }))
16171591 },
16181592 onSaveSettings() {
1619- axios.post('/api', JSON.stringify({ cmd: 'saveSettings', val: this.ui.curapp.settings }))
1620- this.onReload()
1593+ this.ui.overlay.show = true
1594+ axios.post('/api', JSON.stringify({ cmd: 'saveSettings', val: this.ui.curapp.settings })).finally(() => {
1595+ this.onReload()
1596+ })
16211597 },
16221598 onImpSessionPaste() {
16231599 navigator.clipboard.readText().then((text) => {
@@ -1654,8 +1630,10 @@ function printHtml(data, curapp = null, curview = 'app') {
16541630 }
16551631 this.box.sessions.push(session)
16561632 this.ui.curappSessions.push(session)
1657- axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session }))
1658- this.ui.impSessionDialog.show = false
1633+ this.ui.overlay.show = true
1634+ axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session })).finally(() => {
1635+ this.ui.impSessionDialog.show = false
1636+ })
16591637 } else {
16601638 alert('导入失败! 原因: appId 为空?')
16611639 }
@@ -1666,44 +1644,48 @@ function printHtml(data, curapp = null, curview = 'app') {
16661644 url: this.ui.addAppSubDialog.url,
16671645 enable: true
16681646 }
1669- axios.post('/api', JSON.stringify({ cmd: 'addAppSub', val: sub }))
1670- this.ui.addAppSubDialog.show = false
1671- this.onReload()
1647+ this.ui.overlay.show = true
1648+ axios.post('/api', JSON.stringify({ cmd: 'addAppSub', val: sub })).finally(() => {
1649+ this.ui.addAppSubDialog.show = false
1650+ this.onReload()
1651+ })
16721652 },
16731653 onRefreshAppSubs(){
1674- if (['true', true].includes( this.box.usercfgs.isFixVPN)) {
1675- axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null }))
1654+ this.ui.overlay.show = true
1655+ axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null })).finally(() => {
16761656 this.box.usercfgs.refreshsecs = 3
1677- }
1657+ })
16781658 this.onReload()
16791659 },
16801660 reload() {
16811661 window.location.reload()
16821662 },
16831663 onReload() {
1684- if (!['true', true].includes(this.box.usercfgs.isFixVPN)) {
1685- axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null }))
1686- }
16871664 const refreshsecs = this.box.usercfgs.refreshsecs
16881665 const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1
16891666 if (sec === 0) {
16901667 this.reload()
16911668 } else {
1669+ this.ui.overlay.show = false
16921670 this.ui.reloadConfirmDialog.show = true
16931671 this.ui.reloadConfirmDialog.sec = sec
16941672 }
16951673 },
16961674 onDelSession(session) {
1697- axios.post('/api', JSON.stringify({ cmd: 'delSession', val: session }))
1698- const sessionIdx = this.box.sessions.findIndex((s) => session.id === s.id)
1699- if (this.box.sessions.splice(sessionIdx, 1) !== -1) {
1700- this.ui.curappSessions = this.box.sessions.filter((s) => s.appId === this.ui.curapp.id)
1701- }
1675+ this.ui.overlay.show = true
1676+ axios.post('/api', JSON.stringify({ cmd: 'delSession', val: session })).finally(() => {
1677+ const sessionIdx = this.box.sessions.findIndex((s) => session.id === s.id)
1678+ if (this.box.sessions.splice(sessionIdx, 1) !== -1) {
1679+ this.ui.curappSessions = this.box.sessions.filter((s) => s.appId === this.ui.curapp.id)
1680+ }
1681+ })
17021682 },
17031683 onUseSession(session) {
1704- axios.post('/api', JSON.stringify({ cmd: 'useSession', val: session }))
1705- this.ui.curapp.datas = JSON.parse(JSON.stringify(session.datas))
1706- this.onReload()
1684+ this.ui.overlay.show = true
1685+ axios.post('/api', JSON.stringify({ cmd: 'useSession', val: session })).finally(() => {
1686+ this.ui.curapp.datas = JSON.parse(JSON.stringify(session.datas))
1687+ this.onReload()
1688+ })
17071689 },
17081690 onImpGlobalBak() {
17091691 const env = this.box.syscfgs.env
@@ -1721,8 +1703,10 @@ function printHtml(data, curapp = null, curview = 'app') {
17211703 bakobj.tags = [env, version, versionType]
17221704 this.box.globalbaks.push(bakobj)
17231705 this.ui.impGlobalBakDialog.show = false
1724- axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj }))
1725- this.onReload()
1706+ this.ui.overlay.show = true
1707+ axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj })).finally(() => {
1708+ this.onReload()
1709+ })
17261710 },
17271711 onGlobalBak() {
17281712 const env = this.box.syscfgs.env
@@ -1748,8 +1732,10 @@ function printHtml(data, curapp = null, curview = 'app') {
17481732 axios.post('/api', JSON.stringify({ cmd: 'delGlobalBak', val: id }))
17491733 },
17501734 onRevertGlobalBak(id) {
1751- axios.post('/api', JSON.stringify({ cmd: 'revertGlobalBak', val: id }))
1752- this.onReload()
1735+ this.ui.overlay.show = true
1736+ axios.post('/api', JSON.stringify({ cmd: 'revertGlobalBak', val: id })).finally(() => {
1737+ this.onReload()
1738+ })
17531739 },
17541740 onCopy(e) {
17551741 this.ui.snackbar.show = true
0 commit comments