diff --git a/package.json b/package.json index 3429d12..d13c6a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubick", - "version": "2.0.1-beta.15", + "version": "2.0.1-beta.16", "private": true, "scripts": { "serve": "vue-cli-service serve", @@ -19,11 +19,11 @@ "ant-design-vue": "^2.2.8", "core-js": "^3.6.5", "cross-spawn": "^7.0.3", + "electron-clipboard-ex": "^1.3.3", "extract-file-icon": "^0.3.2", "fix-path": "^3.0.0", "get-mac-apps": "^1.0.2", "got": "^11.8.3", - "libnpmsearch": "^3.1.2", "lodash.throttle": "^4.1.1", "pouchdb": "^7.2.2", "vue": "^3.0.0", diff --git a/src/common/utils/getCopyFiles.ts b/src/common/utils/getCopyFiles.ts index 85b049f..1069058 100644 --- a/src/common/utils/getCopyFiles.ts +++ b/src/common/utils/getCopyFiles.ts @@ -17,8 +17,9 @@ export default function getCopyFiles(): Array | null { return null; } } else if (commonConst.windows()) { - const filePath = clipboard.readBuffer('FileNameW').toString('ucs2').replace(RegExp(String.fromCharCode(0), 'g'), ''); - fileInfo = [filePath]; + /* eslint-disable */ + const clipboardEx = require("electron-clipboard-ex"); + fileInfo = clipboardEx.readFilePaths(); // todo } else { if (!commonConst.linux()) return null; diff --git a/src/core/plugin-handler/index.ts b/src/core/plugin-handler/index.ts index c0db313..2e9c559 100644 --- a/src/core/plugin-handler/index.ts +++ b/src/core/plugin-handler/index.ts @@ -3,7 +3,6 @@ import { AdapterInfo, } from "@/core/plugin-handler/types"; import fs from "fs-extra"; -import search, { Result } from "libnpmsearch"; import path from "path"; import got from "got"; import fixPath from "fix-path"; @@ -90,30 +89,6 @@ class AdapterHandler { await this.execCommand(installCmd, adapters); } - /** - * 从 npm 搜索插件 - * 传入 streamFunc 可以流式处理 - * @param {string} adapter 插件名称 - * @param {(data: Result) => void} [streamFunc] 流式处理钩子 - * @memberof AdapterHandler - */ - async search(adapter: string, streamFunc?: (data: Result) => void) { - return await new Promise((resolve, reject) => { - const result: Result[] = []; - const stream = search.stream(adapter); - stream.on("data", (data: Result) => { - result.push(data); - if (streamFunc !== undefined) streamFunc(data); - }); - stream.on("end", () => { - resolve(result); - }); - stream.on("error", (e: any) => { - reject(e); - }); - }); - } - /** * 更新指定插件 * @param {...string[]} adapters 插件名称 diff --git a/src/main/browsers/main.ts b/src/main/browsers/main.ts index 757eb85..cb53322 100644 --- a/src/main/browsers/main.ts +++ b/src/main/browsers/main.ts @@ -34,7 +34,6 @@ export default () => { // Load the index.html when not in development win.loadURL("app://./index.html"); } - protocol.interceptFileProtocol("image", (req, callback) => { const url = req.url.substr(8); callback(decodeURI(url)); diff --git a/src/renderer/components/result.vue b/src/renderer/components/result.vue index 845c134..b033fc7 100644 --- a/src/renderer/components/result.vue +++ b/src/renderer/components/result.vue @@ -1,6 +1,6 @@