Merge pull request #485 from H3CoF6/feat/linux

fix: 修复linux版本一些bug
This commit is contained in:
xuncha
2026-03-18 12:00:18 +08:00
committed by GitHub
4 changed files with 42 additions and 12 deletions

View File

@@ -17,6 +17,7 @@ import { annualReportService } from './services/annualReportService'
import { exportService, ExportOptions, ExportProgress } from './services/exportService' import { exportService, ExportOptions, ExportProgress } from './services/exportService'
import { KeyService } from './services/keyService' import { KeyService } from './services/keyService'
import { KeyServiceMac } from './services/keyServiceMac' import { KeyServiceMac } from './services/keyServiceMac'
import { KeyServiceLinux} from "./services/keyServiceLinux"
import { voiceTranscribeService } from './services/voiceTranscribeService' import { voiceTranscribeService } from './services/voiceTranscribeService'
import { videoService } from './services/videoService' import { videoService } from './services/videoService'
import { snsService, isVideoUrl } from './services/snsService' import { snsService, isVideoUrl } from './services/snsService'
@@ -95,7 +96,7 @@ let keyService: any
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
keyService = new KeyServiceMac() keyService = new KeyServiceMac()
} else if (process.platform === 'linux') { } else if (process.platform === 'linux') {
const { KeyServiceLinux } = require('./services/keyServiceLinux') // const { KeyServiceLinux } = require('./services/keyServiceLinux')
keyService = new KeyServiceLinux() keyService = new KeyServiceLinux()
} else { } else {
keyService = new KeyService() keyService = new KeyService()
@@ -280,12 +281,18 @@ const requestMainWindowCloseConfirmation = (win: BrowserWindow): void => {
function createWindow(options: { autoShow?: boolean } = {}) { function createWindow(options: { autoShow?: boolean } = {}) {
// 获取图标路径 - 打包后在 resources 目录 // 获取图标路径 - 打包后在 resources 目录
const { autoShow = true } = options const { autoShow = true } = options
let iconName = 'icon.ico';
if (process.platform === 'linux') {
iconName = 'icon.png';
} else if (process.platform === 'darwin') {
iconName = 'icon.icns';
}
const isDev = !!process.env.VITE_DEV_SERVER_URL const isDev = !!process.env.VITE_DEV_SERVER_URL
const iconPath = isDev const iconPath = isDev
? join(__dirname, '../public/icon.ico') ? join(__dirname, `../public/${iconName}`)
: (process.platform === 'darwin' : join(process.resourcesPath, iconName);
? join(process.resourcesPath, 'icon.icns')
: join(process.resourcesPath, 'icon.ico'))
const win = new BrowserWindow({ const win = new BrowserWindow({
width: 1400, width: 1400,
@@ -2533,12 +2540,20 @@ app.whenReady().then(async () => {
updateSplashProgress(30, '正在加载界面...') updateSplashProgress(30, '正在加载界面...')
mainWindow = createWindow({ autoShow: false }) mainWindow = createWindow({ autoShow: false })
// 初始化系统托盘图标(与其他窗口 icon 路径逻辑保持一致) let iconName = 'icon.ico';
const resolvedTrayIcon = process.platform === 'win32' if (process.platform === 'linux') {
? join(__dirname, '../public/icon.ico') iconName = 'icon.png';
: (process.platform === 'darwin' } else if (process.platform === 'darwin') {
? join(process.resourcesPath, 'icon.icns') iconName = 'icon.icns';
: join(process.resourcesPath, 'icon.ico')) }
const isDev = !!process.env.VITE_DEV_SERVER_URL
const resolvedTrayIcon = isDev
? join(__dirname, `../public/${iconName}`)
: join(process.resourcesPath, iconName);
try { try {
tray = new Tray(resolvedTrayIcon) tray = new Tray(resolvedTrayIcon)
tray.setToolTip('WeFlow') tray.setToolTip('WeFlow')

View File

@@ -551,6 +551,7 @@ export class WcdbCore {
const dllDir = dirname(dllPath) const dllDir = dirname(dllPath)
const isMac = process.platform === 'darwin' const isMac = process.platform === 'darwin'
const isLinux = process.platform === 'linux'
// 预加载依赖库 // 预加载依赖库
if (isMac) { if (isMac) {
@@ -564,6 +565,8 @@ export class WcdbCore {
this.writeLog(`预加载 libWCDB.dylib 失败: ${String(e)}`) this.writeLog(`预加载 libWCDB.dylib 失败: ${String(e)}`)
} }
} }
} else if (isLinux) {
// 如果有libWCDB.so的话 没有就算了
} else { } else {
const wcdbCorePath = join(dllDir, 'WCDB.dll') const wcdbCorePath = join(dllDir, 'WCDB.dll')
if (existsSync(wcdbCorePath)) { if (existsSync(wcdbCorePath)) {

View File

@@ -89,6 +89,18 @@
], ],
"icon": "public/icon.ico" "icon": "public/icon.ico"
}, },
"linux": {
"icon": "public/icon.png",
"target": [
"AppImage",
"pacman",
"deb",
"tar.gz"
],
"category": "Utility",
"executableName": "weflow",
"synopsis": "WeFlow for Linux"
},
"nsis": { "nsis": {
"oneClick": false, "oneClick": false,
"differentialPackage": false, "differentialPackage": false,
@@ -155,4 +167,4 @@
], ],
"icon": "resources/icon.icns" "icon": "resources/icon.icns"
} }
} }

BIN
public/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB