From 240175c5718c1a87b9e9833a52988d5a6f3fbfc7 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Mon, 17 Jan 2022 16:00:23 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80ui?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/common/utils/localConfig.ts | 23 +++++++++++------------ src/renderer/plugins-manager/index.ts | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index d13c6a5..6550c82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubick", - "version": "2.0.1-beta.16", + "version": "2.0.1-beta.17", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/common/utils/localConfig.ts b/src/common/utils/localConfig.ts index 5719169..2617266 100644 --- a/src/common/utils/localConfig.ts +++ b/src/common/utils/localConfig.ts @@ -1,7 +1,6 @@ import path from "path"; import fs from "fs"; import getLocalDataFile from "./getLocalDataFile"; -import commonConst from "./commonConst"; import defaultConfigForAnyPlatform from "../constans/defaultConfig"; const configPath = path.join(getLocalDataFile(), "./rubick-config.json"); @@ -10,34 +9,34 @@ global.OP_CONFIG = { config: null, get() { try { - if (!global.config) { - global.config = JSON.parse( + if (!global.OP_CONFIG.config) { + global.OP_CONFIG.config = JSON.parse( fs.readFileSync(configPath, "utf8") || JSON.stringify(defaultConfigForAnyPlatform) ); } // 重置 if ( - !global.config.version || - global.config.version < defaultConfigForAnyPlatform.version + !global.OP_CONFIG.config.version || + global.OP_CONFIG.config.version < defaultConfigForAnyPlatform.version ) { - global.config = defaultConfigForAnyPlatform; + global.OP_CONFIG.config = defaultConfigForAnyPlatform; fs.writeFileSync( configPath, JSON.stringify(defaultConfigForAnyPlatform) ); } - return global.config; + return global.OP_CONFIG.config; } catch (e) { - global.config = defaultConfigForAnyPlatform; - return global.config; + global.OP_CONFIG.config = defaultConfigForAnyPlatform; + return global.OP_CONFIG.config; } }, set(value) { - global.config = { - ...global.config, + global.OP_CONFIG.config = { + ...global.OP_CONFIG.config, ...value, }; - fs.writeFileSync(configPath, JSON.stringify(global.config)); + fs.writeFileSync(configPath, JSON.stringify(global.OP_CONFIG.config)); }, }; diff --git a/src/renderer/plugins-manager/index.ts b/src/renderer/plugins-manager/index.ts index 363b5af..4cec3f1 100644 --- a/src/renderer/plugins-manager/index.ts +++ b/src/renderer/plugins-manager/index.ts @@ -28,7 +28,7 @@ const createPluginManager = (): any => { }; const openPlugin = (plugin) => { - if (plugin.pluginType === "ui") { + if (plugin.pluginType === "ui" || plugin.pluginType === "system") { if (state.currentPlugin && state.currentPlugin.name === plugin.name) { return; }