From 4ba62fb54140cb18d83325bec54bd92481dfa003 Mon Sep 17 00:00:00 2001 From: Toby <2287769986@qq.com> Date: Sat, 7 Jun 2025 21:55:27 +0800 Subject: [PATCH 1/3] fix: remoteUrl and init --- src/main/engine.ts | 4 +++- src/renderer/components/commands-runner.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/engine.ts b/src/main/engine.ts index c85ae380..9f014f14 100644 --- a/src/main/engine.ts +++ b/src/main/engine.ts @@ -59,7 +59,9 @@ export class TachybaseEngine { 'ENGINE_PATH, ENGINE_WORKING_DIR, and APP_PORT must be set', ); } - remoteUrl = `http://localhost:${appPort}`; + if (!remoteUrl) { + remoteUrl = `http://localhost:${appPort}`; + } env.NODE_MODULES_PATH = path.join(workingDir, 'plugins/node_modules'); diff --git a/src/renderer/components/commands-runner.tsx b/src/renderer/components/commands-runner.tsx index 5ad25364..3331e616 100644 --- a/src/renderer/components/commands-runner.tsx +++ b/src/renderer/components/commands-runner.tsx @@ -22,7 +22,7 @@ export const Runner = observer( case 'initialization': { props.text = 'Stop'; try { - window.ElectronFiddle.startEngine(engineEnv); + // window.ElectronFiddle.startEngine(engineEnv); } catch (err) { this.props.appState.pushError(err.message, err); } From 3c525020a84bbfdf822a113a9ff57877ab43cebc Mon Sep 17 00:00:00 2001 From: Toby <2287769986@qq.com> Date: Thu, 19 Jun 2025 17:03:37 +0800 Subject: [PATCH 2/3] feat: autoHideMenuBar remote url --- src/main/engine.ts | 70 +++++++++++++++++++++++---------------------- src/main/windows.ts | 1 + 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/main/engine.ts b/src/main/engine.ts index 9f014f14..4d0ea598 100644 --- a/src/main/engine.ts +++ b/src/main/engine.ts @@ -1,4 +1,4 @@ -import { ChildProcessWithoutNullStreams, spawn } from 'node:child_process'; +import { ChildProcessWithoutNullStreams } from 'node:child_process'; import path from 'node:path'; import dotenv from 'dotenv'; @@ -13,7 +13,7 @@ import { IpcEvents } from '../ipc-events'; * enginePort 现在存的是完整的 url */ export class TachybaseEngine { - private engineStatus = 'initialization'; + private engineStatus = 'ready'; private enginePort = ''; private child: ChildProcessWithoutNullStreams | null = null; @@ -22,13 +22,15 @@ export class TachybaseEngine { event.returnValue = this.engineStatus + '|' + this.enginePort; }); - ipcMainManager.handle( - IpcEvents.ENGINE_START, - (_: IpcMainEvent, env: string) => this.start.bind(this)(env), - ); + // ipcMainManager.handle( + // IpcEvents.ENGINE_START, + // (_: IpcMainEvent, env: string) => this.start.bind(this)(env), + // ); ipcMainManager.handle(IpcEvents.ENGINE_STOP, (_: IpcMainEvent) => this.stop.bind(this)(), ); + + this.start(''); } async start(rawEnvString: string) { @@ -60,7 +62,7 @@ export class TachybaseEngine { ); } if (!remoteUrl) { - remoteUrl = `http://localhost:${appPort}`; + remoteUrl = `http://localhost:${appPort}/signin`; } env.NODE_MODULES_PATH = path.join(workingDir, 'plugins/node_modules'); @@ -88,33 +90,33 @@ export class TachybaseEngine { } }; - await checkRunning(); - - this.child = spawn(enginePath, ['start', '--quickstart'], { - cwd: workingDir, - env, - stdio: 'pipe', - }); - this.child.stdout.on('data', (data) => { - ipcMainManager.send(IpcEvents.ENGINE_STDOUT, [data.toString()]); - }); - - this.child.stderr.on('data', (data) => { - ipcMainManager.send(IpcEvents.ENGINE_STDERR, [data.toString()]); - }); - - this.child.on('error', (error) => { - console.error(`[Engine]: Error starting engine: ${error.message}`); - }); - - this.child.on('exit', (code) => { - console.log(`[Engine]: engine exited with code ${code}`); - - if (this.engineStatus !== 'stopped') { - this.engineStatus = 'stopped'; - ipcMainManager.send(IpcEvents.ENGINE_STATUS_CHANGED, ['stopped']); - } - }); + // await checkRunning(); + + // this.child = spawn(enginePath, ['start', '--quickstart'], { + // cwd: workingDir, + // env, + // stdio: 'pipe', + // }); + // this.child.stdout.on('data', (data) => { + // ipcMainManager.send(IpcEvents.ENGINE_STDOUT, [data.toString()]); + // }); + + // this.child.stderr.on('data', (data) => { + // ipcMainManager.send(IpcEvents.ENGINE_STDERR, [data.toString()]); + // }); + + // this.child.on('error', (error) => { + // console.error(`[Engine]: Error starting engine: ${error.message}`); + // }); + + // this.child.on('exit', (code) => { + // console.log(`[Engine]: engine exited with code ${code}`); + + // if (this.engineStatus !== 'stopped') { + // this.engineStatus = 'stopped'; + // ipcMainManager.send(IpcEvents.ENGINE_STATUS_CHANGED, ['stopped']); + // } + // }); } async stop() { diff --git a/src/main/windows.ts b/src/main/windows.ts index 7eb8b145..896cdd81 100644 --- a/src/main/windows.ts +++ b/src/main/windows.ts @@ -60,6 +60,7 @@ export function getMainWindowOptions(): Electron.BrowserWindowConstructorOptions ? path.join(process.cwd(), './.webpack/renderer/main_window/preload.js') : MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY, }, + autoHideMenuBar: true, // 自动隐藏菜单栏,按Alt键显示 }; } From 16daf0b194ed7c0b05758b9a89df18889660f436 Mon Sep 17 00:00:00 2001 From: "bai.zixv" <602250248@qq.com> Date: Fri, 27 Jun 2025 16:10:44 +0800 Subject: [PATCH 3/3] fix: hide console output --- src/renderer/components/output.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/output.tsx b/src/renderer/components/output.tsx index 084823a1..ed6c91ac 100644 --- a/src/renderer/components/output.tsx +++ b/src/renderer/components/output.tsx @@ -230,7 +230,7 @@ export const Output = observer(
); }