This commit is contained in:
sunyuqiang 2023-08-01 18:24:24 +08:00
commit 06d2d9bfbc
14 changed files with 71 additions and 48 deletions

View File

@ -184,6 +184,7 @@ html, body {
.window-handle {
display: flex;
align-items: center;
-webkit-app-region: no-drag;
}
.window-handle > div {

View File

@ -1,3 +1,8 @@
@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;

View File

@ -1,5 +1,5 @@
import { createStore } from "vuex";
import request from "@/assets/request";
import { createStore } from 'vuex';
import request from '@/assets/request';
const isDownload = (item: Market.Plugin, targets: any[]) => {
let isDownload = false;
@ -29,74 +29,84 @@ export default createStore({
const totalPlugins = await request.getTotalPlugins();
const localPlugins = window.market.getLocalPlugins();
totalPlugins.forEach(
(origin: Market.Plugin) => {
origin.isdownload = isDownload(origin, localPlugins);
origin.isloading = false;
}
);
commit("commonUpdate", {
totalPlugins.forEach((origin: Market.Plugin) => {
origin.isdownload = isDownload(origin, localPlugins);
origin.isloading = false;
});
// 修复卸载失败,一直转圈的问题。
localPlugins.forEach((origin: Market.Plugin) => {
origin.isloading = false;
});
commit('commonUpdate', {
localPlugins,
totalPlugins,
});
},
startDownload({ commit, state }, name) {
const totalPlugins = JSON.parse(JSON.stringify(state.totalPlugins));
totalPlugins.forEach(
(origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = true;
}
totalPlugins.forEach((origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = true;
}
);
commit("commonUpdate", {
});
commit('commonUpdate', {
totalPlugins,
});
},
startUnDownload({ commit, state }, name) {
const localPlugins = window.market.getLocalPlugins();
localPlugins.forEach(
(origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = true;
}
localPlugins.forEach((origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = true;
}
);
commit("commonUpdate", {
});
commit('commonUpdate', {
localPlugins,
});
},
errorUnDownload({ commit, state }, name) {
const localPlugins = window.market.getLocalPlugins();
// 修复卸载失败,一直转圈的问题。
localPlugins.forEach((origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = false;
}
});
commit('commonUpdate', {
localPlugins,
});
},
successDownload({ commit, state }, name) {
const totalPlugins = JSON.parse(JSON.stringify(state.totalPlugins));
totalPlugins.forEach(
(origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = false;
origin.isdownload = true;
}
totalPlugins.forEach((origin: Market.Plugin) => {
if (origin.name === name) {
origin.isloading = false;
origin.isdownload = true;
}
);
});
const localPlugins = window.market.getLocalPlugins();
commit("commonUpdate", {
commit('commonUpdate', {
totalPlugins,
localPlugins,
});
},
async updateLocalPlugin({ commit }) {
const localPlugins = window.market.getLocalPlugins();
const totalPlugins = await request.getTotalPlugins();
totalPlugins.forEach(
(origin: Market.Plugin) => {
origin.isdownload = isDownload(origin, localPlugins);
origin.isloading = false;
}
);
totalPlugins.forEach((origin: Market.Plugin) => {
origin.isdownload = isDownload(origin, localPlugins);
origin.isloading = false;
});
commit("commonUpdate", {
commit('commonUpdate', {
localPlugins,
totalPlugins,
});

View File

@ -117,6 +117,7 @@ import { computed, ref, toRaw } from 'vue';
import path from 'path';
import MarkdownIt from 'markdown-it';
import { PlusCircleOutlined, MinusCircleOutlined } from '@ant-design/icons-vue';
import { message } from 'ant-design-vue';
const { ipcRenderer } = window.require('electron');
@ -135,6 +136,7 @@ const localPlugins = computed(() =>
);
const updateLocalPlugin = () => store.dispatch('updateLocalPlugin');
const startUnDownload = (name) => store.dispatch('startUnDownload', name);
const errorUnDownload = (name) => store.dispatch('errorUnDownload', name);
const currentSelect = ref([0]);
@ -148,7 +150,7 @@ const superPanelPlugins = ref(
_id: 'super-panel-plugins',
}
);
console.log(toRaw(superPanelPlugins.value.data));
const addCmdToSuperPanel = ({ cmd, code }) => {
const plugin = {
...toRaw(pluginDetail.value),
@ -218,8 +220,13 @@ const readme = computed(() => {
const deletePlugin = async (plugin) => {
startUnDownload(plugin.name);
const timer = setTimeout(() => {
errorUnDownload(plugin.name);
message.error('卸载超时,请重试!');
}, 20000);
await window.market.deletePlugin(plugin);
updateLocalPlugin();
clearTimeout(timer);
};
</script>

View File

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

View File

@ -1 +1 @@
body,html{margin:0;padding:0;font-family:system-ui,PingFang SC,Helvetica Neue,Microsoft Yahei,sans-serif;-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:hidden}.detach{width:100%;height:60px;color:var(--color-text-primary);flex:1;display:flex;align-items:center;font-size:18px;padding-left:10px;font-weight:500;box-sizing:border-box;justify-content:space-between}.detach.darwin{padding-left:80px}.detach.darwin,.detach.win32{-webkit-app-region:drag}.detach img{width:36px;height:36px;margin-right:10px}.detach input{background-color:var(--color-body-bg);color:var(--color-text-primary);width:360px;height:36px;line-height:36px;border-radius:4px;font-size:14px;border:none;padding:0 10px;outline:none;-webkit-app-region:no-drag}.detach input::-webkit-input-placeholder{color:#aaa;-webkit-user-select:none;user-select:none}.detach .info{display:flex;align-items:center}.handle{display:flex;-webkit-app-region:no-drag}.handle>div{width:36px;height:36px;border-radius:18px;cursor:pointer;margin-right:6px}.handle>div:hover{background-color:#dee2e6}.handle .devtool{background:50% no-repeat url(../img/tool.4b0524aa.svg)}.handle-container,.window-handle{display:flex;align-items:center}.window-handle>div{width:48px;height:56px;cursor:pointer}.window-handle>div:hover{background-color:#dee2e6}.window-handle .minimize{background:50%/20px no-repeat url(../img/minimize.384634d1.svg)}.window-handle .maximize{background:50%/20px no-repeat url(../img/maximize.f11a5dfe.svg)}.window-handle .unmaximize{background:50%/20px no-repeat url(../img/unmaximize.36583168.svg)}.window-handle .close{background:50%/20px no-repeat url(../img/close.cc2cafaa.svg)}.window-handle .close:hover{background-color:#e53935!important;background-image:url(../img/close-hover.c92ca454.svg)!important}:root{--color-text-primary:rgba(0,0,0,0.85);--color-text-content:#141414;--color-text-desc:rgba(0,0,0,0.45);--color-body-bg:#fff;--color-menu-bg:#f3efef;--color-list-hover:#e2e2e2;--color-input-hover:#fff;--color-border-light:#f0f0f0}.dark{--color-text-primary:#e8e8f0;--color-text-content:#ccccd8;--color-text-desc:#8f8fa6;--color-body-bg:#1c1c28;--color-menu-bg:#1c1c28;--color-list-hover:#33333d;--color-input-hover:#33333d;--color-border-light:#33333d}
body,html{margin:0;padding:0;font-family:system-ui,PingFang SC,Helvetica Neue,Microsoft Yahei,sans-serif;-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:hidden}.detach{width:100%;height:60px;color:var(--color-text-primary);flex:1;display:flex;align-items:center;font-size:18px;padding-left:10px;font-weight:500;box-sizing:border-box;justify-content:space-between}.detach.darwin{padding-left:80px}.detach.darwin,.detach.win32{-webkit-app-region:drag}.detach img{width:36px;height:36px;margin-right:10px}.detach input{background-color:var(--color-body-bg);color:var(--color-text-primary);width:360px;height:36px;line-height:36px;border-radius:4px;font-size:14px;border:none;padding:0 10px;outline:none;-webkit-app-region:no-drag}.detach input::-webkit-input-placeholder{color:#aaa;-webkit-user-select:none;user-select:none}.detach .info{display:flex;align-items:center}.handle{display:flex;-webkit-app-region:no-drag}.handle>div{width:36px;height:36px;border-radius:18px;cursor:pointer;margin-right:6px}.handle>div:hover{background-color:#dee2e6}.handle .devtool{background:50% no-repeat url(../img/tool.4b0524aa.svg)}.handle-container,.window-handle{display:flex;align-items:center}.window-handle{-webkit-app-region:no-drag}.window-handle>div{width:48px;height:56px;cursor:pointer}.window-handle>div:hover{background-color:#dee2e6}.window-handle .minimize{background:50%/20px no-repeat url(../img/minimize.384634d1.svg)}.window-handle .maximize{background:50%/20px no-repeat url(../img/maximize.f11a5dfe.svg)}.window-handle .unmaximize{background:50%/20px no-repeat url(../img/unmaximize.36583168.svg)}.window-handle .close{background:50%/20px no-repeat url(../img/close.cc2cafaa.svg)}.window-handle .close:hover{background-color:#e53935!important;background-image:url(../img/close-hover.c92ca454.svg)!important}:root{--color-text-primary:rgba(0,0,0,0.85);--color-text-content:#141414;--color-text-desc:rgba(0,0,0,0.45);--color-body-bg:#fff;--color-menu-bg:#f3efef;--color-list-hover:#e2e2e2;--color-input-hover:#fff;--color-border-light:#f0f0f0}.dark{--color-text-primary:#e8e8f0;--color-text-content:#ccccd8;--color-text-desc:#8f8fa6;--color-body-bg:#1c1c28;--color-menu-bg:#1c1c28;--color-list-hover:#33333d;--color-input-hover:#33333d;--color-border-light:#33333d}

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>detach</title><link href="css/app.63fbfd69.css" rel="preload" as="style"><link href="js/app.9ca10dbc.js" rel="preload" as="script"><link href="js/chunk-vendors.f7d8e91b.js" rel="preload" as="script"><link href="css/app.63fbfd69.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.f7d8e91b.js"></script><script src="js/app.9ca10dbc.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>detach</title><link href="css/app.65d55ce4.css" rel="preload" as="style"><link href="js/app.7471434d.js" rel="preload" as="script"><link href="js/chunk-vendors.29c10bf6.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.29c10bf6.js"></script><script src="js/app.7471434d.js"></script></body></html>

View File

@ -0,0 +1,2 @@
(function(e){function t(t){for(var c,o,l=t[0],a=t[1],i=t[2],p=0,d=[];p<l.length;p++)o=l[p],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&d.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(d.length)d.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")},"0980":function(e,t,n){},4011: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};var s={__name:"App",setup(e){const{ipcRenderer:t}=window.require("electron"),n=Object(c["f"])(window.process.platform),r=Object(c["f"])(!1),s=localStorage.getItem("rubick-system-detach")||"{}",p=Object(c["f"])({});window.initDetach=e=>{p.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(s))}catch(O){}const d=u()(e=>{t.send("msg-trigger",{type:"detachInputChange",data:{text:e.target.value}})},500),b=()=>{t.send("msg-trigger",{type:"openPluginDevTools"})},v=()=>{t.send("detach:service",{type:"minimize"})},f=()=>{t.send("detach:service",{type:"maximize"})},h=()=>{t.send("detach:service",{type:"close"})};return Object.assign(window,{setSubInputValue:({value:e})=>{p.value.subInput.value=e},setSubInput:e=>{p.value.subInput.placeholder=e},removeSubInput:()=>{p.value.subInput=null}}),(e,t)=>{var u,s;return Object(c["e"])(),Object(c["b"])("div",{class:Object(c["d"])([n.value,"detach"])},[Object(c["c"])("div",o,[Object(c["c"])("img",{src:p.value.logo},null,8,l),r.value?(Object(c["e"])(),Object(c["b"])("input",{key:0,autofocus:"",onInput:t[0]||(t[0]=(...e)=>Object(c["h"])(d)&&Object(c["h"])(d)(...e)),value:null===(u=p.value.subInput)||void 0===u?void 0:u.value,placeholder:null===(s=p.value.subInput)||void 0===s?void 0:s.placeholder},null,40,a)):(Object(c["e"])(),Object(c["b"])("span",i,Object(c["g"])(p.value.pluginName),1))]),Object(c["c"])("div",{class:"handle-container"},[Object(c["c"])("div",{class:"handle"},[Object(c["c"])("div",{class:"devtool",onClick:b,title:"开发者工具"})]),Object(c["c"])("div",{class:"window-handle"},[Object(c["c"])("div",{class:"minimize",onClick:v}),Object(c["c"])("div",{class:"maximize",onClick:f}),Object(c["c"])("div",{class:"close",onClick:h})])])],2)}}};n("d648");const p=s;var d=p;n("4011");Object(c["a"])(d).mount("#app")},d648:function(e,t,n){"use strict";n("0980")}});
//# sourceMappingURL=app.7471434d.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,2 +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")},"39c7":function(e,t,n){},4011: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=Object(c["g"])(window.process.platform),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"])([n.value,"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"!==n.value?(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("d305");const b=p;var v=b;n("4011");Object(c["a"])(v).mount("#app")},d305:function(e,t,n){"use strict";n("39c7")}});
//# sourceMappingURL=app.9ca10dbc.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long