mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
add logic that launch auto start chat from render process
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { BrowserWindow, ipcMain, shell } from 'electron'
|
import { BrowserWindow, ipcMain, shell } from 'electron'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import * as childProcess from 'node:child_process'
|
||||||
import { is } from '@electron-toolkit/utils'
|
import { is } from '@electron-toolkit/utils'
|
||||||
import {
|
import {
|
||||||
readConfigFile,
|
readConfigFile,
|
||||||
@@ -7,6 +8,7 @@ import {
|
|||||||
ensureConfigFileExist,
|
ensureConfigFileExist,
|
||||||
writeConfigFile
|
writeConfigFile
|
||||||
} from '@bossgeekgo/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
} from '@bossgeekgo/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||||
|
import { ChildProcess } from 'child_process'
|
||||||
let mainWindow: BrowserWindow
|
let mainWindow: BrowserWindow
|
||||||
|
|
||||||
export function createMainWindow(): void {
|
export function createMainWindow(): void {
|
||||||
@@ -74,4 +76,19 @@ export function createMainWindow(): void {
|
|||||||
writeConfigFile('target-company-list.json', payload.expectCompanies.split(','))
|
writeConfigFile('target-company-list.json', payload.expectCompanies.split(','))
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// const currentExecutablePath = app.getPath('exe')
|
||||||
|
// console.log(currentExecutablePath)
|
||||||
|
|
||||||
|
let subProcessOfPuppeteer: ChildProcess
|
||||||
|
ipcMain.handle('run-geek-auto-start-chat-with-boss', async () => {
|
||||||
|
console.log(process)
|
||||||
|
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
MAIN_BOSSGEEKGO_RUN_MODE: 'geekAutoStartWithBoss'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(subProcessOfPuppeteer)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ const formRef = ref<InstanceType<typeof ElForm>>()
|
|||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value!.validate()
|
await formRef.value!.validate()
|
||||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||||
|
await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss', JSON.stringify(formContent.value))
|
||||||
}
|
}
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
await formRef.value!.validate()
|
await formRef.value!.validate()
|
||||||
|
|||||||
Reference in New Issue
Block a user