支持ui插件下载&运行

This commit is contained in:
muwoo
2021-12-02 17:55:45 +08:00
parent c2f43bea39
commit 0132a11d7e
32 changed files with 951 additions and 244 deletions

View File

@@ -9,7 +9,7 @@ export default () => {
const createWindow = async () => {
win = new BrowserWindow({
height: 600,
height: 60,
useContentSize: true,
resizable: true,
width: 800,

View File

@@ -12,31 +12,22 @@ export default () => {
const createWindow = (plugin) => {
win = new BrowserWindow({
autoHideMenuBar: true,
width: 800,
height: 800,
width: 850,
height: 700,
alwaysOnTop: true,
resizable: false,
focusable: true,
show: false,
webPreferences: {
enableRemoteModule: true,
webSecurity: false,
nodeIntegration: true,
contextIsolation: false,
devTools: true,
webviewTag: true,
preload: `${__static}/preload.js`,
},
});
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL("http://localhost:8081" as string);
} else {
// Load the index.html when not in development
win.loadURL(`file://${__static}/runner/index.html`);
}
win.webContents.on("dom-ready", () => {
win.webContents.executeJavaScript(`window.setPluginInfo(${JSON.stringify(plugin)})`);
});
win.loadURL(plugin.indexPath);
win.once("ready-to-show", () => {
win.show();

View File

@@ -8,7 +8,6 @@ const API: any = {
win.setSize(800, height || 60);
},
openPlugin({plugin}) {
console.log(plugin);
runnerInstance.init(plugin);
},
};

View File

@@ -5,6 +5,7 @@ import commonConst from "../common/utils/commonConst";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import API from "./common/api";
import "../common/utils/localPlugin";
class App {
private windowCreator: { init: () => void; getWindow: () => BrowserWindow };