mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-09 01:17:06 +08:00
add the exit logic of read no reply auto reminder
This commit is contained in:
@@ -275,6 +275,13 @@ export default function initIpc() {
|
|||||||
ipcMain.handle('stop-geek-auto-start-chat-with-boss', async () => {
|
ipcMain.handle('stop-geek-auto-start-chat-with-boss', async () => {
|
||||||
mainWindow?.webContents.send('geek-auto-start-chat-with-boss-stopping')
|
mainWindow?.webContents.send('geek-auto-start-chat-with-boss-stopping')
|
||||||
subProcessOfPuppeteer?.kill()
|
subProcessOfPuppeteer?.kill()
|
||||||
|
setTimeout(() => {
|
||||||
|
try {
|
||||||
|
subProcessOfPuppeteer?.kill('SIGKILL')
|
||||||
|
} catch {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
let subProcessOfBossZhipinLoginPageWithPreloadExtension: ChildProcess | null = null
|
let subProcessOfBossZhipinLoginPageWithPreloadExtension: ChildProcess | null = null
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export async function bootstrap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function launchBoss(browser: Browser) {
|
export async function launchBoss(browser: Browser) {
|
||||||
const page = await browser.newPage()
|
const page = (await browser.pages())[0]
|
||||||
//set cookies
|
//set cookies
|
||||||
for (let i = 0; i < bossCookies.length; i++) {
|
for (let i = 0; i < bossCookies.length; i++) {
|
||||||
await page.setCookie(bossCookies[i])
|
await page.setCookie(bossCookies[i])
|
||||||
@@ -35,6 +35,11 @@ export async function launchBoss(browser: Browser) {
|
|||||||
await setDomainLocalStorage(browser, localStoragePageUrl, bossLocalStorage)
|
await setDomainLocalStorage(browser, localStoragePageUrl, bossLocalStorage)
|
||||||
await Promise.all([page.goto(bossChatUiUrl, { timeout: 0 }), page.waitForNavigation()])
|
await Promise.all([page.goto(bossChatUiUrl, { timeout: 0 }), page.waitForNavigation()])
|
||||||
pageMapByName['boss'] = page
|
pageMapByName['boss'] = page
|
||||||
page.once('close', () => (pageMapByName['boss'] = null))
|
page.once('close', () => {
|
||||||
|
pageMapByName['boss'] = null
|
||||||
|
const cp = browser.process()
|
||||||
|
cp?.kill()
|
||||||
|
process.exit(0)
|
||||||
|
})
|
||||||
return page
|
return page
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user