mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-08 03:24:12 +08:00
✨ 支持 mac M1 arm 64:#207,#134; 支持右击菜单
This commit is contained in:
parent
79e39018fd
commit
32c6cf5d1c
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rubick",
|
"name": "rubick",
|
||||||
"version": "3.2.1",
|
"version": "3.2.2",
|
||||||
"author": "muwoo <2424880409@qq.com>",
|
"author": "muwoo <2424880409@qq.com>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
13
public/installer.nsh
Normal file
13
public/installer.nsh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
!macro customInstall
|
||||||
|
SetRegView 64
|
||||||
|
WriteRegStr HKCR "*\shell\rubick" "" "open w&ith rubick search"
|
||||||
|
WriteRegStr HKCR "*\shell\rubick" "Icon" "$INSTDIR\rubick.exe"
|
||||||
|
WriteRegStr HKCR "*\shell\rubick\command" "" '"$INSTDIR\rubick.exe" "search" "%1"'
|
||||||
|
SetRegView 32
|
||||||
|
WriteRegStr HKCR "*\shell\rubick" "" "open w&ith rubick search"
|
||||||
|
WriteRegStr HKCR "*\shell\rubick" "Icon" "$INSTDIR\rubick.exe"
|
||||||
|
WriteRegStr HKCR "*\shell\rubick\command" "" '"$INSTDIR\rubick.exe" "search" "%1"'
|
||||||
|
!macroend
|
||||||
|
!macro customUninstall
|
||||||
|
DeleteRegKey HKCR "*\shell\rubick"
|
||||||
|
!macroend
|
31
public/rubick.workflow/Contents/Info.plist
Normal file
31
public/rubick.workflow/Contents/Info.plist
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSServices</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>NSBackgroundColorName</key>
|
||||||
|
<string>background</string>
|
||||||
|
<key>NSIconName</key>
|
||||||
|
<string>NSTouchBarSend</string>
|
||||||
|
<key>NSMenuItem</key>
|
||||||
|
<dict>
|
||||||
|
<key>default</key>
|
||||||
|
<string>rubick 打开</string>
|
||||||
|
</dict>
|
||||||
|
<key>NSMessage</key>
|
||||||
|
<string>runWorkflowAsService</string>
|
||||||
|
<key>NSRequiredContext</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSApplicationIdentifier</key>
|
||||||
|
<string>com.apple.finder</string>
|
||||||
|
</dict>
|
||||||
|
<key>NSSendFileTypes</key>
|
||||||
|
<array>
|
||||||
|
<string>public.item</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
BIN
public/rubick.workflow/Contents/QuickLook/Thumbnail.png
Normal file
BIN
public/rubick.workflow/Contents/QuickLook/Thumbnail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
228
public/rubick.workflow/Contents/document.wflow
Normal file
228
public/rubick.workflow/Contents/document.wflow
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>AMApplicationBuild</key>
|
||||||
|
<string>512</string>
|
||||||
|
<key>AMApplicationVersion</key>
|
||||||
|
<string>2.10</string>
|
||||||
|
<key>AMDocumentVersion</key>
|
||||||
|
<string>2</string>
|
||||||
|
<key>actions</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>action</key>
|
||||||
|
<dict>
|
||||||
|
<key>AMAccepts</key>
|
||||||
|
<dict>
|
||||||
|
<key>Container</key>
|
||||||
|
<string>List</string>
|
||||||
|
<key>Optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>Types</key>
|
||||||
|
<array>
|
||||||
|
<string>com.apple.cocoa.string</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<key>AMActionVersion</key>
|
||||||
|
<string>2.0.3</string>
|
||||||
|
<key>AMApplication</key>
|
||||||
|
<array>
|
||||||
|
<string>自动操作</string>
|
||||||
|
</array>
|
||||||
|
<key>AMParameterProperties</key>
|
||||||
|
<dict>
|
||||||
|
<key>COMMAND_STRING</key>
|
||||||
|
<dict/>
|
||||||
|
<key>CheckedForUserDefaultShell</key>
|
||||||
|
<dict/>
|
||||||
|
<key>inputMethod</key>
|
||||||
|
<dict/>
|
||||||
|
<key>shell</key>
|
||||||
|
<dict/>
|
||||||
|
<key>source</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
|
<key>AMProvides</key>
|
||||||
|
<dict>
|
||||||
|
<key>Container</key>
|
||||||
|
<string>List</string>
|
||||||
|
<key>Types</key>
|
||||||
|
<array>
|
||||||
|
<string>com.apple.cocoa.string</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<key>ActionBundlePath</key>
|
||||||
|
<string>/System/Library/Automator/Run Shell Script.action</string>
|
||||||
|
<key>ActionName</key>
|
||||||
|
<string>运行Shell脚本</string>
|
||||||
|
<key>ActionParameters</key>
|
||||||
|
<dict>
|
||||||
|
<key>COMMAND_STRING</key>
|
||||||
|
<string>/Applications/rubick.app/Contents/MacOS/rubick search "$@" > /dev/null 2>&1 &</string>
|
||||||
|
<key>CheckedForUserDefaultShell</key>
|
||||||
|
<true/>
|
||||||
|
<key>inputMethod</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>shell</key>
|
||||||
|
<string>/bin/bash</string>
|
||||||
|
<key>source</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
<key>BundleIdentifier</key>
|
||||||
|
<string>com.apple.RunShellScript</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>2.0.3</string>
|
||||||
|
<key>CanShowSelectedItemsWhenRun</key>
|
||||||
|
<false/>
|
||||||
|
<key>CanShowWhenRun</key>
|
||||||
|
<true/>
|
||||||
|
<key>Category</key>
|
||||||
|
<array>
|
||||||
|
<string>AMCategoryUtilities</string>
|
||||||
|
</array>
|
||||||
|
<key>Class Name</key>
|
||||||
|
<string>RunShellScriptAction</string>
|
||||||
|
<key>InputUUID</key>
|
||||||
|
<string>7E11290E-3E3F-4D65-988B-3E2A8B597EEF</string>
|
||||||
|
<key>Keywords</key>
|
||||||
|
<array>
|
||||||
|
<string>Shell</string>
|
||||||
|
<string>脚本</string>
|
||||||
|
<string>命令</string>
|
||||||
|
<string>运行</string>
|
||||||
|
<string>Unix</string>
|
||||||
|
</array>
|
||||||
|
<key>OutputUUID</key>
|
||||||
|
<string>475C56B3-F23A-4D39-BB41-4B00F76B096B</string>
|
||||||
|
<key>UUID</key>
|
||||||
|
<string>BBBABDAB-D65B-41BF-B1EB-03ACA5AF4714</string>
|
||||||
|
<key>UnlocalizedApplications</key>
|
||||||
|
<array>
|
||||||
|
<string>Automator</string>
|
||||||
|
</array>
|
||||||
|
<key>arguments</key>
|
||||||
|
<dict>
|
||||||
|
<key>0</key>
|
||||||
|
<dict>
|
||||||
|
<key>default value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>name</key>
|
||||||
|
<string>inputMethod</string>
|
||||||
|
<key>required</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>type</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>0</string>
|
||||||
|
</dict>
|
||||||
|
<key>1</key>
|
||||||
|
<dict>
|
||||||
|
<key>default value</key>
|
||||||
|
<false/>
|
||||||
|
<key>name</key>
|
||||||
|
<string>CheckedForUserDefaultShell</string>
|
||||||
|
<key>required</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>type</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>1</string>
|
||||||
|
</dict>
|
||||||
|
<key>2</key>
|
||||||
|
<dict>
|
||||||
|
<key>default value</key>
|
||||||
|
<string></string>
|
||||||
|
<key>name</key>
|
||||||
|
<string>source</string>
|
||||||
|
<key>required</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>type</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>2</string>
|
||||||
|
</dict>
|
||||||
|
<key>3</key>
|
||||||
|
<dict>
|
||||||
|
<key>default value</key>
|
||||||
|
<string></string>
|
||||||
|
<key>name</key>
|
||||||
|
<string>COMMAND_STRING</string>
|
||||||
|
<key>required</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>type</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>3</string>
|
||||||
|
</dict>
|
||||||
|
<key>4</key>
|
||||||
|
<dict>
|
||||||
|
<key>default value</key>
|
||||||
|
<string>/bin/sh</string>
|
||||||
|
<key>name</key>
|
||||||
|
<string>shell</string>
|
||||||
|
<key>required</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>type</key>
|
||||||
|
<string>0</string>
|
||||||
|
<key>uuid</key>
|
||||||
|
<string>4</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>conversionLabel</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>isViewVisible</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>location</key>
|
||||||
|
<string>309.000000:305.000000</string>
|
||||||
|
<key>nibPath</key>
|
||||||
|
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib</string>
|
||||||
|
</dict>
|
||||||
|
<key>isViewVisible</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>connectors</key>
|
||||||
|
<dict/>
|
||||||
|
<key>workflowMetaData</key>
|
||||||
|
<dict>
|
||||||
|
<key>applicationBundleID</key>
|
||||||
|
<string>com.apple.finder</string>
|
||||||
|
<key>applicationBundleIDsByPath</key>
|
||||||
|
<dict>
|
||||||
|
<key>/System/Library/CoreServices/Finder.app</key>
|
||||||
|
<string>com.apple.finder</string>
|
||||||
|
</dict>
|
||||||
|
<key>applicationPath</key>
|
||||||
|
<string>/System/Library/CoreServices/Finder.app</string>
|
||||||
|
<key>applicationPaths</key>
|
||||||
|
<array>
|
||||||
|
<string>/System/Library/CoreServices/Finder.app</string>
|
||||||
|
</array>
|
||||||
|
<key>inputTypeIdentifier</key>
|
||||||
|
<string>com.apple.Automator.fileSystemObject</string>
|
||||||
|
<key>outputTypeIdentifier</key>
|
||||||
|
<string>com.apple.Automator.nothing</string>
|
||||||
|
<key>presentationMode</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
<key>processesInput</key>
|
||||||
|
<false/>
|
||||||
|
<key>serviceApplicationBundleID</key>
|
||||||
|
<string>com.apple.finder</string>
|
||||||
|
<key>serviceApplicationPath</key>
|
||||||
|
<string>/System/Library/CoreServices/Finder.app</string>
|
||||||
|
<key>serviceInputTypeIdentifier</key>
|
||||||
|
<string>com.apple.Automator.fileSystemObject</string>
|
||||||
|
<key>serviceOutputTypeIdentifier</key>
|
||||||
|
<string>com.apple.Automator.nothing</string>
|
||||||
|
<key>serviceProcessesInput</key>
|
||||||
|
<false/>
|
||||||
|
<key>systemImageName</key>
|
||||||
|
<string>NSTouchBarSend</string>
|
||||||
|
<key>useAutomaticInputType</key>
|
||||||
|
<false/>
|
||||||
|
<key>workflowTypeIdentifier</key>
|
||||||
|
<string>com.apple.Automator.servicesMenu</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
84
src/main/common/getSearchFiles.ts
Normal file
84
src/main/common/getSearchFiles.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs-extra';
|
||||||
|
import os from 'os';
|
||||||
|
|
||||||
|
const getSearchFiles = (argv = process.argv, cwd = process.cwd()) => {
|
||||||
|
const files = argv.slice(2); // 过滤['rubick.exe', 'search']这两个参数,直接获取需要上传的图片路径
|
||||||
|
let result: any = [];
|
||||||
|
if (files.length > 0) {
|
||||||
|
// 如果图片列表不为空
|
||||||
|
result = files
|
||||||
|
.map((item) => {
|
||||||
|
if (path.isAbsolute(item)) {
|
||||||
|
// 如果是绝对路径
|
||||||
|
return {
|
||||||
|
path: item,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const tempPath = path.join(cwd, item); // 如果是相对路径,就拼接
|
||||||
|
if (fs.existsSync(tempPath)) {
|
||||||
|
// 判断文件是否存在
|
||||||
|
return {
|
||||||
|
path: tempPath,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter((item) => item !== null); // 排除为null的路径
|
||||||
|
}
|
||||||
|
return result; // 返回结果
|
||||||
|
};
|
||||||
|
|
||||||
|
const putFileToRubick = (webContents, files) => {
|
||||||
|
webContents.executeJavaScript(`window.searchFocus(${JSON.stringify(files)})`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyFileOutsideOfElectronAsar = function (
|
||||||
|
sourceInAsarArchive,
|
||||||
|
destOutsideAsarArchive
|
||||||
|
) {
|
||||||
|
if (fs.existsSync(sourceInAsarArchive)) {
|
||||||
|
// file will be copied
|
||||||
|
if (fs.statSync(sourceInAsarArchive).isFile()) {
|
||||||
|
const file = destOutsideAsarArchive;
|
||||||
|
const dir = path.dirname(file);
|
||||||
|
if (!fs.existsSync(dir)) {
|
||||||
|
fs.mkdirSync(dir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(file, fs.readFileSync(sourceInAsarArchive));
|
||||||
|
}
|
||||||
|
|
||||||
|
// dir is browsed
|
||||||
|
else if (fs.statSync(sourceInAsarArchive).isDirectory()) {
|
||||||
|
fs.readdirSync(sourceInAsarArchive).forEach(function (fileOrFolderName) {
|
||||||
|
copyFileOutsideOfElectronAsar(
|
||||||
|
sourceInAsarArchive + '/' + fileOrFolderName,
|
||||||
|
destOutsideAsarArchive + '/' + fileOrFolderName
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const macBeforeOpen = () => {
|
||||||
|
const dest = `${os.homedir}/Library/Services/rubick.workflow`;
|
||||||
|
if (fs.existsSync(dest)) {
|
||||||
|
// 判断是否存在
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// 如果不存在就复制过去
|
||||||
|
try {
|
||||||
|
copyFileOutsideOfElectronAsar(
|
||||||
|
path.join(__static, 'rubick.workflow'),
|
||||||
|
dest
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { getSearchFiles, putFileToRubick, macBeforeOpen };
|
@ -13,6 +13,11 @@ import API from './common/api';
|
|||||||
import createTray from './common/tray';
|
import createTray from './common/tray';
|
||||||
import registerHotKey from './common/registerHotKey';
|
import registerHotKey from './common/registerHotKey';
|
||||||
import localConfig from './common/initLocalConfig';
|
import localConfig from './common/initLocalConfig';
|
||||||
|
import {
|
||||||
|
getSearchFiles,
|
||||||
|
putFileToRubick,
|
||||||
|
macBeforeOpen,
|
||||||
|
} from './common/getSearchFiles';
|
||||||
|
|
||||||
import '../common/utils/localPlugin';
|
import '../common/utils/localPlugin';
|
||||||
|
|
||||||
@ -41,6 +46,7 @@ class App {
|
|||||||
beforeReady() {
|
beforeReady() {
|
||||||
// 系统托盘
|
// 系统托盘
|
||||||
if (commonConst.macOS()) {
|
if (commonConst.macOS()) {
|
||||||
|
macBeforeOpen();
|
||||||
if (commonConst.production() && !app.isInApplicationsFolder()) {
|
if (commonConst.production() && !app.isInApplicationsFolder()) {
|
||||||
app.moveToApplicationsFolder();
|
app.moveToApplicationsFolder();
|
||||||
} else {
|
} else {
|
||||||
@ -83,14 +89,20 @@ class App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onRunning() {
|
onRunning() {
|
||||||
app.on('second-instance', () => {
|
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
||||||
// 当运行第二个实例时,将会聚焦到myWindow这个窗口
|
const files = getSearchFiles(commandLine, workingDirectory);
|
||||||
const win = this.windowCreator.getWindow();
|
const win = this.windowCreator.getWindow();
|
||||||
|
// 当运行第二个实例时,将会聚焦到myWindow这个窗口
|
||||||
|
// 如果有文件列表作为参数,说明是命令行启动
|
||||||
if (win) {
|
if (win) {
|
||||||
if (win.isMinimized()) {
|
if (win.isMinimized()) {
|
||||||
win.restore();
|
win.restore();
|
||||||
}
|
}
|
||||||
win.focus();
|
win.focus();
|
||||||
|
if (files.length > 0) {
|
||||||
|
win.show();
|
||||||
|
putFileToRubick(win.webContents, files);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
app.on('activate', () => {
|
app.on('activate', () => {
|
||||||
|
@ -59,7 +59,7 @@ import { LoadingOutlined, MoreOutlined } from '@ant-design/icons-vue';
|
|||||||
|
|
||||||
const remote = window.require('@electron/remote');
|
const remote = window.require('@electron/remote');
|
||||||
import localConfig from '../confOp';
|
import localConfig from '../confOp';
|
||||||
const { Menu } = remote;
|
const { Menu, app } = remote;
|
||||||
|
|
||||||
const config: any = ref(localConfig.getConfig());
|
const config: any = ref(localConfig.getConfig());
|
||||||
|
|
||||||
@ -232,9 +232,14 @@ const changeHideOnBlur = () => {
|
|||||||
|
|
||||||
const getIcon = () => {
|
const getIcon = () => {
|
||||||
if (props.clipboardFile[0].dataUrl) return props.clipboardFile[0].dataUrl;
|
if (props.clipboardFile[0].dataUrl) return props.clipboardFile[0].dataUrl;
|
||||||
return props.clipboardFile[0].isFile
|
try {
|
||||||
? require('../assets/file.png')
|
return ipcRenderer.sendSync('msg-trigger', {
|
||||||
: require('../assets/folder.png');
|
type: 'getFileIcon',
|
||||||
|
data: { path: props.clipboardFile[0].path },
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return require('../assets/file.png');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const newWindow = () => {
|
const newWindow = () => {
|
||||||
|
@ -8,13 +8,13 @@ import { ref } from 'vue';
|
|||||||
|
|
||||||
export default ({ currentPlugin, optionsRef, openPlugin, setOptionsRef }) => {
|
export default ({ currentPlugin, optionsRef, openPlugin, setOptionsRef }) => {
|
||||||
const clipboardFile: any = ref([]);
|
const clipboardFile: any = ref([]);
|
||||||
const searchFocus = () => {
|
const searchFocus = (files) => {
|
||||||
const config: any = localConfig.getConfig();
|
const config: any = localConfig.getConfig();
|
||||||
// 未开启自动粘贴
|
// 未开启自动粘贴
|
||||||
if (!config.perf.common.autoPast) return;
|
if (!config.perf.common.autoPast) return;
|
||||||
|
|
||||||
if (currentPlugin.value.name) return;
|
if (currentPlugin.value.name) return;
|
||||||
const fileList = getCopyFiles();
|
const fileList = files || getCopyFiles();
|
||||||
// 拷贝的是文件
|
// 拷贝的是文件
|
||||||
if (fileList) {
|
if (fileList) {
|
||||||
window.setSubInputValue({ value: '' });
|
window.setSubInputValue({ value: '' });
|
||||||
@ -43,78 +43,79 @@ export default ({ currentPlugin, optionsRef, openPlugin, setOptionsRef }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 再正则插件
|
// 再正则插件
|
||||||
localPlugins.forEach((plugin) => {
|
if (fileList.length === 1) {
|
||||||
const feature = plugin.features;
|
localPlugins.forEach((plugin) => {
|
||||||
// 系统插件无 features 的情况,不需要再搜索
|
const feature = plugin.features;
|
||||||
if (!feature) return;
|
// 系统插件无 features 的情况,不需要再搜索
|
||||||
feature.forEach((fe) => {
|
if (!feature) return;
|
||||||
const ext = path.extname(fileList[0].path);
|
feature.forEach((fe) => {
|
||||||
fe.cmds.forEach((cmd) => {
|
const ext = path.extname(fileList[0].path);
|
||||||
const regImg = /\.(png|jpg|gif|jpeg|webp)$/;
|
fe.cmds.forEach((cmd) => {
|
||||||
if (
|
const regImg = /\.(png|jpg|gif|jpeg|webp)$/;
|
||||||
cmd.type === 'img' &&
|
if (
|
||||||
regImg.test(ext) &&
|
cmd.type === 'img' &&
|
||||||
fileList.length === 1
|
regImg.test(ext) &&
|
||||||
) {
|
fileList.length === 1
|
||||||
const option = {
|
) {
|
||||||
name: cmd.label,
|
const option = {
|
||||||
value: 'plugin',
|
name: cmd.label,
|
||||||
icon: plugin.logo,
|
value: 'plugin',
|
||||||
desc: fe.explain,
|
icon: plugin.logo,
|
||||||
type: plugin.pluginType,
|
desc: fe.explain,
|
||||||
click: () => {
|
type: plugin.pluginType,
|
||||||
pluginClickEvent({
|
click: () => {
|
||||||
plugin,
|
pluginClickEvent({
|
||||||
fe,
|
plugin,
|
||||||
cmd,
|
fe,
|
||||||
ext: {
|
cmd,
|
||||||
code: fe.code,
|
ext: {
|
||||||
type: cmd.type || 'text',
|
code: fe.code,
|
||||||
payload: nativeImage
|
type: cmd.type || 'text',
|
||||||
.createFromPath(fileList[0].path)
|
payload: nativeImage
|
||||||
.toDataURL(),
|
.createFromPath(fileList[0].path)
|
||||||
},
|
.toDataURL(),
|
||||||
openPlugin,
|
},
|
||||||
option,
|
openPlugin,
|
||||||
});
|
option,
|
||||||
clearClipboardFile();
|
});
|
||||||
},
|
clearClipboardFile();
|
||||||
};
|
},
|
||||||
options.push(option);
|
};
|
||||||
}
|
options.push(option);
|
||||||
// 如果是文件,且符合文件正则类型
|
}
|
||||||
if (
|
// 如果是文件,且符合文件正则类型
|
||||||
fileList.length > 1 ||
|
if (
|
||||||
(cmd.type === 'file' && new RegExp(cmd.match).test(ext))
|
fileList.length > 1 ||
|
||||||
) {
|
(cmd.type === 'file' && new RegExp(cmd.match).test(ext))
|
||||||
const option = {
|
) {
|
||||||
name: cmd,
|
const option = {
|
||||||
value: 'plugin',
|
name: cmd,
|
||||||
icon: plugin.logo,
|
value: 'plugin',
|
||||||
desc: fe.explain,
|
icon: plugin.logo,
|
||||||
type: plugin.pluginType,
|
desc: fe.explain,
|
||||||
click: () => {
|
type: plugin.pluginType,
|
||||||
pluginClickEvent({
|
click: () => {
|
||||||
plugin,
|
pluginClickEvent({
|
||||||
fe,
|
plugin,
|
||||||
cmd,
|
fe,
|
||||||
option,
|
cmd,
|
||||||
ext: {
|
option,
|
||||||
code: fe.code,
|
ext: {
|
||||||
type: cmd.type || 'text',
|
code: fe.code,
|
||||||
payload: fileList,
|
type: cmd.type || 'text',
|
||||||
},
|
payload: fileList,
|
||||||
openPlugin,
|
},
|
||||||
});
|
openPlugin,
|
||||||
clearClipboardFile();
|
});
|
||||||
},
|
clearClipboardFile();
|
||||||
};
|
},
|
||||||
options.push(option);
|
};
|
||||||
}
|
options.push(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
setOptionsRef(options);
|
setOptionsRef(options);
|
||||||
clipboard.clear();
|
clipboard.clear();
|
||||||
return;
|
return;
|
||||||
|
@ -156,6 +156,8 @@ const optionsManager = ({
|
|||||||
setOptionsRef,
|
setOptionsRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.searchFocus = searchFocus;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
options: optionsRef,
|
options: optionsRef,
|
||||||
searchFocus,
|
searchFocus,
|
||||||
|
1
src/renderer/shims-vue.d.ts
vendored
1
src/renderer/shims-vue.d.ts
vendored
@ -26,4 +26,5 @@ interface Window {
|
|||||||
setCurrentPlugin: (plugin: any) => void;
|
setCurrentPlugin: (plugin: any) => void;
|
||||||
pluginLoaded: () => void;
|
pluginLoaded: () => void;
|
||||||
getMainInputInfo: () => any;
|
getMainInputInfo: () => any;
|
||||||
|
searchFocus: (args: any) => any;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
// Use this to change the entry point of your app's render process. default src/[main|index].[js|ts]
|
// Use this to change the entry point of your app's render process. default src/[main|index].[js|ts]
|
||||||
builderOptions: {
|
builderOptions: {
|
||||||
productName: 'rubick2',
|
productName: 'rubick',
|
||||||
appId: 'com.muwoo.rubick',
|
appId: 'com.muwoo.rubick',
|
||||||
compression: 'maximum',
|
compression: 'maximum',
|
||||||
directories: {
|
directories: {
|
||||||
@ -67,7 +67,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
mac: {
|
mac: {
|
||||||
icon: 'public/icons/icon.icns',
|
icon: 'public/icons/icon.icns',
|
||||||
target: ['dmg', 'zip'],
|
target: [
|
||||||
|
{
|
||||||
|
target: 'dmg',
|
||||||
|
arch: ['x64', 'arm64'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
artifactName: 'rubick-${version}-${arch}.dmg',
|
||||||
gatekeeperAssess: false,
|
gatekeeperAssess: false,
|
||||||
entitlementsInherit: './release/entitlements.mac.plist',
|
entitlementsInherit: './release/entitlements.mac.plist',
|
||||||
entitlements: './release/entitlements.mac.plist',
|
entitlements: './release/entitlements.mac.plist',
|
||||||
@ -79,11 +85,19 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
win: {
|
win: {
|
||||||
icon: 'public/icons/icon.ico',
|
icon: 'public/icons/icon.ico',
|
||||||
target: 'nsis',
|
artifactName: 'rubick-Setup-${version}-${arch}.exe',
|
||||||
|
target: [
|
||||||
|
{
|
||||||
|
target: 'nsis',
|
||||||
|
arch: ['x64', 'ia32'],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
nsis: {
|
nsis: {
|
||||||
|
shortcutName: 'rubick',
|
||||||
oneClick: false,
|
oneClick: false,
|
||||||
allowToChangeInstallationDirectory: true,
|
allowToChangeInstallationDirectory: true,
|
||||||
|
include: 'public/installer.nsh',
|
||||||
},
|
},
|
||||||
linux: {
|
linux: {
|
||||||
icon: 'public/icons/',
|
icon: 'public/icons/',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user