From d5b1f5fb1c1e2b4f7192977ac35aeee13763c5f6 Mon Sep 17 00:00:00 2001 From: H3CoF6 Date: Fri, 20 Mar 2026 00:56:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4pacman=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 3 --- package.json | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 094c15a..e70a39f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -151,7 +151,6 @@ jobs: MAC_ASSET="$(pick_asset "\\.dmg$")" LINUX_DEB_ASSET="$(pick_asset "\\.deb$")" LINUX_TAR_ASSET="$(pick_asset "\\.tar\\.gz$")" - LINUX_PACMAN_ASSET="$(pick_asset "\\.pacman$")" build_link() { local name="$1" @@ -164,7 +163,6 @@ jobs: MAC_URL="$(build_link "$MAC_ASSET")" LINUX_DEB_URL="$(build_link "$LINUX_DEB_ASSET")" LINUX_TAR_URL="$(build_link "$LINUX_TAR_ASSET")" - LINUX_PACMAN_URL="$(build_link "$LINUX_PACMAN_ASSET")" cat > release_notes.md < 如果某个平台链接暂时未生成,可进入完整发布页查看全部资源:$RELEASE_PAGE EOF diff --git a/package.json b/package.json index 4a784bf..b6ec942 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "linux": { "icon": "public/icon.png", "target": [ - "pacman", "deb", "tar.gz" ], From ba5a791b2dd26ffdff6d3d2f7461330a478dd888 Mon Sep 17 00:00:00 2001 From: cc <98377878+hicccc77@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:38:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Mac=E5=AF=86=E9=92=A5=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/keyServiceMac.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/electron/services/keyServiceMac.ts b/electron/services/keyServiceMac.ts index af33b75..79f9cdc 100644 --- a/electron/services/keyServiceMac.ts +++ b/electron/services/keyServiceMac.ts @@ -262,6 +262,7 @@ export class KeyServiceMac { ): Promise { const helperPath = this.getHelperPath() const waitMs = Math.max(timeoutMs, 30_000) + const timeoutSec = Math.ceil(waitMs / 1000) + 30 const pid = await this.getWeChatPid() onStatus?.(`已找到微信进程 PID=${pid},正在定位目标函数...`, 0) // 最佳努力清理同路径残留 helper(普通权限) @@ -378,12 +379,22 @@ export class KeyServiceMac { ): Promise { const helperPath = this.getHelperPath() const waitMs = Math.max(timeoutMs, 30_000) + const timeoutSec = Math.ceil(waitMs / 1000) + 30 const pid = await this.getWeChatPid() // 用 AppleScript 的 quoted form 组装命令,避免复杂 shell 拼接导致整条失败 + // 通过 try/on error 回传详细错误,避免只看到 "Command failed" const scriptLines = [ `set helperPath to ${JSON.stringify(helperPath)}`, - `set cmd to quoted form of helperPath & " ${pid} ${waitMs} 2>&1"`, - 'do shell script cmd with administrator privileges' + `set cmd to quoted form of helperPath & " ${pid} ${waitMs}"`, + `set timeoutSec to ${timeoutSec}`, + 'try', + 'with timeout of timeoutSec seconds', + 'set outText to do shell script cmd with administrator privileges', + 'end timeout', + 'return "WF_OK::" & outText', + 'on error errMsg number errNum partial result pr', + 'return "WF_ERR::" & errNum & "::" & errMsg & "::" & (pr as text)', + 'end try' ] onStatus?.('已准备就绪,现在登录微信或退出登录后重新登录微信', 0) @@ -400,6 +411,16 @@ export class KeyServiceMac { const lines = String(stdout).split(/\r?\n/).map(x => x.trim()).filter(Boolean) if (!lines.length) throw new Error('elevated helper returned empty output') + const joined = lines.join('\n') + + if (joined.startsWith('WF_ERR::')) { + const parts = joined.split('::') + const errNum = parts[1] || 'unknown' + const errMsg = parts[2] || 'unknown' + const partial = parts.slice(3).join('::') + throw new Error(`elevated helper failed: errNum=${errNum}, errMsg=${errMsg}, partial=${partial || '(empty)'}`) + } + const normalizedOutput = joined.startsWith('WF_OK::') ? joined.slice('WF_OK::'.length) : joined // 从所有行里提取所有 JSON 对象(同一行可能有多个拼接),找含 key/result 的那个 const extractJsonObjects = (s: string): any[] => { @@ -411,7 +432,7 @@ export class KeyServiceMac { } return results } - const fullOutput = lines.join('\n') + const fullOutput = normalizedOutput const allJson = extractJsonObjects(fullOutput) // 优先找 success=true && key 字段 const successPayload = allJson.find(p => p?.success === true && typeof p?.key === 'string')