From cd73003963bd762437f60e3f1e46f2822407e296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 10 Apr 2024 15:43:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=87=BA=E5=8E=82=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/view/mixins/plugin.js | 22 ++++++++++--- packages/gui/src/view/pages/setting.vue | 41 ++++++++++++++++--------- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/packages/gui/src/view/mixins/plugin.js b/packages/gui/src/view/mixins/plugin.js index f3a65a4..ead08c9 100644 --- a/packages/gui/src/view/mixins/plugin.js +++ b/packages/gui/src/view/mixins/plugin.js @@ -31,13 +31,10 @@ export default { }, async init () { this.status = this.$status - - const config = await this.$api.config.reload() - this.setConfig(config) + await this.reloadConfig() + this.printConfig('Init, ') this.systemPlatform = await this.$api.info.getSystemPlatform() - this.printConfig() - if (this.ready) { return this.ready(this.config) } @@ -105,6 +102,21 @@ export default { } return value }, + async reloadConfig () { + const config = await this.$api.config.reload() + this.setConfig(config) + }, + async reloadConfigAndRestart () { + await this.reloadConfig() + this.printConfig('After reloadConfigAndRestart(), ') + if (this.status.server.enabled || this.status.proxy.enabled) { + await this.$api.proxy.restart() + await this.$api.server.restart() + this.$message.success('代理服务和系统代理重启成功') + } else { + this.$message.info('代理服务和系统代理未启动,无需重启') + } + }, isWindows () { return this.systemPlatform === 'windows' }, diff --git a/packages/gui/src/view/pages/setting.vue b/packages/gui/src/view/pages/setting.vue index 903842d..26fa41e 100644 --- a/packages/gui/src/view/pages/setting.vue +++ b/packages/gui/src/view/pages/setting.vue @@ -76,6 +76,7 @@