Compare commits

..

16 Commits

Author SHA1 Message Date
muwoo
6da9e2fe9c 插件适配窗口缩放;修复窗口尺寸调整的bug;新增 createBrowserWindow、getCursorScreenPoint、getDisplayNearestPoint、outPlugin API 2023-10-23 15:30:15 +08:00
木偶
c00963fabb Update package.json 2023-10-22 15:12:32 +08:00
木偶
4b8f0e4657 Merge pull request #271 from lumozx/detach
fix: 解决win相互覆盖的问题
2023-10-22 13:22:24 +08:00
lumozx
28e7d2aa46 fix: 解决win相互覆盖的问题 2023-10-22 10:58:33 +08:00
木偶
404cb4fcb5 Merge pull request #267 from lumozx/master
fix: 多端数据同步下,列表适配暗黑模式
2023-10-20 15:50:43 +08:00
muwoo
5553170c5a 🐛 修复分离窗口后主程序失去响应的bug 2023-10-20 15:33:41 +08:00
lumozx
d8fabc6b4c fix: 暗黑模式下,点击刷新插件,插件名称输入框暗黑模式失效的问题 2023-10-20 12:12:10 +08:00
lumozx
88e4e325f3 fix: 选择器和输入框适配暗黑模式 2023-10-20 12:09:46 +08:00
muwoo
c0aaae08ee 🐛 修复 linux CI 2023-10-20 11:45:46 +08:00
muwoo
35598159a6 🐛 修复 linux CI 2023-10-20 11:45:36 +08:00
muwoo
2a1a332fbb ♻️ 修改 onPluginEnter 执行时机. 2023-10-20 11:23:57 +08:00
lumozx
6d105e0f56 fix: drawer与model暗黑适配 2023-10-20 11:01:21 +08:00
lumozx
d2acdeaad6 fix: 列表页暗黑适配 2023-10-20 10:27:56 +08:00
lumozx
54ad4ef7b2 Merge branch 'rubickCenter:master' into master 2023-10-19 21:33:15 +08:00
muwoo
7fb299d270 🐛 修复 #268 2023-10-19 15:24:13 +08:00
lumozx
606cb8bb22 fix: 多端数据同步下,列表适配暗黑模式 2023-10-18 12:44:49 +08:00
20 changed files with 188 additions and 40 deletions

View File

@@ -15,6 +15,8 @@
--color-input-hover: #fff;
// 边框
--color-border-light: #f0f0f0;
// 输入框附带icon
--color-action-color: rgba(0, 0, 0, 0.25);;
}
.dark {
@@ -29,4 +31,6 @@
--color-input-hover: #444d;
// 边框
--color-border-light: #444d;
// 输入框附带icon
--color-action-color: #ffffff4d;
}

View File

@@ -103,7 +103,7 @@ const wrapperCol = { span: 14 };
color: var(--color-text-content);
}
:deep(.ant-input) {
background: var(--color-input-hover);
background: var(--color-input-hover) !important;
color: var(--color-text-content);
}
}

View File

@@ -6,7 +6,7 @@
<ExportOutlined />
</template>
</a-button>
<a-button @click="importData" danger size="small" style="margin-right: 10px;">
<a-button @click="importData" danger size="small" style="margin-right: 10px; background-color: var(--color-input-hover)">
导入数据
<template #icon>
<ImportOutlined />
@@ -33,15 +33,20 @@
<DatabaseOutlined style="font-size: 18px;"/>
</a>
</template>
<a-list-item-meta :description="`${item.keys.length} 份文档`">
<a-list-item-meta>
<template #title>
<div>
<div style="color: var(--color-text-content)">
<span>{{ item.plugin?.pluginName }}</span>
</div>
</template>
<template #avatar>
<a-avatar shape="square" :src="item.plugin?.logo"/>
</template>
<template #description>
<div style="color: var(--color-text-desc)">
<span>{{ item.keys.length }} 份文档</span>
</div>
</template>
</a-list-item-meta>
</a-list-item>
</template>
@@ -52,6 +57,7 @@
:closable="false"
:title="currentSelect.plugin.pluginName"
placement="right"
class="exportDrawer"
>
<p
class="key-item"
@@ -64,7 +70,12 @@
</a-drawer>
<a-modal
centered
bodyStyle="max-height: 500px; overflow: auto"
:bodyStyle="{
maxHeight: '500px',
overflow: 'auto',
backgroundColor: 'var(--color-body-bg)',
color: 'var(--color-text-primary)'
}"
:footer="null"
:closable="false"
v-model:visible="show"
@@ -75,6 +86,7 @@
v-model:visible="showSetting"
title="webdav 账户配置"
:footer="null"
class="webdavModel"
>
<a-alert v-if="formState.suport === 'jianguo'" style="margin-bottom: 20px;" type="info" show-icon>
<template #message>
@@ -255,7 +267,7 @@ const downloadPlugin = async (plugin) => {
.export-header {
width: 100%;
height: 40px;
border-bottom: 1px solid #eee;
border-bottom: 1px solid var(--color-border-light);
text-align: right;
}
.key-item {
@@ -265,4 +277,44 @@ const downloadPlugin = async (plugin) => {
color: var(--ant-primary-color);
}
}
.exportDrawer{
.ant-drawer-header{
background-color: var(--color-body-bg);
border-bottom: 1px solid var(--color-border-light);
.ant-drawer-title{
color: var(--color-text-primary);
}
}
.ant-drawer-body{
background-color: var(--color-body-bg);
color: var(--color-text-content)
}
}
.webdavModel{
.ant-modal-close-x{
color: var(--color-text-content);
}
.ant-modal-header{
background-color: var(--color-body-bg);
border-bottom: 1px solid var(--color-border-light);
.ant-modal-title{
color: var(--color-text-primary);
}
}
.ant-form-item-label>label {
color: var(--color-text-content);
}
.ant-modal-body {
background-color: var(--color-body-bg);
.ant-input,
.ant-input-password,
.ant-select-selector {
background: var(--color-input-hover) !important;
color: var(--color-text-content);
}
.ant-input-password-icon, .ant-select-arrow {
color: var(--color-action-color);
}
}
}
</style>

View File

@@ -512,6 +512,13 @@ const changeLanguage = (value) => {
background: var(--color-list-hover);
}
}
.ant-select-selector {
background: var(--color-input-hover) !important;
color: var(--color-text-content);
}
.ant-input-password-icon, .ant-select-arrow {
color: var(--color-action-color);
}
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "rubick",
"version": "4.0.5",
"version": "4.0.10",
"author": "muwoo <2424880409@qq.com>",
"private": true,
"scripts": {

View File

@@ -1,5 +1,11 @@
const { ipcRenderer, shell } = require('electron');
const { BrowserWindow, nativeTheme, screen, app } = require('@electron/remote');
const os = require('os');
const path = require('path');
const appPath = app.getPath('userData');
const baseDir = path.join(appPath, './rubick-plugins');
const ipcSendSync = (type, data) => {
const returnValue = ipcRenderer.sendSync('msg-trigger', {
@@ -19,9 +25,9 @@ const ipcSend = (type, data) => {
window.rubick = {
hooks: {},
__event__: {},
// 事件
onPluginEnter(cb) {
console.log(window.rubick.hooks);
typeof cb === 'function' && (window.rubick.hooks.onPluginEnter = cb);
},
onPluginReady(cb) {
@@ -178,4 +184,57 @@ window.rubick = {
simulateKeyboardTap: (key, ...modifier) => {
ipcSend('simulateKeyboardTap', { key, modifier });
},
getCursorScreenPoint: () => {
return screen.getCursorScreenPoint();
},
getDisplayNearestPoint: (point) => {
return screen.getDisplayNearestPoint(point);
},
outPlugin: () => {
return ipcSend('removePlugin');
},
createBrowserWindow: (url, options, callback) => {
const winUrl = path.resolve(baseDir, 'node_modules', options.name);
const winIndex = `file://${path.join(winUrl, './', url || '')}`;
const preloadPath = path.join(
winUrl,
'./',
options.webPreferences.preload || ''
);
let win = new BrowserWindow({
useContentSize: true,
resizable: true,
title: '拉比克',
show: false,
backgroundColor: nativeTheme.shouldUseDarkColors ? '#1c1c28' : '#fff',
...options,
webPreferences: {
webSecurity: false,
backgroundThrottling: false,
contextIsolation: false,
webviewTag: true,
nodeIntegration: true,
spellcheck: false,
partition: null,
...(options.webPreferences || {}),
preload: preloadPath,
},
});
win.loadURL(winIndex);
win.on('closed', () => {
win = undefined;
});
win.once('ready-to-show', () => {
win.show();
});
win.webContents.on('dom-ready', () => {
callback && callback();
});
return win;
},
};

View File

@@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>tpl</title><link href="css/app.f5fd5a5f.css" rel="preload" as="style"><link href="js/app.bdf36c39.js" rel="preload" as="script"><link href="js/chunk-vendors.6a327047.js" rel="preload" as="script"><link href="css/app.f5fd5a5f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but tpl doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.6a327047.js"></script><script src="js/app.bdf36c39.js"></script></body></html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>tpl</title><link href="css/app.f5fd5a5f.css" rel="preload" as="style"><link href="js/app.71511ff3.js" rel="preload" as="script"><link href="js/chunk-vendors.6a327047.js" rel="preload" as="script"><link href="css/app.f5fd5a5f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but tpl doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.6a327047.js"></script><script src="js/app.71511ff3.js"></script></body></html>

View File

@@ -0,0 +1 @@
(function(e){function t(t){for(var r,a,s=t[0],u=t[1],i=t[2],p=0,d=[];p<s.length;p++)a=s[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);l&&l(t);while(d.length)d.shift()();return c.push.apply(c,i||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,s=1;s<n.length;s++){var u=n[s];0!==o[u]&&(r=!1)}r&&(c.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},o={app:0},c=[];function a(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],u=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var l=u;c.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("cd49")},"0378":function(e,t,n){"use strict";n("c7e8")},"0861":function(e,t,n){},3809:function(e,t,n){"use strict";n("0861")},c7e8:function(e,t,n){},cd49:function(e,t,n){"use strict";n.r(t);var r=n("79c4"),o=n("5084"),c={__name:"App",setup(e){const t=Object(o["d"])();return window.rubick.onPluginEnter(({code:e,type:n,payload:r})=>{const o=window.exports[e];"none"!==o.mode?t.push({name:o.mode,params:{code:e,type:n,payload:r}}):o.args.enter&&o.args.enter({code:e,type:n,payload:r})}),(e,t)=>{const n=Object(r["w"])("router-view");return Object(r["r"])(),Object(r["d"])(n)}}};n("0378");const a=c;var s=a;const u={class:"list-container"},i={class:"options"},l=["onClick"],p=["src"],d={class:"content"},b={class:"title"},v={class:"desc"};var f=Object(r["h"])({__name:"List",setup(e){const{ipcRenderer:t}=window.require("electron"),n=Object(o["c"])(),c=60,a=10,s=60,{code:f,type:O,payload:j}=n.params,y=window.exports[f];window.rubick.setExpendHeight(s);const w=Object(r["u"])([]);Object(r["B"])([w],()=>{const e=w.value.length>a?a*c:c*w.value.length;window.rubick.setExpendHeight(s+e)}),y.args.enter&&y.args.enter({code:f,type:O,payload:j},e=>{w.value=e});const g=Object(r["u"])(0);t.on("changeCurrent",(e,t)=>{g.value+t>w.value.length-1||w.value+t<0||(g.value=g.value+t)}),window.rubick.setSubInput(({text:e})=>{y.args.search&&y.args.search({code:f,type:"",payload:[]},e,e=>{w.value=e||[]})},"搜索");const h=e=>{y.args.select&&y.args.select({code:f,type:"",payload:[]},e)},m=e=>{if("Enter"===e.code)return h(w.value[g.value]);let t=0;"ArrowDown"===e.code&&(t=1),"ArrowUp"===e.code&&(t=-1),w.value.length&&(g.value+t>w.value.length-1||g.value+t<0||(g.value=g.value+t))};return window.addEventListener("keydown",m),Object(r["o"])(()=>{window.removeEventListener("keydown",m)}),(e,t)=>(Object(r["r"])(),Object(r["f"])("div",u,[Object(r["C"])(Object(r["g"])("div",i,[(Object(r["r"])(!0),Object(r["f"])(r["a"],null,Object(r["v"])(w.value,(e,t)=>(Object(r["r"])(),Object(r["f"])("div",{key:t,class:Object(r["m"])(g.value===t?"active op-item":"op-item"),onClick:t=>h(e)},[e.icon?(Object(r["r"])(),Object(r["f"])("img",{key:0,class:"icon",src:e.icon},null,8,p)):Object(r["e"])("",!0),Object(r["g"])("div",d,[Object(r["g"])("div",b,Object(r["y"])(e.title),1),Object(r["g"])("div",v,Object(r["y"])(decodeURIComponent(e.description)),1)])],10,l))),128))],512),[[r["A"],!!(w.value||[]).length]])]))}});n("3809");const O=f;var j=O;const y={class:"home"};function w(e,t){return Object(r["r"])(),Object(r["f"])("div",y)}var g=n("41ec"),h=n.n(g);const m={},k=h()(m,[["render",w]]);var x=k;const _=[{path:"/list",name:"list",component:j},{path:"/doc",name:"doc",component:x}],P=Object(o["a"])({history:Object(o["b"])(),routes:_});var E=P,S=n("b082"),C=Object(S["a"])({state:{},mutations:{},actions:{},modules:{}});Object(r["c"])(s).use(C).use(E).mount("#app")}});

View File

@@ -1 +0,0 @@
(function(e){function t(t){for(var r,a,u=t[0],s=t[1],i=t[2],p=0,d=[];p<u.length;p++)a=u[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);l&&l(t);while(d.length)d.shift()();return c.push.apply(c,i||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,u=1;u<n.length;u++){var s=n[u];0!==o[s]&&(r=!1)}r&&(c.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},o={app:0},c=[];function a(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var u=window["webpackJsonp"]=window["webpackJsonp"]||[],s=u.push.bind(u);u.push=t,u=u.slice();for(var i=0;i<u.length;i++)t(u[i]);var l=s;c.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("cd49")},"0861":function(e,t,n){},3809:function(e,t,n){"use strict";n("0861")},"4b1f":function(e,t,n){},cd49:function(e,t,n){"use strict";n.r(t);var r=n("79c4"),o=n("5084"),c={__name:"App",setup(e){const t=Object(o["d"])();return window.rubick.onPluginEnter(({code:e,type:n,payload:r})=>{const o=window.exports[e];t.push({name:o.mode,params:{code:e,type:n,payload:r}})}),(e,t)=>{const n=Object(r["w"])("router-view");return Object(r["r"])(),Object(r["d"])(n)}}};n("da18");const a=c;var u=a;const s={class:"list-container"},i={class:"options"},l=["onClick"],p=["src"],d={class:"content"},b={class:"title"},v={class:"desc"};var f=Object(r["h"])({__name:"List",setup(e){const{ipcRenderer:t}=window.require("electron"),n=Object(o["c"])(),c=60,a=10,u=60,{code:f,type:O,payload:j}=n.params,y=window.exports[f];window.rubick.setExpendHeight(u);const w=Object(r["u"])([]);Object(r["B"])([w],()=>{const e=w.value.length>a?a*c:c*w.value.length;window.rubick.setExpendHeight(u+e)}),y.args.enter&&y.args.enter({code:f,type:O,payload:j},e=>{w.value=e});const h=Object(r["u"])(0);t.on("changeCurrent",(e,t)=>{h.value+t>w.value.length-1||w.value+t<0||(h.value=h.value+t)}),window.rubick.setSubInput(({text:e})=>{y.args.search&&y.args.search({code:f,type:"",payload:[]},e,e=>{w.value=e||[]})},"搜索");const g=e=>{y.args.select&&y.args.select({code:f,type:"",payload:[]},e)},m=e=>{if("Enter"===e.code)return g(w.value[h.value]);let t=0;"ArrowDown"===e.code&&(t=1),"ArrowUp"===e.code&&(t=-1),w.value.length&&(h.value+t>w.value.length-1||h.value+t<0||(h.value=h.value+t))};return window.addEventListener("keydown",m),Object(r["o"])(()=>{window.removeEventListener("keydown",m)}),(e,t)=>(Object(r["r"])(),Object(r["f"])("div",s,[Object(r["C"])(Object(r["g"])("div",i,[(Object(r["r"])(!0),Object(r["f"])(r["a"],null,Object(r["v"])(w.value,(e,t)=>(Object(r["r"])(),Object(r["f"])("div",{key:t,class:Object(r["m"])(h.value===t?"active op-item":"op-item"),onClick:t=>g(e)},[e.icon?(Object(r["r"])(),Object(r["f"])("img",{key:0,class:"icon",src:e.icon},null,8,p)):Object(r["e"])("",!0),Object(r["g"])("div",d,[Object(r["g"])("div",b,Object(r["y"])(e.title),1),Object(r["g"])("div",v,Object(r["y"])(decodeURIComponent(e.description)),1)])],10,l))),128))],512),[[r["A"],!!(w.value||[]).length]])]))}});n("3809");const O=f;var j=O;const y={class:"home"};function w(e,t){return Object(r["r"])(),Object(r["f"])("div",y)}var h=n("41ec"),g=n.n(h);const m={},k=g()(m,[["render",w]]);var x=k;const _=[{path:"/list",name:"list",component:j},{path:"/doc",name:"doc",component:x}],P=Object(o["a"])({history:Object(o["b"])(),routes:_});var E=P,S=n("b082"),C=Object(S["a"])({state:{},mutations:{},actions:{},modules:{}});Object(r["c"])(u).use(C).use(E).mount("#app")},da18:function(e,t,n){"use strict";n("4b1f")}});

View File

@@ -17,10 +17,13 @@ export default function getCopyFiles(): Array<any> | null {
return null;
}
} else if (process.platform === 'win32') {
try {
/* eslint-disable */
const clipboardEx = require('electron-clipboard-ex');
fileInfo = clipboardEx.readFilePaths();
} catch (e) {
// todo
}
} else {
if (!commonConst.linux()) return null;
if (!clipboard.has('text/uri-list')) return null;

View File

@@ -25,7 +25,6 @@ export const handleScreenShots = (cb) => {
export default (mainWindow, cb) => {
// 接收到截图后的执行程序
mainWindow.hide();
clipboard.writeText('');
if (platform.macOS()) {
handleScreenShots(cb);

View File

@@ -5,18 +5,18 @@ import { WINDOW_MIN_HEIGHT } from '@/common/constans/common';
export default () => {
let win: any;
const init = (pluginInfo, viewInfo, view) => {
const init = async (pluginInfo, viewInfo, view) => {
ipcMain.on('detach:service', async (event, arg: { type: string }) => {
const data = await operation[arg.type]();
event.returnValue = data;
});
createWindow(pluginInfo, viewInfo, view);
const createWin = await createWindow(pluginInfo, viewInfo, view);
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('@electron/remote/main').enable(win.webContents);
require('@electron/remote/main').enable(createWin.webContents);
};
const createWindow = async (pluginInfo, viewInfo, view) => {
win = new BrowserWindow({
const createWin = new BrowserWindow({
height: viewInfo.height,
minHeight: WINDOW_MIN_HEIGHT,
width: viewInfo.width,
@@ -43,29 +43,33 @@ export default () => {
});
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL('http://localhost:8082');
createWin.loadURL('http://localhost:8082');
} else {
win.loadURL(`file://${path.join(__static, './detach/index.html')}`);
createWin.loadURL(`file://${path.join(__static, './detach/index.html')}`);
}
win.on('close', () => {
createWin.on('close', () => {
executeHooks('PluginOut', null);
});
win.on('closed', () => {
createWin.on('closed', () => {
win = undefined;
});
createWin.on('focus', () => {
win = createWin;
});
win.once('ready-to-show', async () => {
createWin.once('ready-to-show', async () => {
const config = await localConfig.getConfig();
const darkMode = config.perf.common.darkMode;
darkMode &&
win.webContents.executeJavaScript(
createWin.webContents.executeJavaScript(
`document.body.classList.add("dark");window.rubick.theme="dark"`
);
win.setBrowserView(view);
win.webContents.executeJavaScript(
view.setAutoResize({ width: true, height: true });
createWin.setBrowserView(view);
createWin.webContents.executeJavaScript(
`window.initDetach(${JSON.stringify(pluginInfo)})`
);
win.show();
createWin.show();
});
const executeHooks = (hook, data) => {
if (!view) return;
@@ -77,6 +81,7 @@ export default () => {
`;
view.webContents.executeJavaScript(evalJs);
};
return createWin;
};
const getWindow = () => win;

View File

@@ -3,7 +3,11 @@ import path from 'path';
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';
// import versonHandler from '../common/versionHandler';
import localConfig from '@/main/common/initLocalConfig';
import { WINDOW_HEIGHT, WINDOW_MIN_HEIGHT, WINDOW_WIDTH } from '@/common/constans/common';
import {
WINDOW_HEIGHT,
WINDOW_MIN_HEIGHT,
WINDOW_WIDTH,
} from '@/common/constans/common';
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('@electron/remote/main').initialize();

View File

@@ -59,7 +59,7 @@ export default () => {
const height = pluginSetting && pluginSetting.height;
window.setSize(800, height || 600);
view.setBounds({ x: 0, y: 60, width: 800, height: height || 540 });
view.setAutoResize({ width: true });
view.setAutoResize({ width: true, height: true });
executeHooks('PluginEnter', ext);
executeHooks('PluginReady', ext);
const config = await localConfig.getConfig();
@@ -166,7 +166,7 @@ export default () => {
const removeView = (window: BrowserWindow) => {
if (!view) return;
window.removeBrowserView(view);
window.setSize(800, 60);
// window.setSize(800, 60);
executeHooks('PluginOut', null);
window.webContents?.executeJavaScript(`window.initRubick()`);
view = undefined;
@@ -175,6 +175,7 @@ export default () => {
const getView = () => view;
const executeHooks = (hook, data) => {
setTimeout(() => {
if (!view) return;
const evalJs = `if(window.rubick && window.rubick.hooks && typeof window.rubick.hooks.on${hook} === 'function' ) {
try {
@@ -183,6 +184,7 @@ export default () => {
}
`;
view.webContents?.executeJavaScript(evalJs);
}, 300);
};
return {

View File

@@ -222,7 +222,7 @@ class API extends DBInstance {
}
public getFeatures() {
return this.currentPlugin.features;
return this.currentPlugin?.features;
}
public setFeature({ data }, window) {

View File

@@ -76,13 +76,16 @@ getPluginInfo({
remote.getGlobal('LOCAL_PLUGINS').addPlugin(res);
});
watch([options, pluginHistory], () => {
watch([options, pluginHistory, currentPlugin], () => {
currentSelect.value = 0;
if (currentPlugin.value.name) return;
nextTick(() => {
ipcRenderer.sendSync('msg-trigger', {
type: 'setExpendHeight',
data: getWindowHeight(options.value, pluginHistory.value),
data: getWindowHeight(
options.value,
pluginLoading.value ? [] : pluginHistory.value
),
});
});
});

View File

@@ -14,7 +14,7 @@
:key="index"
>
<a-avatar style="width: 28px; height: 28px;" :src="item.icon" />
<div class="name ellpise">{{item.pluginName || item._name || item.name}}</div>
<div class="name ellpise">{{item.cmd || item.pluginName || item._name || item.name}}</div>
</a-col>
</a-row>
</div>

View File

@@ -70,6 +70,9 @@ const createPluginManager = (): any => {
const openPlugin = async (plugin, option) => {
if (plugin.pluginType === 'ui' || plugin.pluginType === 'system') {
if (state.currentPlugin && state.currentPlugin.name === plugin.name) {
ipcRenderer.sendSync('msg-trigger', {
type: 'showMainWindow',
});
return;
}
await loadPlugin(plugin);
@@ -118,6 +121,7 @@ const createPluginManager = (): any => {
const {
options,
searchFocus,
setOptionsRef,
clipboardFile,
clearClipboardFile,
readClipboardContent,
@@ -169,6 +173,7 @@ const createPluginManager = (): any => {
window.initRubick = () => {
state.currentPlugin = {};
setSearchValue('');
setOptionsRef([]);
window.setSubInput({ placeholder: '' });
};

View File

@@ -157,6 +157,7 @@ const optionsManager = ({
});
return {
setOptionsRef,
options: optionsRef,
searchFocus,
clipboardFile,

View File

@@ -8,6 +8,10 @@ import { useRouter } from "vue-router";
const router = useRouter();
window.rubick.onPluginEnter(({ code, type, payload }) => {
const current = window.exports[code];
if (current.mode === 'none') {
current.args.enter && current.args.enter({ code: code, type, payload });
return;
}
router.push({
name: current.mode,
params: {