🐛 修复系统插件无法打开ui界面问题

This commit is contained in:
muwoo 2022-01-17 16:00:23 +08:00
parent 8107d74537
commit 240175c571
3 changed files with 13 additions and 14 deletions

View File

@ -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",

View File

@ -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));
},
};

View File

@ -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;
}