From 0816fafc02f1e0ba1ffd28afba10bf48903a40fc Mon Sep 17 00:00:00 2001 From: H3CoF6 Date: Thu, 19 Mar 2026 00:26:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(linux):=20=E4=BF=AE=E5=A4=8Dlinux?= =?UTF-8?q?=E4=B8=AD=EF=BC=8Crequire=E7=9A=84=E8=B7=AF=E5=BE=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/electron/main.ts b/electron/main.ts index b32882c..973c9a1 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -95,8 +95,13 @@ let keyService: any if (process.platform === 'darwin') { keyService = new KeyServiceMac() } else if (process.platform === 'linux') { - const { KeyServiceLinux } = require('./services/keyServiceLinux') - keyService = new KeyServiceLinux() + // const { KeyServiceLinux } = require('./services/keyServiceLinux') + // keyService = new KeyServiceLinux() + + import('./services/keyServiceLinux').then(({ KeyServiceLinux }) => { + keyService = new KeyServiceLinux(); + }); + } else { keyService = new KeyService() } From d45179a4b0bb1a55c1ed8fa139a3b61595baf586 Mon Sep 17 00:00:00 2001 From: H3CoF6 Date: Thu, 19 Mar 2026 01:56:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=20linux:=20=E6=94=BE=E5=BC=83=E6=89=93?= =?UTF-8?q?=E5=8C=85=E4=B8=BAAppImge=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 7ab669a..5c6fa56 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,6 @@ "linux": { "icon": "public/icon.png", "target": [ - "AppImage", "pacman", "deb", "tar.gz" From 7ffc0c3484b73f11b684d7e90a6c5a6dc5ee2cfc Mon Sep 17 00:00:00 2001 From: H3CoF6 Date: Thu, 19 Mar 2026 02:44:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dlinux=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=9B=BE=E7=89=87=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 5c6fa56..f68aacc 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,10 @@ "from": "public/icon.ico", "to": "icon.ico" }, + { + "from": "public/icon.png", + "to": "icon.png" + }, { "from": "electron/assets/wasm/", "to": "assets/wasm/" From ae6cd88d9e07654ec922c5a3a9f122e68849dcab Mon Sep 17 00:00:00 2001 From: H3CoF6 <1707889225@qq.com> Date: Thu, 19 Mar 2026 03:04:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dsudo-prompt?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/keyServiceLinux.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/electron/services/keyServiceLinux.ts b/electron/services/keyServiceLinux.ts index 14127ab..1d9e10b 100644 --- a/electron/services/keyServiceLinux.ts +++ b/electron/services/keyServiceLinux.ts @@ -3,7 +3,8 @@ import { join } from 'path' import { existsSync, readdirSync, statSync, readFileSync } from 'fs' import { execFile, exec } from 'child_process' import { promisify } from 'util' -import sudo from 'sudo-prompt' +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); const execFileAsync = promisify(execFile) const execAsync = promisify(exec) @@ -12,6 +13,15 @@ type DbKeyResult = { success: boolean; key?: string; error?: string; logs?: stri type ImageKeyResult = { success: boolean; xorKey?: number; aesKey?: string; error?: string } export class KeyServiceLinux { + private sudo: any + + constructor() { + try { + this.sudo = require('sudo-prompt'); + } catch (e) { + console.error('Failed to load sudo-prompt', e); + } + } private getHelperPath(): string { const isPackaged = app.isPackaged @@ -99,7 +109,7 @@ export class KeyServiceLinux { const options = { name: 'WeFlow' } const command = `"${helperPath}" db_hook ${pid} ${targetAddr}` - sudo.exec(command, options, (error, stdout) => { + this.sudo.exec(command, options, (error, stdout) => { execAsync(`kill -CONT ${pid}`).catch(() => {}) if (error) { onStatus?.('授权失败或被取消', 2)