add dist for assistant base
This commit is contained in:
@@ -46,6 +46,26 @@ export const loadMenu = () => {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'note',
|
||||
click: () => {
|
||||
// 获取当前window
|
||||
const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
if (mainWindow) {
|
||||
checkShowPage(mainWindow, '/web/note');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'root-center',
|
||||
click: () => {
|
||||
// 获取当前window
|
||||
const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
if (mainWindow) {
|
||||
checkShowPage(mainWindow, '/root/center');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '打开配置',
|
||||
click: async () => {
|
||||
|
||||
@@ -61,6 +61,9 @@ export const createProcess = async () => {
|
||||
if (msg.type === 'fork') {
|
||||
resolve({ process: assistantProcess, port: msg.data?.port || processConfig.port });
|
||||
}
|
||||
if (msg.type === 'reload') {
|
||||
restartProcess();
|
||||
}
|
||||
}
|
||||
});
|
||||
assistantProcess.on('error', (error) => {
|
||||
@@ -75,7 +78,9 @@ export const createProcess = async () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const restartProcess = async () => {
|
||||
await createProcess();
|
||||
};
|
||||
export const closeProcess = () => {
|
||||
log.info('closeProcess');
|
||||
removeProcessPid();
|
||||
|
||||
@@ -5,7 +5,13 @@ import { BrowserWindow } from 'electron';
|
||||
import { getOrigin } from '@/main/process/index.ts';
|
||||
import { createWinodw } from './create-window.ts';
|
||||
|
||||
export const checkShowPage = async (window?: BrowserWindow) => {
|
||||
/**
|
||||
*
|
||||
* @param window
|
||||
* @param openUrl /web/note
|
||||
* @returns
|
||||
*/
|
||||
export const checkShowPage = async (window?: BrowserWindow, openUrl?: string) => {
|
||||
const assistantConfig = getCacheAssistantConfig();
|
||||
const { pageApi, proxy, loadURL } = assistantConfig;
|
||||
if (!pageApi) {
|
||||
@@ -16,6 +22,11 @@ export const checkShowPage = async (window?: BrowserWindow) => {
|
||||
}
|
||||
window = createWinodw(window);
|
||||
let defaultURL = getOrigin() + '/web/note/';
|
||||
if (openUrl) {
|
||||
defaultURL = getOrigin() + openUrl;
|
||||
window?.loadURL(defaultURL);
|
||||
return window;
|
||||
}
|
||||
if (loadURL) {
|
||||
const url = new URL(loadURL, getOrigin());
|
||||
const urls = url.pathname.split('/');
|
||||
|
||||
Reference in New Issue
Block a user