Skip to content

Commit

Permalink
🐛 修复系统插件无法打开ui界面问题
Browse files Browse the repository at this point in the history
  • Loading branch information
muwoo committed Jan 17, 2022
1 parent 8107d74 commit 240175c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
23 changes: 11 additions & 12 deletions src/common/utils/localConfig.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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));
},
};
2 changes: 1 addition & 1 deletion src/renderer/plugins-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 240175c

Please sign in to comment.