macOS 上 ad-hoc 签名无法通过 ShipIt 的 kSecCSStrictValidate 校验, 导致热更新始终失败。在获取 Apple 开发者证书之前,暂时禁用 native auto-updater,改为 browser-mode 检查 GitHub Releases API: - electron/updater.ts: 注释掉 electron-updater 逻辑,initAutoUpdater 和 setUpdaterWindow 改为 no-op - electron/preload.ts: 注释掉 updater IPC bridge,前端不再暴露 window.electronAPI.updater - AppShell.tsx: isNativeUpdater 硬编码为 false,移除 native IPC 订阅 和 native check/download/quitAndInstall 逻辑;保留 browser-mode 的 GitHub API 检查(mount 时 + 每 8 小时),发现新版本时弹窗引导 用户跳转 GitHub Release 页面下载 设置页 UpdateCard 保持不变:「检查更新」按钮通过 /api/app/updates 查询 GitHub,有新版本时显示「查看发布」按钮跳转下载。 TODO: 获取 Apple 开发者证书后,取消注释恢复 native auto-updater。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 lines
1.8 KiB
TypeScript
42 lines
1.8 KiB
TypeScript
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
versions: {
|
|
electron: process.versions.electron,
|
|
node: process.versions.node,
|
|
chrome: process.versions.chrome,
|
|
},
|
|
shell: {
|
|
openPath: (folderPath: string) => ipcRenderer.invoke('shell:open-path', folderPath),
|
|
},
|
|
dialog: {
|
|
openFolder: (options?: { defaultPath?: string; title?: string }) =>
|
|
ipcRenderer.invoke('dialog:open-folder', options),
|
|
},
|
|
install: {
|
|
checkPrerequisites: () => ipcRenderer.invoke('install:check-prerequisites'),
|
|
start: (options?: { includeNode?: boolean }) => ipcRenderer.invoke('install:start', options),
|
|
cancel: () => ipcRenderer.invoke('install:cancel'),
|
|
getLogs: () => ipcRenderer.invoke('install:get-logs'),
|
|
onProgress: (callback: (data: unknown) => void) => {
|
|
const listener = (_event: unknown, data: unknown) => callback(data);
|
|
ipcRenderer.on('install:progress', listener);
|
|
return () => { ipcRenderer.removeListener('install:progress', listener); };
|
|
},
|
|
},
|
|
// Native auto-updater bridge — disabled (code signature issues on macOS).
|
|
// Users are directed to download from GitHub Releases.
|
|
// TODO: Re-enable after obtaining Apple Developer certificate.
|
|
// updater: {
|
|
// checkForUpdates: () => ipcRenderer.invoke('updater:check'),
|
|
// downloadUpdate: () => ipcRenderer.invoke('updater:download'),
|
|
// quitAndInstall: () => ipcRenderer.invoke('updater:quit-and-install'),
|
|
// onStatus: (callback: (data: unknown) => void) => {
|
|
// const listener = (_event: unknown, data: unknown) => callback(data);
|
|
// ipcRenderer.on('updater:status', listener);
|
|
// return () => { ipcRenderer.removeListener('updater:status', listener); };
|
|
// },
|
|
// },
|
|
});
|