支持插件开发者模式

This commit is contained in:
muwoo
2021-12-09 11:46:06 +08:00
parent fc7e3e91bd
commit b3a00c88ad
19 changed files with 264 additions and 88 deletions

View File

@@ -48,6 +48,7 @@ const props = defineProps({
});
const changeValue = (e) => {
if (props.currentPlugin.name === "rubick-system-feature") return;
emit("onSearch", e);
};

View File

@@ -6,13 +6,11 @@ import commonConst from "@/common/utils/commonConst";
import { execSync } from "child_process";
import searchManager from "./search";
import optionsManager from "./options";
const appPath = remote.app.getPath("cache");
import { PLUGIN_INSTALL_DIR as baseDir } from "@/common/constans/renderer";
const createPluginManager = (): any => {
const baseDir = path.join(appPath, "./rubick-plugins");
const pluginInstance = new PluginHandler({
baseDir: baseDir,
baseDir,
});
const state: any = reactive({
@@ -54,7 +52,6 @@ const createPluginManager = (): any => {
const { searchValue, onSearch, setSearchValue, placeholder } = searchManager();
const { options } = optionsManager({
searchValue,
baseDir,
appList,
openPlugin,
currentPlugin: toRefs(state).currentPlugin,

View File

@@ -2,6 +2,7 @@ import { ref, toRaw, toRefs, watch } from "vue";
import throttle from "lodash.throttle";
import { remote } from "electron";
import path from "path";
import { PLUGIN_INSTALL_DIR as baseDir } from "@/common/constans/renderer";
function searchKeyValues(lists, value) {
return lists.filter((item) => {
@@ -12,7 +13,7 @@ function searchKeyValues(lists, value) {
});
}
const optionsManager = ({ searchValue, baseDir, appList, openPlugin, currentPlugin }) => {
const optionsManager = ({ searchValue, appList, openPlugin, currentPlugin }) => {
const optionsRef = ref([]);
watch(searchValue, () => search(searchValue.value));