mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 00:47:15 +08:00
add launch login page button. when user click it, will open the login page
This commit is contained in:
@@ -35,7 +35,7 @@ if (!fs.existsSync(extensionDir)) {
|
|||||||
const editThisCookieZipPath = path.join(__dirname, 'extensions', 'EditThisCookie.zip')
|
const editThisCookieZipPath = path.join(__dirname, 'extensions', 'EditThisCookie.zip')
|
||||||
const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
||||||
|
|
||||||
async function main() {
|
export async function main() {
|
||||||
if (!fs.existsSync(
|
if (!fs.existsSync(
|
||||||
path.join(editThisCookieExtensionPath, 'manifest.json')
|
path.join(editThisCookieExtensionPath, 'manifest.json')
|
||||||
)) {
|
)) {
|
||||||
@@ -80,5 +80,3 @@ async function main() {
|
|||||||
const { dispose: disposeNavigation } = await blockNavigation(page, (req) => !req.url().startsWith('https://www.zhipin.com'))
|
const { dispose: disposeNavigation } = await blockNavigation(page, (req) => !req.url().startsWith('https://www.zhipin.com'))
|
||||||
await page.goto('https://www.zhipin.com/web/user/');
|
await page.goto('https://www.zhipin.com/web/user/');
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
|
||||||
@@ -14,7 +14,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
externalizeDepsPlugin({
|
externalizeDepsPlugin({
|
||||||
exclude: ['@geekgeekrun/geek-auto-start-chat-with-boss', '@geekgeekrun/dingtalk-plugin', '@geekgeekrun/utils', 'find-chrome-bin']
|
exclude: ['@geekgeekrun/geek-auto-start-chat-with-boss', '@geekgeekrun/dingtalk-plugin', '@geekgeekrun/utils', 'find-chrome-bin', '@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension']
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"dev": "electron-vite dev",
|
"dev": "electron-vite dev",
|
||||||
"dev:geek-auto-start-chat-with-boss-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=geekAutoStartWithBoss electron-vite dev",
|
"dev:geek-auto-start-chat-with-boss-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=geekAutoStartWithBoss electron-vite dev",
|
||||||
"dev:check-and-download-dependencies-for-init-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=checkAndDownloadDependenciesForInit electron-vite dev",
|
"dev:check-and-download-dependencies-for-init-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=checkAndDownloadDependenciesForInit electron-vite dev",
|
||||||
|
"dev:launch-bosszhipin-login-page-with-preload-extension-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=launchBossZhipinLoginPageWithPreloadExtension electron-vite dev",
|
||||||
"build": "electron-vite build",
|
"build": "electron-vite build",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix",
|
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix",
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
"@electron-toolkit/utils": "^3.0.0",
|
"@electron-toolkit/utils": "^3.0.0",
|
||||||
"@geekgeekrun/dingtalk-plugin": "workspace:*",
|
"@geekgeekrun/dingtalk-plugin": "workspace:*",
|
||||||
"@geekgeekrun/geek-auto-start-chat-with-boss": "workspace:*",
|
"@geekgeekrun/geek-auto-start-chat-with-boss": "workspace:*",
|
||||||
|
"@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension": "workspace:*",
|
||||||
"@geekgeekrun/utils": "workspace:*",
|
"@geekgeekrun/utils": "workspace:*",
|
||||||
"@puppeteer/browsers": "^2.0.0",
|
"@puppeteer/browsers": "^2.0.0",
|
||||||
"JSONStream": "^1.3.5",
|
"JSONStream": "^1.3.5",
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { app } from 'electron'
|
||||||
|
import { main } from '@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension'
|
||||||
|
import { pipeWriteRegardlessError } from './utils/pipe'
|
||||||
|
|
||||||
|
export enum DOWNLOAD_ERROR_EXIT_CODE {
|
||||||
|
NO_ERROR = 0,
|
||||||
|
DOWNLOAD_ERROR = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export const launchBossZhipinLoginPageWithPreloadExtension = async () => {
|
||||||
|
process.on('disconnect', () => app.exit())
|
||||||
|
app.dock?.hide()
|
||||||
|
let pipe: null | fs.WriteStream = null
|
||||||
|
try {
|
||||||
|
pipe = fs.createWriteStream(null, { fd: 3 })
|
||||||
|
} catch {
|
||||||
|
console.warn('pipe is not available')
|
||||||
|
}
|
||||||
|
pipeWriteRegardlessError(
|
||||||
|
pipe,
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'INITIALIZE_PUPPETEER'
|
||||||
|
}) + '\r\n'
|
||||||
|
)
|
||||||
|
const { initPuppeteer } = await import('@geekgeekrun/geek-auto-start-chat-with-boss/index.mjs')
|
||||||
|
try {
|
||||||
|
await initPuppeteer()
|
||||||
|
pipeWriteRegardlessError(
|
||||||
|
pipe,
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'PUPPETEER_INITIALIZE_SUCCESSFULLY'
|
||||||
|
}) + '\r\n'
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
app.exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { runAutoChat } from './flow/GEEK_AUTO_START_CHAT_WITH_BOSS'
|
import { runAutoChat } from './flow/GEEK_AUTO_START_CHAT_WITH_BOSS'
|
||||||
import { openSettingWindow } from './flow/OPEN_SETTING_WINDOW'
|
import { openSettingWindow } from './flow/OPEN_SETTING_WINDOW'
|
||||||
import { checkAndDownloadDependenciesForInit } from './flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/index';
|
import { checkAndDownloadDependenciesForInit } from './flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/index'
|
||||||
|
import { launchBossZhipinLoginPageWithPreloadExtension } from './flow/LAUNCH_BOSS_ZHIPIN_LOGIN_PAGE_WITH_PRELOAD_EXTENSION'
|
||||||
|
|
||||||
const runMode = process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE
|
const runMode = process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE
|
||||||
switch (runMode) {
|
switch (runMode) {
|
||||||
@@ -12,6 +13,10 @@ switch (runMode) {
|
|||||||
checkAndDownloadDependenciesForInit()
|
checkAndDownloadDependenciesForInit()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
case 'launchBossZhipinLoginPageWithPreloadExtension': {
|
||||||
|
launchBossZhipinLoginPageWithPreloadExtension()
|
||||||
|
break
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
openSettingWindow()
|
openSettingWindow()
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -216,6 +216,30 @@ export function createMainWindow(): void {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let subProcessOfBossZhipinLoginPageWithPreloadExtension: ChildProcess | null = null
|
||||||
|
ipcMain.on('launch-bosszhipin-login-page-with-preload-extension', async () => {
|
||||||
|
if (subProcessOfBossZhipinLoginPageWithPreloadExtension) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const subProcessEnv = {
|
||||||
|
...process.env,
|
||||||
|
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'launchBossZhipinLoginPageWithPreloadExtension',
|
||||||
|
PUPPETEER_EXECUTABLE_PATH: (await getAnyAvailablePuppeteerExecutable())!.executablePath
|
||||||
|
}
|
||||||
|
subProcessOfBossZhipinLoginPageWithPreloadExtension = childProcess.spawn(
|
||||||
|
process.argv[0],
|
||||||
|
process.argv.slice(1),
|
||||||
|
{
|
||||||
|
env: subProcessEnv,
|
||||||
|
stdio: [null, null, null, 'pipe', 'ipc']
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
subProcessOfBossZhipinLoginPageWithPreloadExtension!.once('exit', () => {
|
||||||
|
subProcessOfBossZhipinLoginPageWithPreloadExtension = null
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
mainWindow!.once('closed', () => {
|
mainWindow!.once('closed', () => {
|
||||||
mainWindow = null
|
mainWindow = null
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<!-- <div>操作过程中,本程序缓存的 Boss直聘 Cookie 会被自动更新</div> -->
|
<!-- <div>操作过程中,本程序缓存的 Boss直聘 Cookie 会被自动更新</div> -->
|
||||||
<div>
|
<div>
|
||||||
您可
|
您可
|
||||||
<el-button size="small" type="primary" font-size-inherit
|
<el-button size="small" type="primary" font-size-inherit @click="launchLogin"
|
||||||
>点击此处打开BOSS直聘登录页</el-button
|
>点击此处打开BOSS直聘登录页</el-button
|
||||||
>,按照稍后的提示,使用EditThisCookie复制Cookie,并进行粘贴
|
>,按照稍后的提示,使用EditThisCookie复制Cookie,并进行粘贴
|
||||||
</div>
|
</div>
|
||||||
@@ -127,6 +127,10 @@ const handleExpectCompaniesInputBlur = (event) => {
|
|||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(',')
|
.join(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const launchLogin = () => {
|
||||||
|
electron.ipcRenderer.send('launch-bosszhipin-login-page-with-preload-extension')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Generated
+3
@@ -76,6 +76,9 @@ importers:
|
|||||||
'@geekgeekrun/geek-auto-start-chat-with-boss':
|
'@geekgeekrun/geek-auto-start-chat-with-boss':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../geek-auto-start-chat-with-boss
|
version: link:../geek-auto-start-chat-with-boss
|
||||||
|
'@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../launch-bosszhipin-login-page-with-preload-extension
|
||||||
'@geekgeekrun/utils':
|
'@geekgeekrun/utils':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../utils
|
version: link:../utils
|
||||||
|
|||||||
Reference in New Issue
Block a user