🐛 修复 allDocs 问题,新增 shellShowItemInFolder API

This commit is contained in:
muwoo 2022-02-18 11:43:30 +08:00
parent 497de040cf
commit 6adf25dbee
3 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "rubick",
"version": "2.0.1-beta.19",
"version": "2.0.2",
"author": "muwoo <2424880409@qq.com>",
"private": true,
"scripts": {

View File

@ -141,4 +141,8 @@ window.rubick = {
removePlugin() {
ipcSend("removePlugin");
},
shellShowItemInFolder: path => {
ipcSend("shellShowItemInFolder", { path });
},
};

View File

@ -6,6 +6,7 @@ import {
Notification,
nativeImage,
clipboard,
shell,
} from "electron";
import { runner, detach } from "../browsers";
import fs from "fs";
@ -155,7 +156,7 @@ export const API: any = {
return dbInstance.bulkDocs(API.DBKEY, data.docs);
},
dbAllDocs({ data }) {
return dbInstance.bulkDocs(API.DBKEY, data.key);
return dbInstance.allDocs(API.DBKEY, data.key);
},
getFeatures() {
return API.currentPlugin.features;
@ -239,13 +240,21 @@ export const API: any = {
detachInputChange({ data }) {
API.sendSubInputChangeEvent({ data });
},
getLocalId() {
return encodeURIComponent(app.getPath("home"));
},
shellShowItemInFolder({ data }) {
shell.showItemInFolder(data.path);
return true;
},
};
export default (mainWindow: BrowserWindow) => {
// 响应 preload.js 事件
ipcMain.on("msg-trigger", async (event, arg) => {
const window = arg.winId ? BrowserWindow.fromId(arg.winId) : mainWindow;
const data = await API[arg.type](arg, window, event);
event.returnValue = data;
// event.sender.send(`msg-back-${arg.type}`, data);