mirror of
https://github.com/rubickCenter/rubick
synced 2025-10-26 22:51:25 +08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f7285b177 | ||
|
|
e8c8f40bae | ||
|
|
6ae15b8f37 | ||
|
|
a3a7dfde98 | ||
|
|
289165de82 | ||
|
|
6da9e2fe9c | ||
|
|
c00963fabb | ||
|
|
4b8f0e4657 | ||
|
|
28e7d2aa46 | ||
|
|
404cb4fcb5 | ||
|
|
5553170c5a | ||
|
|
d8fabc6b4c | ||
|
|
88e4e325f3 | ||
|
|
6d105e0f56 | ||
|
|
d2acdeaad6 | ||
|
|
54ad4ef7b2 | ||
|
|
606cb8bb22 |
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
|
||||
@@ -86,6 +86,47 @@ Object.assign(window, {
|
||||
plugInfo.value.subInput = null;
|
||||
},
|
||||
});
|
||||
|
||||
window.enterFullScreenTrigger = () => {
|
||||
document.querySelector('.detach').classList.remove('darwin');
|
||||
};
|
||||
window.leaveFullScreenTrigger = () => {
|
||||
const titleDom = document.querySelector('.detach');
|
||||
if (!titleDom.classList.contains('darwin')) {
|
||||
titleDom.classList.add('darwin');
|
||||
}
|
||||
};
|
||||
|
||||
window.maximizeTrigger = () => {
|
||||
const btnMaximize = document.querySelector('.maximize')
|
||||
if (!btnMaximize || btnMaximize.classList.contains('unmaximize')) return;
|
||||
btnMaximize.classList.add('unmaximize');
|
||||
};
|
||||
|
||||
window.unmaximizeTrigger = () => {
|
||||
const btnMaximize = document.querySelector('.maximize');
|
||||
if (!btnMaximize) return;
|
||||
btnMaximize.classList.remove('unmaximize');
|
||||
};
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
window.onkeydown = (e) => {
|
||||
if (e.code === 'Escape') {
|
||||
ipcRenderer.send('detach:service', { type: 'endFullScreen' });
|
||||
return;
|
||||
}
|
||||
if (e.metaKey && (e.code === 'KeyW' || e.code === 'KeyQ')) {
|
||||
window.handle.close()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
window.onkeydown = (e) => {
|
||||
if (e.ctrlKey && e.code === 'KeyW') {
|
||||
window.handle.close()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
@import "~ant-design-vue/dist/antd.less"; // 引入官方提供的 less 样式入口文件
|
||||
|
||||
@primary-color: #ff4ea4; // 全局主色
|
||||
@error-color: #ff4ea4; // 错误色
|
||||
|
||||
:root {
|
||||
--color-text-primary: rgba(0, 0, 0, 0.85);
|
||||
--color-text-content: #141414;
|
||||
@@ -15,6 +10,8 @@
|
||||
--color-input-hover: #fff;
|
||||
// 边框
|
||||
--color-border-light: #f0f0f0;
|
||||
// 输入框附带icon
|
||||
--color-action-color: rgba(0, 0, 0, 0.25);;
|
||||
}
|
||||
|
||||
.dark {
|
||||
@@ -29,4 +26,6 @@
|
||||
--color-input-hover: #444d;
|
||||
// 边框
|
||||
--color-border-light: #444d;
|
||||
// 输入框附带icon
|
||||
--color-action-color: #ffffff4d;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rubick",
|
||||
"version": "4.0.7",
|
||||
"version": "4.1.1",
|
||||
"author": "muwoo <2424880409@qq.com>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -33,6 +33,7 @@
|
||||
"lodash.throttle": "^4.1.1",
|
||||
"memorystream": "^0.3.1",
|
||||
"node-key-sender": "^1.0.11",
|
||||
"npm": "6.14.7",
|
||||
"pinyin-match": "^1.2.4",
|
||||
"pouchdb": "^7.2.2",
|
||||
"pouchdb-load": "^1.4.6",
|
||||
|
||||
@@ -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>detach</title><link href="css/app.65d55ce4.css" rel="preload" as="style"><link href="js/app.bc494a66.js" rel="preload" as="script"><link href="js/chunk-vendors.b36194a6.js" rel="preload" as="script"><link href="css/app.65d55ce4.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but detach doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.b36194a6.js"></script><script src="js/app.bc494a66.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></title><link href="css/app.65d55ce4.css" rel="preload" as="style"><link href="js/app.f4fdc34a.js" rel="preload" as="script"><link href="js/chunk-vendors.b36194a6.js" rel="preload" as="script"><link href="css/app.65d55ce4.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but detach doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.b36194a6.js"></script><script src="js/app.f4fdc34a.js"></script></body></html>
|
||||
@@ -1 +0,0 @@
|
||||
(function(e){function t(t){for(var c,o,l=t[0],a=t[1],i=t[2],d=0,p=[];d<l.length;d++)o=l[d],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&p.push(r[o][0]),r[o]=0;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(e[c]=a[c]);s&&s(t);while(p.length)p.shift()();return u.push.apply(u,i||[]),n()}function n(){for(var e,t=0;t<u.length;t++){for(var n=u[t],c=!0,l=1;l<n.length;l++){var a=n[l];0!==r[a]&&(c=!1)}c&&(u.splice(t--,1),e=o(o.s=n[0]))}return e}var c={},r={app:0},u=[];function o(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=c,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)o.d(n,c,function(t){return e[t]}.bind(null,c));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var l=window["webpackJsonp"]=window["webpackJsonp"]||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var i=0;i<l.length;i++)t(l[i]);var s=a;u.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("cd49")},4011:function(e,t,n){},c549:function(e,t,n){},cd49:function(e,t,n){"use strict";n.r(t);var c=n("79c4"),r=n("c965"),u=n.n(r);const o={class:"info"},l=["src"],a=["value","placeholder"],i={key:1},s={class:"handle-container"},d={key:0,class:"window-handle"};var p={__name:"App",setup(e){const{ipcRenderer:t}=window.require("electron"),n=window.require("process"),r=Object(c["g"])(!1),p=localStorage.getItem("rubick-system-detach")||"{}",b=Object(c["g"])({});window.initDetach=e=>{b.value=e,r.value=e.subInput&&(!!e.subInput.value||!!e.subInput.placeholder),localStorage.setItem("rubick-system-detach",JSON.stringify(e))};try{window.initDetach(JSON.parse(p))}catch(g){}const v=u()(e=>{t.send("msg-trigger",{type:"detachInputChange",data:{text:e.target.value}})},500),f=()=>{t.send("msg-trigger",{type:"openPluginDevTools"})},O=()=>{t.send("detach:service",{type:"minimize"})},h=()=>{t.send("detach:service",{type:"maximize"})},j=()=>{t.send("detach:service",{type:"close"})};return Object.assign(window,{setSubInputValue:({value:e})=>{b.value.subInput.value=e},setSubInput:e=>{b.value.subInput.placeholder=e},removeSubInput:()=>{b.value.subInput=null}}),(e,t)=>{var u,p;return Object(c["f"])(),Object(c["c"])("div",{class:Object(c["e"])([Object(c["i"])(n).platform,"detach"])},[Object(c["d"])("div",o,[Object(c["d"])("img",{src:b.value.logo},null,8,l),r.value?(Object(c["f"])(),Object(c["c"])("input",{key:0,autofocus:"",onInput:t[0]||(t[0]=(...e)=>Object(c["i"])(v)&&Object(c["i"])(v)(...e)),value:null===(u=b.value.subInput)||void 0===u?void 0:u.value,placeholder:null===(p=b.value.subInput)||void 0===p?void 0:p.placeholder},null,40,a)):(Object(c["f"])(),Object(c["c"])("span",i,Object(c["h"])(b.value.pluginName),1))]),Object(c["d"])("div",s,[Object(c["d"])("div",{class:"handle"},[Object(c["d"])("div",{class:"devtool",onClick:f,title:"开发者工具"})]),"darwin"!==Object(c["i"])(n).platform?(Object(c["f"])(),Object(c["c"])("div",d,[Object(c["d"])("div",{class:"minimize",onClick:O}),Object(c["d"])("div",{class:"maximize",onClick:h}),Object(c["d"])("div",{class:"close",onClick:j})])):Object(c["b"])("",!0)])],2)}}};n("f8d8");const b=p;var v=b;n("4011");Object(c["a"])(v).mount("#app")},f8d8:function(e,t,n){"use strict";n("c549")}});
|
||||
1
public/detach/js/app.f4fdc34a.js
Normal file
1
public/detach/js/app.f4fdc34a.js
Normal file
@@ -0,0 +1 @@
|
||||
(function(e){function t(t){for(var c,o,a=t[0],l=t[1],u=t[2],d=0,p=[];d<a.length;d++)o=a[d],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&p.push(r[o][0]),r[o]=0;for(c in l)Object.prototype.hasOwnProperty.call(l,c)&&(e[c]=l[c]);s&&s(t);while(p.length)p.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],c=!0,a=1;a<n.length;a++){var l=n[a];0!==r[l]&&(c=!1)}c&&(i.splice(t--,1),e=o(o.s=n[0]))}return e}var c={},r={app:0},i=[];function o(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=c,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)o.d(n,c,function(t){return e[t]}.bind(null,c));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var a=window["webpackJsonp"]=window["webpackJsonp"]||[],l=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var s=l;i.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("cd49")},3480:function(e,t,n){"use strict";n("a1ff")},4011:function(e,t,n){},a1ff:function(e,t,n){},cd49:function(e,t,n){"use strict";n.r(t);var c=n("79c4"),r=n("c965"),i=n.n(r);const o={class:"info"},a=["src"],l=["value","placeholder"],u={key:1},s={class:"handle-container"},d={key:0,class:"window-handle"};var p={__name:"App",setup(e){const{ipcRenderer:t}=window.require("electron"),n=window.require("process"),r=Object(c["g"])(!1),p=localStorage.getItem("rubick-system-detach")||"{}",v=Object(c["g"])({});window.initDetach=e=>{v.value=e,r.value=e.subInput&&(!!e.subInput.value||!!e.subInput.placeholder),localStorage.setItem("rubick-system-detach",JSON.stringify(e))};try{window.initDetach(JSON.parse(p))}catch(y){}const b=i()(e=>{t.send("msg-trigger",{type:"detachInputChange",data:{text:e.target.value}})},500),f=()=>{t.send("msg-trigger",{type:"openPluginDevTools"})},m=()=>{t.send("detach:service",{type:"minimize"})},w=()=>{t.send("detach:service",{type:"maximize"})},h=()=>{t.send("detach:service",{type:"close"})};return Object.assign(window,{setSubInputValue:({value:e})=>{v.value.subInput.value=e},setSubInput:e=>{v.value.subInput.placeholder=e},removeSubInput:()=>{v.value.subInput=null}}),window.enterFullScreenTrigger=()=>{document.querySelector(".detach").classList.remove("darwin")},window.leaveFullScreenTrigger=()=>{const e=document.querySelector(".detach");e.classList.contains("darwin")||e.classList.add("darwin")},window.maximizeTrigger=()=>{const e=document.querySelector(".maximize");e&&!e.classList.contains("unmaximize")&&e.classList.add("unmaximize")},window.unmaximizeTrigger=()=>{const e=document.querySelector(".maximize");e&&e.classList.remove("unmaximize")},"darwin"===n.platform?window.onkeydown=e=>{"Escape"!==e.code?!e.metaKey||"KeyW"!==e.code&&"KeyQ"!==e.code||window.handle.close():t.send("detach:service",{type:"endFullScreen"})}:window.onkeydown=e=>{e.ctrlKey&&"KeyW"===e.code&&window.handle.close()},(e,t)=>{var i,p;return Object(c["f"])(),Object(c["c"])("div",{class:Object(c["e"])([Object(c["i"])(n).platform,"detach"])},[Object(c["d"])("div",o,[Object(c["d"])("img",{src:v.value.logo},null,8,a),r.value?(Object(c["f"])(),Object(c["c"])("input",{key:0,autofocus:"",onInput:t[0]||(t[0]=(...e)=>Object(c["i"])(b)&&Object(c["i"])(b)(...e)),value:null===(i=v.value.subInput)||void 0===i?void 0:i.value,placeholder:null===(p=v.value.subInput)||void 0===p?void 0:p.placeholder},null,40,l)):(Object(c["f"])(),Object(c["c"])("span",u,Object(c["h"])(v.value.pluginName),1))]),Object(c["d"])("div",s,[Object(c["d"])("div",{class:"handle"},[Object(c["d"])("div",{class:"devtool",onClick:f,title:"开发者工具"})]),"darwin"!==Object(c["i"])(n).platform?(Object(c["f"])(),Object(c["c"])("div",d,[Object(c["d"])("div",{class:"minimize",onClick:m}),Object(c["d"])("div",{class:"maximize",onClick:w}),Object(c["d"])("div",{class:"close",onClick:h})])):Object(c["b"])("",!0)])],2)}}};n("3480");const v=p;var b=v;n("4011");Object(c["a"])(b).mount("#app")}});
|
||||
@@ -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-new');
|
||||
|
||||
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;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
1
public/tpl/js/app.71511ff3.js
Normal file
1
public/tpl/js/app.71511ff3.js
Normal 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")}});
|
||||
@@ -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")}});
|
||||
@@ -3,7 +3,7 @@ import path from 'path';
|
||||
|
||||
const appPath = app.getPath('userData');
|
||||
|
||||
const PLUGIN_INSTALL_DIR = path.join(appPath, './rubick-plugins');
|
||||
const PLUGIN_INSTALL_DIR = path.join(appPath, './rubick-plugins-new');
|
||||
|
||||
const DECODE_KEY = {
|
||||
Backspace: 'Backspace',
|
||||
|
||||
@@ -3,6 +3,6 @@ import path from 'path';
|
||||
|
||||
const appPath = app.getPath('userData');
|
||||
|
||||
const PLUGIN_INSTALL_DIR = path.join(appPath, './rubick-plugins');
|
||||
const PLUGIN_INSTALL_DIR = path.join(appPath, './rubick-plugins-new');
|
||||
|
||||
export { PLUGIN_INSTALL_DIR };
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import getLocalDataFile from './getLocalDataFile';
|
||||
import { PluginHandler } from '@/core';
|
||||
import { PLUGIN_INSTALL_DIR as baseDir } from '@/common/constans/main';
|
||||
import API from '@/main/common/api';
|
||||
|
||||
const configPath = path.join(getLocalDataFile(), './rubick-local-plugin.json');
|
||||
const configPath = path.join(baseDir, './rubick-local-plugin.json');
|
||||
|
||||
let registry;
|
||||
let pluginInstance;
|
||||
|
||||
@@ -4,7 +4,6 @@ import getMacApps from './get-mac-app';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import translate from './translate';
|
||||
import os from 'os';
|
||||
|
||||
const icondir = path.join(os.tmpdir(), 'ProcessIcon');
|
||||
|
||||
@@ -7,10 +7,11 @@ import path from 'path';
|
||||
import got from 'got';
|
||||
import fixPath from 'fix-path';
|
||||
|
||||
import spawn from 'cross-spawn';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import axios from 'axios';
|
||||
|
||||
import npm from 'npm';
|
||||
|
||||
fixPath();
|
||||
|
||||
/**
|
||||
@@ -41,7 +42,7 @@ class AdapterHandler {
|
||||
}
|
||||
this.baseDir = options.baseDir;
|
||||
|
||||
let register = options.registry || 'https://registry.npm.taobao.org';
|
||||
let register = options.registry || 'https://registry.npmmirror.com/';
|
||||
|
||||
try {
|
||||
const dbdata = ipcRenderer.sendSync('msg-trigger', {
|
||||
@@ -157,44 +158,67 @@ class AdapterHandler {
|
||||
*/
|
||||
private async execCommand(cmd: string, modules: string[]): Promise<string> {
|
||||
return new Promise((resolve: any, reject: any) => {
|
||||
let args: string[] = [cmd].concat(
|
||||
const module =
|
||||
cmd !== 'uninstall' && cmd !== 'link'
|
||||
? modules.map((m) => `${m}@latest`)
|
||||
: modules
|
||||
);
|
||||
: modules;
|
||||
const config: any = {
|
||||
prefix: this.baseDir,
|
||||
save: true,
|
||||
cache: path.join(this.baseDir, 'cache'),
|
||||
};
|
||||
if (cmd !== 'link') {
|
||||
args = args
|
||||
.concat('--color=always')
|
||||
.concat('--save')
|
||||
.concat(`--registry=${this.registry}`);
|
||||
config.registry = this.registry;
|
||||
}
|
||||
npm.load(config, function (err) {
|
||||
npm.commands[cmd](module, function (er, data) {
|
||||
if (!err) {
|
||||
console.log(data);
|
||||
resolve({ code: -1, data });
|
||||
} else {
|
||||
reject({ code: -1, data: err });
|
||||
}
|
||||
});
|
||||
|
||||
const npm = spawn('npm', args, {
|
||||
cwd: this.baseDir,
|
||||
npm.on('log', function (message) {
|
||||
// log installation progress
|
||||
console.log(message);
|
||||
});
|
||||
});
|
||||
|
||||
console.log(args);
|
||||
// if (cmd !== 'link') {
|
||||
// args = args
|
||||
// .concat('--color=always')
|
||||
// .concat('--save')
|
||||
// .concat(`--registry=${this.registry}`);
|
||||
// }
|
||||
|
||||
let output = '';
|
||||
npm.stdout
|
||||
.on('data', (data: string) => {
|
||||
output += data; // 获取输出日志
|
||||
})
|
||||
.pipe(process.stdout);
|
||||
|
||||
npm.stderr
|
||||
.on('data', (data: string) => {
|
||||
output += data; // 获取报错日志
|
||||
})
|
||||
.pipe(process.stderr);
|
||||
|
||||
npm.on('close', (code: number) => {
|
||||
if (!code) {
|
||||
resolve({ code: 0, data: output }); // 如果没有报错就输出正常日志
|
||||
} else {
|
||||
reject({ code: code, data: output }); // 如果报错就输出报错日志
|
||||
}
|
||||
});
|
||||
// const npm = spawn('npm', args, {
|
||||
// cwd: this.baseDir,
|
||||
// });
|
||||
//
|
||||
// console.log(args);
|
||||
//
|
||||
// let output = '';
|
||||
// npm.stdout
|
||||
// .on('data', (data: string) => {
|
||||
// output += data; // 获取输出日志
|
||||
// })
|
||||
// .pipe(process.stdout);
|
||||
//
|
||||
// npm.stderr
|
||||
// .on('data', (data: string) => {
|
||||
// output += data; // 获取报错日志
|
||||
// })
|
||||
// .pipe(process.stderr);
|
||||
//
|
||||
// npm.on('close', (code: number) => {
|
||||
// if (!code) {
|
||||
// resolve({ code: 0, data: output }); // 如果没有报错就输出正常日志
|
||||
// } else {
|
||||
// reject({ code: code, data: output }); // 如果报错就输出报错日志
|
||||
// }
|
||||
// });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ export const handleScreenShots = (cb) => {
|
||||
|
||||
export default (mainWindow, cb) => {
|
||||
// 接收到截图后的执行程序
|
||||
mainWindow.hide();
|
||||
clipboard.writeText('');
|
||||
if (platform.macOS()) {
|
||||
handleScreenShots(cb);
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
import { BrowserWindow, ipcMain, nativeTheme } from 'electron';
|
||||
import { BrowserWindow, ipcMain, nativeTheme, screen } from 'electron';
|
||||
import localConfig from '../common/initLocalConfig';
|
||||
import commonConst from '@/common/utils/commonConst';
|
||||
import path from 'path';
|
||||
import { WINDOW_MIN_HEIGHT } from '@/common/constans/common';
|
||||
import mainInstance from '@/main';
|
||||
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,
|
||||
@@ -38,35 +40,108 @@ export default () => {
|
||||
webviewTag: true,
|
||||
devTools: true,
|
||||
nodeIntegration: true,
|
||||
navigateOnDragDrop: true,
|
||||
spellcheck: false,
|
||||
},
|
||||
});
|
||||
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;
|
||||
view && win.webContents?.focus();
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
// 最大化设置
|
||||
createWin.on('maximize', () => {
|
||||
createWin.webContents.executeJavaScript('window.maximizeTrigger()');
|
||||
const view = createWin.getBrowserView();
|
||||
if (!view) return;
|
||||
const display = screen.getDisplayMatching(createWin.getBounds());
|
||||
view.setBounds({
|
||||
x: 0,
|
||||
y: WINDOW_MIN_HEIGHT,
|
||||
width: display.workArea.width,
|
||||
height: display.workArea.height - WINDOW_MIN_HEIGHT,
|
||||
});
|
||||
});
|
||||
// 最小化
|
||||
createWin.on('unmaximize', () => {
|
||||
createWin.webContents.executeJavaScript('window.unmaximizeTrigger()');
|
||||
const view = createWin.getBrowserView();
|
||||
if (!view) return;
|
||||
const bounds = createWin.getBounds();
|
||||
const display = screen.getDisplayMatching(bounds);
|
||||
const width =
|
||||
(display.scaleFactor * bounds.width) % 1 == 0
|
||||
? bounds.width
|
||||
: bounds.width - 2;
|
||||
const height =
|
||||
(display.scaleFactor * bounds.height) % 1 == 0
|
||||
? bounds.height
|
||||
: bounds.height - 2;
|
||||
view.setBounds({
|
||||
x: 0,
|
||||
y: WINDOW_MIN_HEIGHT,
|
||||
width,
|
||||
height: height - WINDOW_MIN_HEIGHT,
|
||||
});
|
||||
});
|
||||
|
||||
createWin.on('page-title-updated', (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
createWin.webContents.once('render-process-gone', () => {
|
||||
createWin.close();
|
||||
});
|
||||
|
||||
if (commonConst.macOS()) {
|
||||
createWin.on('enter-full-screen', () => {
|
||||
createWin.webContents.executeJavaScript(
|
||||
'window.enterFullScreenTrigger()'
|
||||
);
|
||||
});
|
||||
createWin.on('leave-full-screen', () => {
|
||||
createWin.webContents.executeJavaScript(
|
||||
'window.leaveFullScreenTrigger()'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
view.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.type !== 'keyDown') return;
|
||||
if (!(input.meta || input.control || input.shift || input.alt)) {
|
||||
if (input.key === 'Escape') {
|
||||
operation.endFullScreen();
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
const executeHooks = (hook, data) => {
|
||||
if (!view) return;
|
||||
const evalJs = `console.log(window.rubick);if(window.rubick && window.rubick.hooks && typeof window.rubick.hooks.on${hook} === 'function' ) {
|
||||
@@ -77,6 +152,7 @@ export default () => {
|
||||
`;
|
||||
view.webContents.executeJavaScript(evalJs);
|
||||
};
|
||||
return createWin;
|
||||
};
|
||||
|
||||
const getWindow = () => win;
|
||||
@@ -92,6 +168,9 @@ export default () => {
|
||||
close: () => {
|
||||
win.close();
|
||||
},
|
||||
endFullScreen: () => {
|
||||
win.isFullScreen() && win.setFullScreen(false);
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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,9 @@ export default () => {
|
||||
const removeView = (window: BrowserWindow) => {
|
||||
if (!view) return;
|
||||
window.removeBrowserView(view);
|
||||
window.setSize(800, 60);
|
||||
window.setBrowserView(null);
|
||||
view.webContents.destroy();
|
||||
// window.setSize(800, 60);
|
||||
executeHooks('PluginOut', null);
|
||||
window.webContents?.executeJavaScript(`window.initRubick()`);
|
||||
view = undefined;
|
||||
|
||||
@@ -222,7 +222,7 @@ class API extends DBInstance {
|
||||
}
|
||||
|
||||
public getFeatures() {
|
||||
return this.currentPlugin.features;
|
||||
return this.currentPlugin?.features;
|
||||
}
|
||||
|
||||
public setFeature({ data }, window) {
|
||||
|
||||
@@ -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;
|
||||
// if (currentPlugin.value.name) return;
|
||||
nextTick(() => {
|
||||
ipcRenderer.sendSync('msg-trigger', {
|
||||
type: 'setExpendHeight',
|
||||
data: getWindowHeight(options.value, pluginHistory.value),
|
||||
data: getWindowHeight(
|
||||
options.value,
|
||||
(pluginLoading.value || currentPlugin.value.name) ? [] : pluginHistory.value
|
||||
),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
<template #suffix>
|
||||
<div class="suffix-tool">
|
||||
<MoreOutlined
|
||||
v-show="!pluginLoading"
|
||||
@click="showSeparate()"
|
||||
class="icon-more"
|
||||
/>
|
||||
|
||||
@@ -121,6 +121,7 @@ const createPluginManager = (): any => {
|
||||
const {
|
||||
options,
|
||||
searchFocus,
|
||||
setOptionsRef,
|
||||
clipboardFile,
|
||||
clearClipboardFile,
|
||||
readClipboardContent,
|
||||
@@ -172,6 +173,7 @@ const createPluginManager = (): any => {
|
||||
window.initRubick = () => {
|
||||
state.currentPlugin = {};
|
||||
setSearchValue('');
|
||||
setOptionsRef([]);
|
||||
window.setSubInput({ placeholder: '' });
|
||||
};
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ const optionsManager = ({
|
||||
});
|
||||
|
||||
return {
|
||||
setOptionsRef,
|
||||
options: optionsRef,
|
||||
searchFocus,
|
||||
clipboardFile,
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -24,6 +24,7 @@ module.exports = {
|
||||
externals: [
|
||||
'pouchdb',
|
||||
'extract-file-icon',
|
||||
'npm',
|
||||
'electron-screenshots',
|
||||
'@electron/remote',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user