mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-22 18:22:53 +08:00
✨ 支持本地启动,修改mac 下获取 APP icon 的方式
This commit is contained in:
@@ -21,12 +21,35 @@ const createPluginManager = (): any => {
|
||||
localPlugins: [],
|
||||
currentPlugin: {},
|
||||
pluginLoading: false,
|
||||
pluginHistory: [],
|
||||
});
|
||||
|
||||
const appList = ref([]);
|
||||
const appList: any = ref([]);
|
||||
|
||||
const initPlugins = async () => {
|
||||
appList.value = await appSearch(nativeImage);
|
||||
initLocalStartPlugin();
|
||||
};
|
||||
|
||||
const initLocalStartPlugin = () => {
|
||||
const result = ipcRenderer.sendSync('msg-trigger', {
|
||||
type: 'dbGet',
|
||||
data: {
|
||||
id: 'rubick-local-start-app',
|
||||
},
|
||||
});
|
||||
if (result && result.value) {
|
||||
appList.value = [...appList.value, ...result.value];
|
||||
}
|
||||
};
|
||||
|
||||
window.removeLocalStartPlugin = ({ plugin }) => {
|
||||
appList.value = appList.value.filter((app) => app.desc !== plugin.desc);
|
||||
};
|
||||
|
||||
window.addLocalStartPlugin = ({ plugin }) => {
|
||||
window.removeLocalStartPlugin({ plugin });
|
||||
appList.value.push(plugin);
|
||||
};
|
||||
|
||||
const loadPlugin = async (plugin) => {
|
||||
@@ -43,7 +66,7 @@ const createPluginManager = (): any => {
|
||||
state.pluginLoading = false;
|
||||
};
|
||||
|
||||
const openPlugin = async (plugin) => {
|
||||
const openPlugin = async (plugin, option) => {
|
||||
if (plugin.pluginType === 'ui' || plugin.pluginType === 'system') {
|
||||
if (state.currentPlugin && state.currentPlugin.name === plugin.name) {
|
||||
return;
|
||||
@@ -66,6 +89,23 @@ const createPluginManager = (): any => {
|
||||
if (plugin.pluginType === 'app') {
|
||||
execSync(plugin.action);
|
||||
}
|
||||
window.initRubick();
|
||||
changePluginHistory({
|
||||
...plugin,
|
||||
...option,
|
||||
});
|
||||
};
|
||||
|
||||
const changePluginHistory = (plugin) => {
|
||||
if (state.pluginHistory.length >= 8) {
|
||||
state.pluginHistory.pop();
|
||||
}
|
||||
state.pluginHistory.forEach((p, index) => {
|
||||
if (p.name === plugin.name) {
|
||||
state.pluginHistory.splice(index, 1);
|
||||
}
|
||||
});
|
||||
state.pluginHistory.unshift(plugin);
|
||||
};
|
||||
|
||||
const { searchValue, onSearch, setSearchValue, placeholder } =
|
||||
|
||||
Reference in New Issue
Block a user