mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 16:07:17 +08:00
change sqlite backend; upgrade electron; fix ipc file cannot listen in macOS
This commit is contained in:
+3
-12
@@ -38,18 +38,9 @@ if (!ipcSocketName) {
|
|||||||
process.env.GEEKGEEKRUND_PIPE_NAME = `geekgeekrun-d_${randomUUID()}`
|
process.env.GEEKGEEKRUND_PIPE_NAME = `geekgeekrun-d_${randomUUID()}`
|
||||||
ipcSocketName = process.env.GEEKGEEKRUND_PIPE_NAME
|
ipcSocketName = process.env.GEEKGEEKRUND_PIPE_NAME
|
||||||
}
|
}
|
||||||
let ipcSocketPath
|
const ipcSocketPath = process.platform === 'win32'
|
||||||
if (process.platform === 'win32') {
|
? `\\\\.\\pipe\\${ipcSocketName}`
|
||||||
ipcSocketPath = `\\\\.\\pipe\\${ipcSocketName}`
|
: path.join(tmpdir(), `${ipcSocketName}.sock`)
|
||||||
}
|
|
||||||
else {
|
|
||||||
ipcSocketPath = path.join(tmpdir(), `${ipcSocketName}.sock`)
|
|
||||||
if (process.platform === 'darwin' && !fs.existsSync(ipcSocketPath)) {
|
|
||||||
fs.writeFileSync(ipcSocketPath, '')
|
|
||||||
// 设置权限(Unix)
|
|
||||||
fs.chmodSync(ipcSocketPath, 0o777)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const workers = new Map(); // workerId -> { process, status, restartCount, socket, latestScreenshot, latestScreenshotAt }
|
const workers = new Map(); // workerId -> { process, status, restartCount, socket, latestScreenshot, latestScreenshotAt }
|
||||||
const guiClients = new Set(); // GUI客户端连接集合
|
const guiClients = new Set(); // GUI客户端连接集合
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
"cli-highlight": "^2.1.11",
|
"cli-highlight": "^2.1.11",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"reflect-metadata": "^0.2.1",
|
"reflect-metadata": "^0.2.1",
|
||||||
"sqlite3": "5.1.6",
|
"better-sqlite3": "12.6.2",
|
||||||
"typeorm": "0.3.11"
|
"typeorm": "0.3.28"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/lodash": "^4.17.23",
|
"@types/lodash": "^4.17.23",
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { ChatMessageRecord } from './entity/ChatMessageRecord'
|
|||||||
import { LlmModelUsageRecord } from './entity/LlmModelUsageRecord'
|
import { LlmModelUsageRecord } from './entity/LlmModelUsageRecord'
|
||||||
import { JobHireStatusRecord } from './entity/JobHireStatusRecord'
|
import { JobHireStatusRecord } from './entity/JobHireStatusRecord'
|
||||||
|
|
||||||
import sqlite3 from 'sqlite3';
|
|
||||||
import {
|
import {
|
||||||
saveChatStartupRecord,
|
saveChatStartupRecord,
|
||||||
saveJobInfoFromRecommendPage,
|
saveJobInfoFromRecommendPage,
|
||||||
@@ -45,12 +44,11 @@ import * as typeorm from 'typeorm'
|
|||||||
export function initDb(dbFilePath) {
|
export function initDb(dbFilePath) {
|
||||||
const { DataSource } = typeorm
|
const { DataSource } = typeorm
|
||||||
const appDataSource = new DataSource({
|
const appDataSource = new DataSource({
|
||||||
type: "sqlite",
|
type: "better-sqlite3",
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
logging: true,
|
logging: true,
|
||||||
logger: "simple-console",
|
logger: "simple-console",
|
||||||
database: dbFilePath,
|
database: dbFilePath,
|
||||||
driver: sqlite3, // The important line
|
|
||||||
entities: [
|
entities: [
|
||||||
ChatStartupLog,
|
ChatStartupLog,
|
||||||
BossInfo,
|
BossInfo,
|
||||||
|
|||||||
@@ -48,10 +48,10 @@
|
|||||||
"@electron-toolkit/eslint-config": "^1.0.2",
|
"@electron-toolkit/eslint-config": "^1.0.2",
|
||||||
"@electron-toolkit/eslint-config-ts": "^1.0.1",
|
"@electron-toolkit/eslint-config-ts": "^1.0.1",
|
||||||
"@electron-toolkit/tsconfig": "^1.0.1",
|
"@electron-toolkit/tsconfig": "^1.0.1",
|
||||||
"@inquirer/prompts": "^7.0.1",
|
|
||||||
"@inquirer/select": "^4.0.1",
|
|
||||||
"@geekgeekrun/dingtalk-plugin": "workspace:*",
|
"@geekgeekrun/dingtalk-plugin": "workspace:*",
|
||||||
"@geekgeekrun/geek-auto-start-chat-with-boss": "workspace:*",
|
"@geekgeekrun/geek-auto-start-chat-with-boss": "workspace:*",
|
||||||
|
"@inquirer/prompts": "^7.0.1",
|
||||||
|
"@inquirer/select": "^4.0.1",
|
||||||
"@puppeteer/browsers": "^2.11.0",
|
"@puppeteer/browsers": "^2.11.0",
|
||||||
"@rushstack/eslint-patch": "^1.7.1",
|
"@rushstack/eslint-patch": "^1.7.1",
|
||||||
"@types/lodash": "^4.17.23",
|
"@types/lodash": "^4.17.23",
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"@vue/eslint-config-typescript": "^12.0.0",
|
"@vue/eslint-config-typescript": "^12.0.0",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"electron": "28.2.0",
|
"electron": "39.2.7",
|
||||||
"electron-builder": "^24.9.1",
|
"electron-builder": "^24.9.1",
|
||||||
"electron-vite": "^2.0.0",
|
"electron-vite": "^2.0.0",
|
||||||
"element-plus": "^2.8.4",
|
"element-plus": "^2.8.4",
|
||||||
|
|||||||
@@ -19,13 +19,8 @@ export async function connectToDaemon() {
|
|||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
const ipcSocketName = process.env.GEEKGEEKRUND_PIPE_NAME
|
const ipcSocketName = process.env.GEEKGEEKRUND_PIPE_NAME
|
||||||
const ipcSocketPath = process.platform === 'win32'
|
const ipcSocketPath = process.platform === 'win32'
|
||||||
? `\\\\.\\pipe\\${ipcSocketName}`
|
? `\\\\.\\pipe\\${ipcSocketName}`
|
||||||
: path.join(tmpdir(), `${ipcSocketName}.sock`)
|
: path.join(tmpdir(), `${ipcSocketName}.sock`)
|
||||||
if (process.platform === 'darwin' && !fs.existsSync(ipcSocketPath)) {
|
|
||||||
fs.writeFileSync(ipcSocketPath, '')
|
|
||||||
// 设置权限(Unix)
|
|
||||||
fs.chmodSync(ipcSocketPath, 0o777)
|
|
||||||
}
|
|
||||||
daemonClient.connect(ipcSocketPath, 'localhost', () => {
|
daemonClient.connect(ipcSocketPath, 'localhost', () => {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
console.log('已连接到守护进程');
|
console.log('已连接到守护进程');
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const initDbWorker = () => {
|
|||||||
// attach more event
|
// attach more event
|
||||||
worker?.off('message', handler)
|
worker?.off('message', handler)
|
||||||
} else if (data.type === 'DB_INIT_FAIL') {
|
} else if (data.type === 'DB_INIT_FAIL') {
|
||||||
reject(undefined)
|
reject(data.error)
|
||||||
worker?.terminate()
|
worker?.terminate()
|
||||||
worker?.off('message', handler)
|
worker?.off('message', handler)
|
||||||
worker = null
|
worker = null
|
||||||
|
|||||||
Generated
+481
-558
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user