Skip to main content

Electron 31.0.0

· 7 min read

Electron 31.0.0 已发布!它包含对 Chromium 126.0.6478.36、V8 12.6 和 Node 20.14.0 的升级。

¥Electron 31.0.0 has been released! It includes upgrades to Chromium 126.0.6478.36, V8 12.6, and Node 20.14.0.


Electron 团队非常高兴地宣布 Electron 31.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 31.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

亮点

¥Highlights

  • 扩展 WebContentsView 以接受预先存在的 webContents 对象。#42319

    ¥Extended WebContentsView to accept pre-existing webContents object. #42319

  • 添加了对 NODE_EXTRA_CA_CERTS 的支持。#41689

    ¥Added support for NODE_EXTRA_CA_CERTS. #41689

  • 更新了 window.flashFrame(bool),使其在 macOS 上持续闪烁。#41391

    ¥Updated window.flashFrame(bool) to flash continuously on macOS. #41391

  • 移除 WebSQL 支持 #41868

    ¥Removed WebSQL support #41868

  • nativeImage.toDataURL 会保留 PNG 颜色空间 #41610

    ¥nativeImage.toDataURL will preserve PNG colorspace #41610

  • 扩展 webContents.setWindowOpenHandler 以支持手动创建 BrowserWindow。#41432

    ¥Extended webContents.setWindowOpenHandler to support manual creation of BrowserWindow. #41432

技术栈变更

¥Stack Changes

Electron 31 将 Chromium 从 124.0.6367.49 升级到 126.0.6478.36,将 Node 从 20.11.1 升级到 20.14.0,将 V8 从 12.4 升级到 12.6

¥Electron 31 upgrades Chromium from 124.0.6367.49 to 126.0.6478.36, Node from 20.11.1 to 20.14.0, and V8 from 12.4 to 12.6.

新功能

¥New Features

  • Session 添加了 clearData 方法。#40983

    ¥Added clearData method to Session. #40983

    • Session.clearData API 添加了 options 参数。#41355

      ¥Added options parameter to Session.clearData API. #41355

  • navigator.serial 中添加了对通过服务类别 ID 请求蓝牙端口的支持。#41638

    ¥Added support for Bluetooth ports being requested by service class ID in navigator.serial. #41638

  • 添加了对 Node 的 NODE_EXTRA_CA_CERTS 环境变量的支持。#41689

    ¥Added support for Node's NODE_EXTRA_CA_CERTS environment variable. #41689

  • 扩展 webContents.setWindowOpenHandler 以支持手动创建 BrowserWindow。#41432

    ¥Extended webContents.setWindowOpenHandler to support manual creation of BrowserWindow. #41432

  • 实现了对 Web 标准 文件系统 API 的支持。#41419

    ¥Implemented support for the web standard File System API. #41419

  • 扩展 WebContentsView 以接受预先存在的 WebContents 实例。#42319

    ¥Extended WebContentsView to accept pre-existing WebContents instances. #42319

  • 在 webContents API 中,通过 navigationHistory.getEntryAtIndex 方法添加了新的实例属性 navigationHistory,使应用能够检索浏览历史记录中任何导航条目的 URL 和标题。#41577 2930 中也支持)

    ¥Added a new instance property navigationHistory on webContents API with navigationHistory.getEntryAtIndex method, enabling applications to retrieve the URL and title of any navigation entry within the browsing history. #41577 (Also in 29, 30)

重大变化

¥Breaking Changes

删除:WebSQL 支持

¥Removed: WebSQL support

Chromium 已删除对 WebSQL 上游的支持,仅将其转换为 Android。请参阅 Chromium 有意删除讨论 了解更多信息。

¥Chromium has removed support for WebSQL upstream, transitioning it to Android only. See Chromium's intent to remove discussion for more information.

行为改变:nativeImage.toDataURL 将保留 PNG 色彩空间

¥Behavior Changed: nativeImage.toDataURL will preseve PNG colorspace

PNG 解码器实现已更改,以保留色彩空间数据。此函数返回的编码数据现在与其匹配。

¥PNG decoder implementation has been changed to preserve colorspace data. The encoded data returned from this function now matches it.

请参阅 crbug.com/332584706 了解更多信息。

¥See crbug.com/332584706 for more information.

行为改变:win.flashFrame(bool) 将在 macOS 上持续闪烁 Dock 图标

¥Behavior Changed: win.flashFrame(bool) will flash dock icon continuously on macOS

这使行为与 Windows 和 Linux 保持一致。先前行为:第一个 flashFrame(true) 仅弹跳一次停靠图标(使用 NSInformationalRequest 级别),flashFrame(false) 不执行任何操作。新行为:持续闪烁,直到调用 flashFrame(false)。这改为使用 NSCriticalRequest 级别。要明确使用 NSInformationalRequest 来引起单个停靠图标弹跳,仍然可以使用 dock.bounce('informational')

¥This brings the behavior to parity with Windows and Linux. Prior behavior: The first flashFrame(true) bounces the dock icon only once (using the NSInformationalRequest level) and flashFrame(false) does nothing. New behavior: Flash continuously until flashFrame(false) is called. This uses the NSCriticalRequest level instead. To explicitly use NSInformationalRequest to cause a single dock icon bounce, it is still possible to use dock.bounce('informational').

28.x.y 支持终止

¥End of Support for 28.x.y

Electron 28.x.y 已根据项目 支持政策 终止支持。建议开发者和应用升级到较新版本的 Electron。

¥Electron 28.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E31 (2024 年 6 月)E32 (2024 年 8 月)E33 (2024 年 10 月)
31.x.y32.x.y33.x.y
30.x.y31.x.y32.x.y
28.x.y29.x.y31.x.y

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.

Electron 30.0.0

· 9 min read

Electron 30.0.0 已发布!它包含对 Chromium 124.0.6367.49、V8 12.4 和 Node.js 20.11.1 的升级。

¥Electron 30.0.0 has been released! It includes upgrades to Chromium 124.0.6367.49, V8 12.4, and Node.js 20.11.1.


Electron 团队非常高兴地宣布 Electron 30.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 30.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

亮点

¥Highlights

  • ASAR Integrity fuse 现已支持 Windows (#40504)

    ¥ASAR Integrity fuse now supported on Windows (#40504)

    • 如果配置不正确,启用 ASAR Integrity 的现有应用可能无法在 Windows 上运行。使用 Electron 打包工具的应用应升级到 @electron/packager@18.3.1@electron/forge@7.4.0

      ¥Existing apps with ASAR Integrity enabled may not work on Windows if not configured correctly. Apps using Electron packaging tools should upgrade to @electron/packager@18.3.1 or @electron/forge@7.4.0.

    • 查看我们的 ASAR 完整性教程 了解更多信息。

      ¥Take a look at our ASAR Integrity tutorial for more information.

  • 添加了 WebContentsViewBaseWindow 主进程模块,弃用并替换了 BrowserView (#35658)。了解更多关于如何在 这篇博文 中从 BrowserView 迁移到 WebContentsView 的信息。

    ¥Added WebContentsView and BaseWindow main process modules, deprecating & replacing BrowserView (#35658). Learn more about how to migrate from BrowserView to WebContentsView in this blog post.

    • BrowserView 现在是 WebContentsView 的垫片,旧的实现已被移除。

      ¥BrowserView is now a shim over WebContentsView and the old implementation has been removed.

    • 请参阅 我们的 Web Embeds 文档,了解新的 WebContentsView API 与其他类似 API 的比较。

      ¥See our Web Embeds documentation for a comparison of the new WebContentsView API to other similar APIs.

  • 实现了对 文件系统 API#41827)的支持

    ¥Implemented support for the File System API (#41827)

技术栈变更

¥Stack Changes

Electron 30 将 Chromium 从 122.0.6261.39 升级到 124.0.6367.49,将 Node 从 20.9.0 升级到 20.11.1,并将 V8 从 12.2 升级到 12.4

¥Electron 30 upgrades Chromium from 122.0.6261.39 to 124.0.6367.49, Node from 20.9.0 to 20.11.1, and V8 from 12.2 to 12.4.

新功能

¥New Features

  • 在 Web 视图中添加了 transparent WebPreference。(#40301)

    ¥Added a transparent webpreference to webviews. (#40301)

  • 在 webContents API 中,通过 navigationHistory.getEntryAtIndex 方法添加了新的实例属性 navigationHistory,使应用能够检索浏览历史记录中任何导航条目的 URL 和标题。(#41662)

    ¥Added a new instance property navigationHistory on webContents API with navigationHistory.getEntryAtIndex method, enabling applications to retrieve the URL and title of any navigation entry within the browsing history. (#41662)

  • 添加了新的 BrowserWindow.isOccluded() 方法,允许应用检查遮挡状态。(#38982)

    ¥Added new BrowserWindow.isOccluded() method to allow apps to check occlusion status. (#38982)

  • 为实用程序进程中使用 net 模块发出的请求添加了代理配置支持。(#41417)

    ¥Added proxy configuring support for requests made with the net module from the utility process. (#41417)

  • navigator.serial 中添加了对通过服务类别 ID 请求蓝牙端口的支持。(#41734)

    ¥Added support for Bluetooth ports being requested by service class ID in navigator.serial. (#41734)

  • 添加了对 Node.js NODE_EXTRA_CA_CERTS CLI 标志的支持。(#41822)

    ¥Added support for the Node.js NODE_EXTRA_CA_CERTS CLI flag. (#41822)

重大变化

¥Breaking Changes

行为改变:跨源 iframe 现在使用权限策略来访问功能

¥Behavior Changed: cross-origin iframes now use Permission Policy to access features

跨源 iframe 现在必须通过 allow 属性指定给定 iframe 可用的功能才能访问它们。

¥Cross-origin iframes must now specify features available to a given iframe via the allow attribute in order to access them.

请参阅 documentation 了解更多信息。

¥See documentation for more information.

删除:--disable-color-correct-rendering 命令行开关

¥Removed: The --disable-color-correct-rendering command line switch

此开关从未正式记录,但无论如何,都会在此处注明其删除。Chromium 本身现在对颜色空间有更好的支持,因此不需要这个标志。

¥This switch was never formally documented but its removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.

行为改变:macOS 上的 BrowserView.setAutoResize 行为

¥Behavior Changed: BrowserView.setAutoResize behavior on macOS

在 Electron 30 中,BrowserView 现在是新 WebContentsView API 的封装器。

¥In Electron 30, BrowserView is now a wrapper around the new WebContentsView API.

此前,BrowserView API 的 setAutoResize 函数在 macOS 上由 autoresizing 支持,在 Windows 和 Linux 上由自定义算法支持。对于简单的用例(例如使 BrowserView 填充整个窗口),这两种方法的行为是相同的。然而,在更高级的情况下,BrowserViews 在 macOS 上的自动调整大小将与在其他平台上不同,因为 Windows 和 Linux 的自定义调整大小算法并不完全匹配 macOS 自动调整大小 API 的行为。自动调整大小行为现已在所有平台上标准化。

¥Previously, the setAutoResize function of the BrowserView API was backed by autoresizing on macOS, and by a custom algorithm on Windows and Linux. For simple use cases such as making a BrowserView fill the entire window, the behavior of these two approaches was identical. However, in more advanced cases, BrowserViews would be autoresized differently on macOS than they would be on other platforms, as the custom resizing algorithm for Windows and Linux did not perfectly match the behavior of macOS's autoresizing API. The autoresizing behavior is now standardized across all platforms.

如果你的应用使用 BrowserView.setAutoResize 执行比让 BrowserView 填充整个窗口更复杂的操作,则你可能已经有自定义逻辑来处理 macOS 上的这种行为差异。如果是这样,Electron 30 将不再需要该逻辑,因为自动调整大小行为是一致的。

¥If your app uses BrowserView.setAutoResize to do anything more complex than making a BrowserView fill the entire window, it's likely you already had custom logic in place to handle this difference in behavior on macOS. If so, that logic will no longer be needed in Electron 30 as autoresizing behavior is consistent.

删除:params.inputFormType 属性于 context-menuWebContents

¥Removed: params.inputFormType property on context-menu on WebContents

WebContents 中的 context-menu 事件中的 params 对象的 inputFormType 属性已被删除。请改用新的 formControlType 属性。

¥The inputFormType property of the params object in the context-menu event from WebContents has been removed. Use the new formControlType property instead.

删除:process.getIOCounters()

¥Removed: process.getIOCounters()

Chromium 已删除对此信息的访问。

¥Chromium has removed access to this information.

27.x.y 支持终止

¥End of Support for 27.x.y

Electron 27.x.y 已根据项目 支持政策 终止支持。建议开发者和应用升级到较新版本的 Electron。

¥Electron 27.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E30 (2024 年 4 月)E31 (2024 年 6 月)E32 (2024 年 8 月)
30.x.y31.x.y32.x.y
29.x.y30.x.y31.x.y
28.x.y29.x.y30.x.y

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.

2024 年 Google 编程夏令营

· 8 min read

我们很高兴地宣布,Electron 已被接受为 2024 年第 20 届 Google Summer of Code (GSoC) 的指导机构!Google Summer of Code 是一项全球性计划,致力于将新的贡献者引入开源软件开发。

¥We are excited to announce that Electron has been accepted as a mentoring organization for the 20th edition of Google Summer of Code (GSoC) 2024! Google Summer of Code is a global program focused on bringing new contributors into open source software development.

有关更多计划详情,请查看 Google 的 Summer of Code 主页

¥For more program details, check out Google’s Summer of Code homepage.

关于我们

¥About us

Electron 是一个使用 Web 技术构建跨平台桌面应用的 JavaScript 框架。Electron 的核心框架是一个使用 ChromiumNode.js 构建的编译二进制可执行文件,主要用 C++ 编写。

¥Electron is a JavaScript framework for building cross-platform desktop applications using web technologies. The core Electron framework is a compiled binary executable built with Chromium and Node.js, and is mostly written in C++.

除了 Electron 核心之外,我们还致力于各种项目,以帮助维护 Electron 组织,例如:

¥Outside of Electron core, we also work on a variety of projects to help sustain the Electron organization, such as:

作为 Summer of Code 贡献者,你将与 Electron 的一些核心贡献者合作,参与 github.com/electron 旗下的众多项目之一。

¥As a Summer of Code contributor, you would be collaborating with some of Electron’s core contributors on one of many projects under the github.com/electron umbrella.

应用前

¥Before applying

如果你对 Electron 不太熟悉,我们建议你先阅读 documentation 并尝试 Electron Fiddle 中的示例。

¥If you aren’t very familiar with Electron, we would recommend you start by reading the documentation and trying out examples in Electron Fiddle.

要了解有关 Electron 应用分发的更多信息,你还可以通过创建示例应用来试用 Electron Forge

¥To learn more about Electron app distribution, you can also play around with Electron Forge by creating a sample application:

npm init electron-app@latest my-app

在熟悉代码后,加入 Electron Discord 服务器 的讨论吧。

¥After familiarizing yourself with the code a bit, come join the conversation on the Electron Discord server.

信息

如果这是你第一次参加 Google Summer of Code,或者你是开源新手,我们建议你在加入社区之前先阅读 Google 的 贡献者指南

¥If this is your first time participating in Google Summer of Code or if you’re new to open source in general, we recommend reading Google’s Contributor Guide as a first step before engaging with the community.

起草你的提案

¥Drafting your proposal

有兴趣与 Electron 合作吗?首先,请查看我们准备的 七个项目构想草稿。所有列出的方案目前均开放提案。

¥Interested in collaborating with Electron? First, check out the seven project idea drafts that we have prepared. All of the listed ideas are currently open for proposals.

你还有其他想法希望我们考虑吗?我们也乐于接受未列入拟议项目清单的新想法,但请确保你的方案已全面概述并详细说明。如有疑问,我们建议你坚持我们列出的建议。

¥Have a different idea you’d like us to consider? We’re also open to accepting new ideas that are not on the proposed project list, but make sure your approach is thoroughly outlined and detailed. When in doubt, we recommend sticking with our listed ideas.

你的应用应包含:

¥Your application should include:

  • 你的提案:一份书面文档,详细描述你计划在夏季实现的目标。

    ¥Your proposal: a written document that describes in detail what you plan to achieve over the course of the summer.

  • 你的开发者背景。如果你有简历,请附上副本。或者,请告诉我们你过去的技术经验。

    ¥Your background as a developer. If you have a resume, please include a copy. Otherwise, tell us about your past technical experience.

    • 缺乏某些字段的经验并不会让你失去资格,但这将有助于我们的导师制定计划,为你提供最佳支持,并确保你的暑期项目取得成功。

      ¥Lack of experience in certain areas won’t disqualify you, but it will help our mentors work out a plan to best support you and make sure your summer project is successful.

有关在 Electron 应用中提交哪些内容的详细指南,请参见此处。 请直接向 Google Summer of Code 门户提交提案。请注意,通过电子邮件发送给 Electron 团队而非通过申请门户提交的提案将不被视为最终提交。

¥A detailed guide of what to submit as part of your Electron application is here. Submit proposals directly to the Google Summer of Code portal. Note that proposals emailed to the Electron team rather than submitted through the application portal will not be considered as a final submission.

如果你需要更多关于提案的指导,或者不确定要包含哪些内容,我们也建议你关注 Google Summer of Code 官方提案撰写建议

¥If you want more guidance on your proposal or are unsure of what to include, we also recommend that you follow the official Google Summer of Code proposal writing advice here.

申请开放时间为 2024 年 3 月 18 日,截止时间为 2024 年 4 月 2 日。

¥Applications open on March 18th, 2024 and close on April 2nd, 2024.

信息

我们 2022 年 Google Summer of Code 实习生 @aryanshridhar 的表现非常出色!如果你想了解 Aryan 在 Electron 的暑期工作成果,你可以在 2022 GSoC 项目存档 上阅读他的报告。

¥Our 2022 Google Summer of Code intern, @aryanshridhar, did an amazing job! If you want to see what Aryan worked on during his summer with Electron, you can read his report in the 2022 GSoC program archives.

有问题吗?

¥Questions?

如果你有任何我们未在博文中解答的问题,或者对你的提案草案有任何疑问,请发送电子邮件至 summer-of-code@electronjs.org 或查看 GSoC 常见问题解答

¥If you have questions we didn’t address in the blog post or inquiries for your proposal draft, please send us an email at summer-of-code@electronjs.org or check GSoC FAQ!

资源

¥Resources

Electron 29.0.0

· 8 min read

Electron 29.0.0 已发布!它包含对 Chromium 122.0.6261.39、V8 12.2 和 Node.js 20.9.0 的升级。

¥Electron 29.0.0 has been released! It includes upgrades to Chromium 122.0.6261.39, V8 12.2, and Node.js 20.9.0.


Electron 团队非常高兴地宣布 Electron 29.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 29.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

亮点

¥Highlights

  • 添加了新的顶层 webUtils 模块,这是一个渲染器进程模块,它提供了一个与 Web API 对象交互的实用程序层。模块中第一个可用的 API 是 webUtils.getPathForFile。Electron 之前的 File.path 增强功能与 Web 标准有所偏差;这个新的 API 更符合当前的 Web 标准行为。

    ¥Added a new top-level webUtils module, a renderer process module that provides a utility layer to interact with Web API objects. The first available API in the module is webUtils.getPathForFile. Electron's previous File.path augmentation was a deviation from web standards; this new API is more in line with current web standards behavior.

技术栈变更

¥Stack Changes

Electron 29 将 Chromium 从 120.0.6099.56 升级到 122.0.6261.39,将 Node 从 18.18.2 升级到 20.9.0,并将 V8 从 12.0 升级到 12.2

¥Electron 29 upgrades Chromium from 120.0.6099.56 to 122.0.6261.39, Node from 18.18.2 to 20.9.0, and V8 from 12.0 to 12.2.

新功能

¥New Features

  • 添加了新的 webUtils 模块,这是一个与 Web API 对象交互的实用程序层,用于替换 File.path 增强功能。#38776

    ¥Added new webUtils module, a utility layer to interact with Web API objects, to replace File.path augmentation. #38776

  • 实用进程 添加了 net 模块。#40890

    ¥Added net module to utility process. #40890

  • 添加了新的 Electron Fuse,即 grantFileProtocolExtraPrivileges,它将 file:// 协议设置为与 Chromium 匹配的更安全、更严格的行为。#40372

    ¥Added a new Electron Fuse, grantFileProtocolExtraPrivileges, that opts the file:// protocol into more secure and restrictive behaviour that matches Chromium. #40372

  • protocol.registerSchemesAsPrivileged 中添加了一个选项,允许在自定义方案中使用 V8 代码缓存。#40544

    ¥Added an option in protocol.registerSchemesAsPrivileged to allow V8 code cache in custom schemes. #40544

  • 已迁移 app.{set|get}LoginItemSettings(settings),以便在 macOS 13.0+ 上使用 Apple 推荐的新底层框架。#37244

    ¥Migrated app.{set|get}LoginItemSettings(settings) to use Apple's new recommended underlying framework on macOS 13.0+. #37244

重大变化

¥Breaking Changes

行为改变:ipcRenderer 无法再通过 contextBridge 发送

¥Behavior Changed: ipcRenderer can no longer be sent over the contextBridge

尝试将整个 ipcRenderer 模块作为对象通过 contextBridge 发送现在将导致网桥接收端出现空对象。进行此更改是为了删除/减轻安全枪的影响。你不应该通过桥直接公开 ipcRenderer 或其方法。相反,提供一个安全的封装器,如下所示:

¥Attempting to send the entire ipcRenderer module as an object over the contextBridge will now result in an empty object on the receiving side of the bridge. This change was made to remove / mitigate a security footgun. You should not directly expose ipcRenderer or its methods over the bridge. Instead, provide a safe wrapper like below:

contextBridge.exposeInMainWorld('app', {
onEvent: (cb) => ipcRenderer.on('foo', (e, ...args) => cb(args)),
});

删除:apprenderer-process-crashed 活动

¥Removed: renderer-process-crashed event on app

apprenderer-process-crashed 事件已被删除。请改用新的 render-process-gone 事件。

¥The renderer-process-crashed event on app has been removed. Use the new render-process-gone event instead.

// Removed
app.on('renderer-process-crashed', (event, webContents, killed) => {
/* ... */
});

// Replace with
app.on('render-process-gone', (event, webContents, details) => {
/* ... */
});

删除:WebContents<webview>crashed 活动

¥Removed: crashed event on WebContents and <webview>

WebContents<webview> 上的 crashed 事件已被删除。请改用新的 render-process-gone 事件。

¥The crashed events on WebContents and <webview> have been removed. Use the new render-process-gone event instead.

// Removed
win.webContents.on('crashed', (event, killed) => {
/* ... */
});
webview.addEventListener('crashed', (event) => {
/* ... */
});

// Replace with
win.webContents.on('render-process-gone', (event, details) => {
/* ... */
});
webview.addEventListener('render-process-gone', (event) => {
/* ... */
});

删除:appgpu-process-crashed 活动

¥Removed: gpu-process-crashed event on app

appgpu-process-crashed 事件已被删除。请改用新的 child-process-gone 事件。

¥The gpu-process-crashed event on app has been removed. Use the new child-process-gone event instead.

// Removed
app.on('gpu-process-crashed', (event, killed) => {
/* ... */
});

// Replace with
app.on('child-process-gone', (event, details) => {
/* ... */
});

26.x.y 支持终止

¥End of Support for 26.x.y

Electron 26.x.y 已根据项目 支持政策 终止支持。建议开发者和应用升级到较新版本的 Electron。

¥Electron 26.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E29 (2024 年 2 月)E30 (2024 年 4 月)E31 (2024 年 6 月)
29.x.y30.x.y31.x.y
28.x.y29.x.y30.x.y
27.x.y28.x.y29.x.y

下一步计划

¥What's Next

你知道 Electron 最近添加了社区征求意见 (RFC) 流程吗?如果你想为框架添加功能,RFC 可以成为与维护人员就其设计展开对话的有用工具。你还可以在 Pull 请求中查看即将讨论的变更。要了解更多信息,请查看我们的 electron/rfcs 介绍 博客文章,或直接查看 electron/rfcs 代码库的 README 文件。

¥Did you know that Electron recently added a community Request for Comments (RFC) process? If you want to add a feature to the framework, RFCs can be a useful tool to start a dialogue with maintainers on its design. You can also see upcoming changes being discussed in the Pull Requests. To learn more, check out our Introducing electron/rfcs blog post, or check out the README of the electron/rfcs repository directly.

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.

electron/rfcs 介绍

· 6 min read

Electron 的 API 工作组 正在采用开放的评论请求 (RFC) 流程,以帮助引导 Electron 核心的重大变更。

¥Electron’s API Working Group is adopting an open Requests for Comments (RFC) process to help shepherd larger changes to Electron core.

为什么要发布 RFC?

¥Why RFCs?

简而言之,我们希望简化 Electron 核心重大变更的落地流程。

¥In short, we want to smooth out the process of landing significant changes to Electron core.

目前,新的代码更改主要通过 GitHub 上的问题和拉取请求进行讨论。对于 Electron 的大多数更改,这是一个很好的系统。许多错误修复、文档更改,甚至新功能都可以通过标准 GitHub 流程异步审查和合并。

¥Currently, new code changes are mostly discussed through issues and pull requests on GitHub. For most changes to Electron, this is a good system. Many bug fixes, documentation changes, and even new features are straightforward enough to review and merge asynchronously through standard GitHub flows.

对于更重要的变更(例如,大型 API 接口或会影响大多数 Electron 应用的重大变更),在构思阶段(大部分代码编写完成之前)进行审核是合理的。

¥For changes that are more significant—for instance, large API surfaces or breaking changes that would affect the majority of Electron apps—it makes sense for review to happen at the ideation stage before most of the code is written.

此流程旨在向公众开放,这也将使整个开源社区更容易在 Electron 正式发布之前就潜在的变更提供反馈。

¥This process is designed to be open to the public, which will also make it easier for the open source community at large to give feedback on potential changes before they land in Electron.

它是如何工作的?

¥How does it work?

整个 RFC 流程位于 GitHub 上的 electron/rfcs 代码库中。步骤在代码库 README 中有详细描述。

¥The entire RFC process lives in the electron/rfcs repository on GitHub. The steps are described in detail in the repository README.

简而言之,一旦向 electron/rfcs 代码库提交 PR,就会生成一份 RFC 提案。拟议的 RFC 内容如下:

¥In brief, an RFC is Proposed once a PR is made to the electron/rfcs repository. A Proposed RFC becomes:

  • 当 PR 合并到代码库的 main 分支时激活,这意味着 Electron 维护者可以接受 electron/electron 中的实现,或者

    ¥Active when the PR is merged into the main branch of the repository, which means that Electron maintainers are amenable to an implementation in electron/electron, or

  • 如果 PR 最终被拒绝,则拒绝。

    ¥Declined if the PR is ultimately rejected.

信息

要使 RFC 生效,PR 必须获得至少 2 名 API 工作组成员的批准。合并之前,RFC 应同步提交,并获得至少三分之二工作组成员的一致同意。如果达成共识,将启动为期一个月的最终评论期,之后 PR 将被合并。

¥For the RFC to become Active, the PR must be approved by at least 2 API Working Group members. Before merging, the RFC should be presented synchronously and accepted unanimously by a quorum of at least two-thirds of the WG members. If consensus is reached, a one-month final comment period will be triggered, after which the PR will be merged.

如果实现已合并到 electron/electron,则活动 RFC 已完成。

¥An Active RFC is Completed if the implementation has been merged into electron/electron.

谁可以参与?

¥Who can participate?

Electron 社区的任何人都可以提交 RFC 或在 electron/rfcs 代码库上留下反馈!

¥Anyone in the Electron community can submit RFCs or leave feedback on the electron/rfcs repository!

我们希望使这个过程成为双向对话,并鼓励社区参与,以便从未来可能使用这些 API 的 Electron 应用中获得多元化的意见。如果你有兴趣就当前提议的 RFC 留下反馈,Electron 维护者已经创建了一些:

¥We wanted to make this process a two-way dialogue and encourage community participation to get a diverse set of opinions from Electron apps that might consume these APIs in the future. If you’re interested in leaving feedback on currently proposed RFCs, the Electron maintainers have already created a few:

致谢

¥Credits

Electron 的 RFC 流程以许多成熟的开源 RFC 流程为蓝本。许多创意和主要文案的灵感来源于:

¥Electron's RFC process was modeled on many established open source RFC processes. Inspiration for many ideas and major portions of copywriting go to:

关于 "runAsNode" CVE 的声明

· 9 min read

今天早些时候,Electron 团队收到了最近针对几款知名 Electron 应用提交的几个公开 CVE 漏洞的通知。这些 CVE 与 Electron 的两个 fuses 相关。 - runAsNodeenableNodeCliInspectArguments - 并且错误地声称,如果这些组件未被主动禁用,远程攻击者就能够通过它们执行任意代码。

¥Earlier today, the Electron team was alerted to several public CVEs recently filed against several notable Electron apps. The CVEs are related to two of Electron’s fuses - runAsNode and enableNodeCliInspectArguments - and incorrectly claim that a remote attacker is able to execute arbitrary code via these components if they have not been actively disabled.

我们认为这些 CVE 并非出于善意提交。首先,这个说法是错误的。 - 该配置不启用远程代码执行。其次,尽管这些 CVE 中被点名的公司有漏洞赏金计划,但尚未收到通知。最后,虽然我们确实认为禁用相关组件可以增强应用的安全性,但我们认为提交的 CVE 的严重程度并不正确。“严重”级别仅用于危险性最高的问题,而本例中并非如此。

¥We do not believe that these CVEs were filed in good faith. First of all, the statement is incorrect - the configuration does not enable remote code execution. Secondly, companies called out in these CVEs have not been notified despite having bug bounty programs. Lastly, while we do believe that disabling the components in question enhances app security, we do not believe that the CVEs have been filed with the correct severity. “Critical” is reserved for issues of the highest danger, which is certainly not the case here.

任何人都可以申请 CVE。虽然这对软件行业的整体健康发展有利,但“挖空 CVE”来提升单个安全研究人员的声誉却毫无意义。

¥Anyone is able to request a CVE. While this is good for the overall health of the software industry, “farming CVEs” to bolster the reputation of a single security researcher is not helpful.

话虽如此,我们理解,仅仅存在一个严重程度高达 critical 的 CVE 就可能导致终端用户感到困惑,因此,作为一个项目,我们希望提供指导和帮助来解决这个问题。

¥That said, we understand that the mere existence of a CVE with the scary critical severity might lead to end user confusion, so as a project, we’d like to offer guidance and assistance in dealing with the issue.

这会对我有什么影响?

¥How might this impact me?

在审查了 CVE 后,Electron 团队认为这些 CVE 并不重要。

¥After reviewing the CVEs, the Electron team believes that these CVEs are not critical.

攻击者需要已经能够在计算机上执行任意命令,方法是通过物理访问硬件或实现完全远程代码执行。值得重复:所描述的漏洞需要攻击者已经拥有受攻击系统的访问权限。

¥An attacker needs to already be able to execute arbitrary commands on the machine, either by having physical access to the hardware or by having achieved full remote code execution. This bears repeating: The vulnerability described requires an attacker to already have access to the attacked system.

例如,Chrome 威胁模型中未考虑物理本地攻击

¥Chrome, for example, does not consider physically-local attacks in their threat model:

我们认为这些攻击超出了 Chrome 的威胁模型,因为 Chrome(或任何应用)无法防御以你的身份登录你的设备或能够使用你的操作系统用户账户权限运行软件的恶意用户。此类攻击者可以修改可执行文件和 DLL、更改环境变量(例如 PATH)、更改配置文件、读取你用户账户拥有的任何数据、通过电子邮件将其发送给自己等等。此类攻击者可以完全控制你的设备,Chrome 无法采取任何措施来提供有效的防御保障。这个问题并非 Chrome 独有 - 所有应用都必须信任物理本地用户。

¥We consider these attacks outside Chrome's threat model, because there is no way for Chrome (or any application) to defend against a malicious user who has managed to log into your device as you, or who can run software with the privileges of your operating system user account. Such an attacker can modify executables and DLLs, change environment variables like PATH, change configuration files, read any data your user account owns, email it to themselves, and so on. Such an attacker has total control over your device, and nothing Chrome can do would provide a serious guarantee of defense. This problem is not special to Chrome ­— all applications must trust the physically-local user.

CVE 中描述的漏洞允许攻击者将受影响的应用用作具有继承的 TCC 权限的通用 Node.js 进程。例如,如果应用被授予了地址簿的访问权限,攻击者就可以以 Node.js 的形式运行该应用,并执行继承该地址簿访问权限的任意代码。这通常被称为“自给自足”攻击。攻击者通常使用 PowerShell、Bash 或类似工具来运行任意代码。

¥The exploit described in the CVEs allows an attacker to then use the impacted app as a generic Node.js process with inherited TCC permissions. So if the app, for example, has been granted access to the address book, the attacker can run the app as Node.js and execute arbitrary code which will inherit that address book access. This is commonly known as a “living off the land” attack. Attackers usually use PowerShell, Bash, or similar tools to run arbitrary code.

我会受到影响吗?

¥Am I impacted?

默认情况下,所有发布的 Electron 版本都启用了 runAsNodeenableNodeCliInspectArguments 功能。如果你没有按照 Electron Fuses 文档 中的说明关闭它们,你的应用同样容易受到“离地攻击”的攻击。再次强调,攻击者必须具备在受害者机器上执行代码和程序的能力。

¥By default, all released versions of Electron have the runAsNode and enableNodeCliInspectArguments features enabled. If you have not turned them off as described in the Electron Fuses documentation, your app is equally vulnerable to being used as a “living off the land” attack. Again, we need to stress that an attacker needs to already be able to execute code and programs on the victim’s machine.

缓解措施

¥Mitigation

缓解此问题最简单的方法是在 Electron 应用中禁用 runAsNode 保险丝。runAsNode 保险丝用于切换是否遵循 ELECTRON_RUN_AS_NODE 环境变量。请参阅 Electron Fuses 文档 了解如何切换这些保险丝。

¥The easiest way to mitigate this issue is to disable the runAsNode fuse within your Electron app. The runAsNode fuse toggles whether the ELECTRON_RUN_AS_NODE environment variable is respected or not. Please see the Electron Fuses documentation for information on how to toggle theses fuses.

请注意,如果禁用此保险丝,则主进程中的 process.fork 将无法按预期运行,因为它依赖于此环境变量才能运行。相反,我们建议你使用 实用程序进程,它适用于需要独立 Node.js 进程(如 Sqlite 服务器进程或类似场景)的许多用例。

¥Please note that if this fuse is disabled, then process.fork in the main process will not function as expected as it depends on this environment variable to function. Instead, we recommend that you use Utility Processes, which work for many use cases where you need a standalone Node.js process (like a Sqlite server process or similar scenarios).

你可以在我们的 安全检查表

¥You can find more info about security best practices we recommend for Electron apps in our Security Checklist.

Electron 28.0.0

· 7 min read

Electron 28.0.0 已发布!它包含对 Chromium 120.0.6099.56、V8 12.0 和 Node.js 18.18.2 的升级。

¥Electron 28.0.0 has been released! It includes upgrades to Chromium 120.0.6099.56, V8 12.0, and Node.js 18.18.2.


Electron 团队非常高兴地宣布 Electron 28.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 28.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

亮点

¥Highlights

  • 实现了对 ECMAScript 模块或 ESM(什么是 ECMAScript 模块?点击此处了解更多信息)的支持。这包括对 Electron 本身的 ESM 的支持,以及 UtilityProcess API 入口点等字段的支持。更多详情请参阅 查看我们的 ESM 文档

    ¥Implemented support for ECMAScript modules or ESM (What are ECMAScript modules? learn more here. This includes support for ESM in Electron proper, as well as areas such as the UtilityProcess API entrypoints. See our ESM documentation for more details.

  • 除了在 Electron 本身中启用 ESM 支持外,Electron Forge 还支持使用 ESM 打包、构建和开发 Electron 应用。你可以在 Forge v7.0.0 或更高版本中找到此支持。

    ¥In addition to enabling ESM support in Electron itself, Electron Forge also supports using ESM to package, build and develop Electron applications. You can find this support in Forge v7.0.0 or higher.

技术栈变更

¥Stack Changes

新功能

¥New Features

  • 启用 ESM 支持。#37535

    ¥Enabled ESM support. #37535

  • UtilityProcess API 添加了 ESM 入口点。#40047

    ¥Added ESM entrypoints to the UtilityProcess API. #40047

  • display 对象添加了多个属性,包括 detectedmaximumCursorSizenativeOrigin#40554

    ¥Added several properties to the display object including detected, maximumCursorSize, and nativeOrigin. #40554

  • 添加了对 Linux 上 ELECTRON_OZONE_PLATFORM_HINT 环境变量的支持。#39792

    ¥Added support for ELECTRON_OZONE_PLATFORM_HINT environment variable on Linux. #39792

重大变化

¥Breaking Changes

行为改变:WebContents.backgroundThrottling 设置为 false 会影响主机 BrowserWindow 中的所有 WebContents

¥Behavior Changed: WebContents.backgroundThrottling set to false affects all WebContents in the host BrowserWindow

WebContents.backgroundThrottling 设置为 false 将禁用 BrowserWindow 中显示的所有 WebContents 的帧限制。

¥WebContents.backgroundThrottling set to false will disable frames throttling in the BrowserWindow for all WebContents displayed by it.

删除:BrowserWindow.setTrafficLightPosition(position)

¥Removed: BrowserWindow.setTrafficLightPosition(position)

BrowserWindow.setTrafficLightPosition(position) 已被删除,应使用 BrowserWindow.setWindowButtonPosition(position) API,它接受 null 而不是 { x: 0, y: 0 } 将位置重置为系统默认值。

¥BrowserWindow.setTrafficLightPosition(position) has been removed, the BrowserWindow.setWindowButtonPosition(position) API should be used instead which accepts null instead of { x: 0, y: 0 } to reset the position to system default.

// Removed in Electron 28
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });

// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);

删除:BrowserWindow.getTrafficLightPosition()

¥Removed: BrowserWindow.getTrafficLightPosition()

BrowserWindow.getTrafficLightPosition() 已被删除,应使用 BrowserWindow.getWindowButtonPosition() API,当没有自定义位置时,该 API 返回 null 而不是 { x: 0, y: 0 }

¥BrowserWindow.getTrafficLightPosition() has been removed, the BrowserWindow.getWindowButtonPosition() API should be used instead which returns null instead of { x: 0, y: 0 } when there is no custom position.

// Removed in Electron 28
const pos = win.getTrafficLightPosition();
if (pos.x === 0 && pos.y === 0) {
// No custom position.
}

// Replace with
const ret = win.getWindowButtonPosition();
if (ret === null) {
// No custom position.
}

删除:ipcRenderer.sendTo()

¥Removed: ipcRenderer.sendTo()

ipcRenderer.sendTo() API 已被删除。应通过在渲染器之间设置 MessageChannel 来替换它。

¥The ipcRenderer.sendTo() API has been removed. It should be replaced by setting up a MessageChannel between the renderers.

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被删除。

¥The senderId and senderIsMainFrame properties of IpcRendererEvent have been removed as well.

删除:app.runningUnderRosettaTranslation

¥Removed: app.runningUnderRosettaTranslation

app.runningUnderRosettaTranslation 属性已被删除。请改用 app.runningUnderARM64Translation

¥The app.runningUnderRosettaTranslation property has been removed. Use app.runningUnderARM64Translation instead.

// Removed
console.log(app.runningUnderRosettaTranslation);
// Replace with
console.log(app.runningUnderARM64Translation);

25.x.y 支持终止

¥End of Support for 25.x.y

Electron 25.x.y 已根据项目 支持政策 终止支持。建议开发者和应用升级到较新版本的 Electron。

¥Electron 25.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E28 (2023 年 12 月)E29 (2024 年 2 月)E30 (2024 年 4 月)
28.x.y29.x.y30.x.y
27.x.y28.x.y29.x.y
26.x.y27.x.y28.x.y

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.

2023 年生态系统回顾

· 13 min read

回顾 2023 年 Electron 开发者生态系统的改进和变化。

¥Reflecting on the improvements and changes in Electron's developer ecosystem in 2023.


在过去的几个月里,我们一直在对 Electron 生态系统进行一些改进,以增强 Electron 应用的开发者体验!以下是来自 Electron 总部的最新新增功能的简要概述。

¥In the past few months, we've been cooking up some changes across the Electron ecosystem to supercharge the developer experience for Electron apps! Here’s a swift rundown of the latest additions straight from Electron HQ.

Electron Forge 7 及更高版本

¥Electron Forge 7 and beyond

Electron Forge 7 - 我们用于打包和分发 Electron 应用的一体化工具的最新主要版本 - 现已推出。

¥Electron Forge 7 — the newest major version of our all-in-one tool for packaging and distributing Electron applications — is now available.

虽然 Forge 6 完全重写了 v5,但 v7 的规模较小,但仍包含一些重大更改。展望未来,我们将继续发布 Forge 的主要版本,因为需要进行重大更改。

¥While Forge 6 was a complete rewrite from v5, v7 is smaller in scope but still contains a few breaking changes. Going forward, we will continue to publish major versions of Forge as breaking changes need to be made.

有关更多详细信息,请参阅 GitHub 上的完整 Forge v7.0.0 更新日志

¥For more details, see the full Forge v7.0.0 changelog on GitHub.

重大变更

¥Breaking changes

  • 已切换到 notarytool 进行 macOS 公证:自 2023 年 11 月 1 日起,Apple 将停止支持 macOS 的旧版 altool 公证,此版本将其从 Electron Forge 中完全移除。

    ¥Switched to notarytool for macOS notarization: As of 2023-11-01, Apple sunset the legacy altool for macOS notarization, and this release removes it from Electron Forge entirely.

  • 最低 Node.js 版本提升至 v16.4.0:在此版本中,我们将最低要求的 Node.js 版本设置为 16.4.0。

    ¥Minimum Node.js increased to v16.4.0: With this release, we’ve set the minimum required Node.js version to 16.4.0.

  • 停止对 electron-prebuiltelectron-prebuilt-compile 的支持:electron-prebuilt是 Electron npm 模块的原始名称 一样,但在 v1.3.1 中被 electron 取代。electron-prebuilt-compile 是该二进制文件的替代方案,它带有增强的 DX 功能,但最终被放弃。

    ¥Dropped support for electron-prebuilt and electron-prebuilt-compile: electron-prebuilt was the original name for Electron’s npm module, but was replaced by electron in v1.3.1. electron-prebuilt-compile was an alternative to that binary that came with enhanced DX features, but was eventually abandoned as a project.

亮点

¥Highlights

  • Google Cloud Storage 发布者:为了更好地支持静态自动更新,Electron Forge 现在支持直接发布到 Google Cloud Storage!

    ¥Google Cloud Storage publisher: As part of our push to better support static auto updating, Electron Forge now supports publishing directly to Google Cloud Storage!

  • ESM forge.config.js 支持:Electron Forge 现已支持 ESM forge.config.js 文件。(附:期待 Electron 28 中对 ESM 入口点的支持。)

    ¥ESM forge.config.js support: Electron Forge now supports ESM forge.config.js files. (P.S. Look forward to ESM entrypoint support in Electron 28.)

  • Makers 现在运行于并行:在 Electron Forge 6 中,由于 ✨ 遗留 ✨ 原因,Makers 按顺序运行。从那时起,我们已经测试了 Make 步骤的并行化,没有任何不良副作用,因此在为同一平台构建多个目标时,你应该会看到速度的提升!

    ¥Makers now run in parallel: In Electron Forge 6, Makers ran sequentially for ✨ legacy ✨ reasons. Since then, we’ve tested out parallelization for the Make step with no adverse side effects, so you should see a speed-up when building multiple targets for the same platform!

谢谢!

🙇 非常感谢 mahnunchik 为 Forge 配置中的 GCS Publisher 和 ESM 支持所做的贡献!

¥🙇 Big thanks to mahnunchik for the contributions for both the GCS Publisher and ESM support in Forge configurations!

更完善的静态存储自动更新

¥Better static storage auto updates

Squirrel.Windows 和 Squirrel.Mac 是支持 Electron 内置 autoUpdater 模块的平台特定更新技术。两个项目都支持通过两种方式自动更新:

¥Squirrel.Windows and Squirrel.Mac are platform-specific updater technologies that back Electron’s built-in autoUpdater module. Both projects support auto updates via two methods:

  • 兼容 Squirrel 的更新服务器

    ¥A Squirrel-compatible update server

  • 托管在静态存储提供商(例如 AWS、Google Cloud Platform、Microsoft Azure 等)上的清单 URL

    ¥A manifest URL hosted on a static storage provider (e.g. AWS, Google Cloud Platform, Microsoft Azure, etc.)

更新服务器方法传统上一直是 Electron 应用的推荐方法(并且提供了对更新逻辑的额外自定义),但它有一个很大的缺点 - 如果应用是闭源的,它需要维护自己的服务器实例。

¥The update server method has traditionally been the recommended approach for Electron apps (and provides additional customization of update logic), but it has a major downside—it requires apps to maintain their own server instance if they are closed-source.

另一方面,静态存储方法一直以来都是可行的,但在 Electron 中没有文档记录,并且在 Electron 工具包中支持不佳。

¥On the other hand, the static storage method has always been possible, but was undocumented within Electron and poorly supported across Electron tooling packages.

凭借 @MarshallOfSound 的一些出色工作,无服务器自动应用更新的更新流程已得到极大简化:

¥With some great work from @MarshallOfSound, the update story for serverless automatic app updates has been drastically streamlined:

  • Electron Forge 的 Zip 和 Squirrel.Windows 生成器现在可以配置为输出与 autoUpdater 兼容的更新清单。

    ¥Electron Forge’s Zip and Squirrel.Windows makers can now be configured to output autoUpdater-compatible update manifests.

  • update-electron-app 的新主要版本 (v2.0.0) 现在可以读取这些生成的清单,作为 update.electronjs.org 服务器的替代方案。

    ¥A new major version of update-electron-app (v2.0.0) can now read these generated manifests as an alternative to the update.electronjs.org server.

一旦你的 Makers 和 Publishers 配置为将更新清单上传到云文件存储,你只需几行配置即可启用自动更新:

¥Once your Makers and Publishers are configured to upload update manifests to cloud file storage, you can enable auto updates with only a few lines of configuration:

const { updateElectronApp, UpdateSourceType } = require('update-electron-app');

updateElectronApp({
updateSource: {
type: UpdateSourceType.StaticStorage,
baseUrl: `https://my-manifest.url/${process.platform}/${process.arch}`,
},
});
进一步阅读

📦 想了解更多?有关详细指南,请参阅 Forge 自动更新文档

¥📦 Want to learn more? For a detailed guide, see Forge’s auto update documentation.

@electron/ 扩展宇宙

¥The @electron/ extended universe

Electron 刚起步时,社区发布了许多软件包,以增强开发、打包和分发 Electron 应用的体验。随着时间的推移,许多软件包都被整合到 Electron 的 GitHub 组织中,核心团队承担了维护工作。

¥When Electron first started, the community published many packages to enhance the experience of developing, packaging, and distributing Electron apps. Over time, many of these packages were incorporated into Electron’s GitHub organization, with the core team taking on the maintenance burden.

2022 年,我们开始在 npm 上将所有这些第一方工具统一到 @electron/ 命名空间下。此更改意味着以前名为 electron-foo 的软件包在 npm 上现在为 @electron/foo,以前名为 electron/electron-foo 的仓库在 GitHub 上现在为 electron/foo。这些更改有助于清晰地区分第一方项目和用户空间项目。这包括许多常用的软件包,例如:

¥In 2022, we began unifying all these first-party tools under the @electron/ namespace on npm. This change means that packages that used to be electron-foo are now @electron/foo on npm, and repositories that used to be named electron/electron-foo are now electron/foo on GitHub. These changes help clearly delineate first-party projects from userland projects. This includes many commonly used packages, such as:

  • @electron/asar

  • @electron/fuses

  • @electron/get

  • @electron/notarize

  • @electron/osx-sign

  • @electron/packager

  • @electron/rebuild

  • @electron/remote

  • @electron/symbolicate-mac

  • @electron/universal

展望未来,我们发布的所有第一方软件包也将位于 @electron/ 命名空间中。此规则有两个例外:

¥Going forward, all first-party packages we release will also be in the @electron/ namespace. There are two exceptions to this rule:

  • Electron 核心将继续在 electron 软件包下发布。

    ¥Electron core will continue to be published under the electron package.

  • Electron Forge 将继续在 @electron-forge/ 命名空间下发布其所有 monorepo 软件包。

    ¥Electron Forge will continue to publish all of its monorepo packages under the @electron-forge/ namespace.

寻星

⭐ 在此过程中,我们还意外地将 electron/packager 仓库私有化,这带来了不幸的副作用,导致我们的 GitHub 星数被抹去(抹去之前超过 9000)。如果你是 Packager 的活跃用户,请给我们一个 ⭐ Star ⭐!

¥⭐ During this process, we also accidentally took the electron/packager repository private, which has the unfortunate side effect of erasing our GitHub star count (over 9000 before the erasure). If you are an active user of Packager, we’d appreciate a ⭐ Star ⭐!

@electron/windows-sign 介绍

¥Introducing @electron/windows-sign

从 2023 年 6 月 1 日起,行业标准开始要求 Windows 代码签名证书的密钥存储在符合 FIPS 标准的硬件上。

¥Starting on 2023-06-01, industry standards began requiring keys for Windows code signing certificates to be stored on FIPS-compliant hardware.

实际上,这意味着在持续集成 (CI) 环境中构建和签名的应用的代码签名变得更加困难,因为许多 Electron 工具会将证书文件和密码作为配置参数,并尝试使用硬编码逻辑从那里进行签名。

¥In practice, this meant that code signing became a lot harder for apps that build and sign in CI environments, since many Electron tools take in a certificate file and password as config parameters and attempt to sign from there using hardcoded logic.

这种情况一直是 Electron 开发者的常见痛点,因此我们一直在努力寻找更好的解决方案,将 Windows 代码签名隔离为一个独立的步骤,类似于 @electron/osx-sign 在 macOS 上的做法。

¥This situation has been a common pain point for Electron developers, which is why we have been working on a better solution that isolates Windows code signing into its own standalone step, similar to what @electron/osx-sign does on macOS.

未来,我们计划将此软件包完全集成到 Electron Forge 工具链中,但目前它独立存在。该软件包目前可在 npm install --save-dev @electron/windows-sign 安装,并可通过编程方式或 CLI 使用。

¥In the future, we plan on fully integrating this package into the Electron Forge toolchain, but it currently lives on its own. The package is currently available for installation at npm install --save-dev @electron/windows-sign and can used programmatically or via CLI.

请在 代码库的问题跟踪器 中试用并告诉我们你的反馈!

¥Please try it out and give us your feedback in the repo’s issue tracker!

下一步是什么?

¥What's next?

下个月我们将进入一年一度的 12 月静默期。与此同时,我们会思考如何在 2024 年提升 Electron 的开发体验。

¥We'll be entering our annual December quiet period next month. While we do, we'll be thinking about how we can make the Electron development experience even better in 2024.

你希望我们接下来做什么?告诉我们!

¥Is there anything you'd like to see us work on next? Let us know!

十二月静默月 (2023 年 12 月)

· 3 min read

Electron 项目将在 2023 年 12 月暂停,然后在 2024 年 1 月恢复全速运行。

¥The Electron project will pause for the month of December 2023, then return to full speed in January 2024.

via GIPHY


12 月会有什么相同之处?

¥What will be the same in December

  1. 零日漏洞和其他主要安全相关版本将根据需要发布。安全事件应通过 SECURITY.md 报告。

    ¥Zero-day and other major security-related releases will be published as necessary. Security incidents should be reported via SECURITY.md.

  2. 行为准则 的报告和审核将继续进行。

    ¥Code of Conduct reports and moderation will continue.

12 月会有什么不同?

¥What will be different in December

  1. Electron 28.0.0 将于 12 月 5 日发布。Electron 28 发布后,12 月将不再发布新的稳定版本。

    ¥Electron 28.0.0 will be released on December 5th. After Electron 28, there will be no new Stable releases in December.

  2. 12 月最后两周未发布 Nightly 和 Alpha 版本。

    ¥No Nightly and Alpha releases for the last two weeks of December.

  3. 除了少数例外,无需进行拉取请求审核或合并。

    ¥With few exceptions, no pull request reviews or merges.

  4. 任何代码库均未更新问题跟踪器。

    ¥No issue tracker updates on any repositories.

  5. 维护人员未提供 Discord 调试帮助。

    ¥No Discord debugging help from maintainers.

  6. 无需更新社交媒体内容。

    ¥No social media content updates.

展望未来

¥Going forward

这是我们进行静默期实验的第三年,到目前为止,我们在平衡一个月的剩余期和之后的正常发布节奏方面取得了很大成功。因此,我们决定将其作为我们未来发布日历的常规部分。我们仍然会在每年的最后一个稳定版本中添加提醒。

¥This is our third year running our quiet period experiment, and we've had a lot of success so far in balancing a month of rest with maintaining our normal release cadence afterwards. Therefore, we've decided to make this a regular part of our release calendar going forward. We'll still be putting a reminder into the last stable release of every calendar year.

2024 年再见!

¥See you all in 2024!

Electron 27.0.0

· 7 min read

Electron 27.0.0 已发布!它包含对 Chromium 118.0.5993.32、V8 11.8 和 Node.js 18.17.1 的升级。

¥Electron 27.0.0 has been released! It includes upgrades to Chromium 118.0.5993.32, V8 11.8, and Node.js 18.17.1.


Electron 团队非常高兴地宣布 Electron 27.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 27.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

技术栈变更

¥Stack Changes

重大变化

¥Breaking Changes

删除:macOS 10.13 / 10.14 支持

¥Removed: macOS 10.13 / 10.14 support

Chromium 不再支持 macOS 10.13 (High Sierra) 和 macOS 10.14 (Mojave)。

¥macOS 10.13 (High Sierra) and macOS 10.14 (Mojave) are no longer supported by Chromium.

旧版本的 Electron 将继续在这些操作系统上运行,但需要 macOS 10.15 (Catalina) 或更高版本才能运行 Electron v27.0.0 及更高版本。

¥Older versions of Electron will continue to run on these operating systems, but macOS 10.15 (Catalina) or later will be required to run Electron v27.0.0 and higher.

已弃用:ipcRenderer.sendTo()

¥Deprecated: ipcRenderer.sendTo()

ipcRenderer.sendTo() API 已被弃用。应通过在渲染器之间设置 MessageChannel 来替换它。

¥The ipcRenderer.sendTo() API has been deprecated. It should be replaced by setting up a MessageChannel between the renderers.

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被弃用。

¥The senderId and senderIsMainFrame properties of IpcRendererEvent have been deprecated as well.

删除:systemPreferences 中的配色方案事件

¥Removed: color scheme events in systemPreferences

以下 systemPreferences 事件已被删除:

¥The following systemPreferences events have been removed:

  • inverted-color-scheme-changed

  • high-contrast-color-scheme-changed

请改用 nativeTheme 模块上的新 updated 事件。

¥Use the new updated event on the nativeTheme module instead.

// Removed
systemPreferences.on('inverted-color-scheme-changed', () => {
/* ... */
});
systemPreferences.on('high-contrast-color-scheme-changed', () => {
/* ... */
});

// Replace with
nativeTheme.on('updated', () => {
/* ... */
});

删除:webContents.getPrinters

¥Removed: webContents.getPrinters

webContents.getPrinters 方法已被删除。请改用 webContents.getPrintersAsync

¥The webContents.getPrinters method has been removed. Use webContents.getPrintersAsync instead.

const w = new BrowserWindow({ show: false });

// Removed
console.log(w.webContents.getPrinters());
// Replace with
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers);
});

删除:systemPreferences.{get,set}AppLevelAppearancesystemPreferences.appLevelAppearance

¥Removed: systemPreferences.{get,set}AppLevelAppearance and systemPreferences.appLevelAppearance

systemPreferences.getAppLevelAppearancesystemPreferences.setAppLevelAppearance 方法以及 systemPreferences.appLevelAppearance 属性已被删除。请改用 nativeTheme 模块。

¥The systemPreferences.getAppLevelAppearance and systemPreferences.setAppLevelAppearance methods have been removed, as well as the systemPreferences.appLevelAppearance property. Use the nativeTheme module instead.

// Removed
systemPreferences.getAppLevelAppearance();
// Replace with
nativeTheme.shouldUseDarkColors;

// Removed
systemPreferences.appLevelAppearance;
// Replace with
nativeTheme.shouldUseDarkColors;

// Removed
systemPreferences.setAppLevelAppearance('dark');
// Replace with
nativeTheme.themeSource = 'dark';

删除:systemPreferences.getColoralternate-selected-control-text

¥Removed: alternate-selected-control-text value for systemPreferences.getColor

systemPreferences.getColoralternate-selected-control-text 值已被删除。请改用 selected-content-background

¥The alternate-selected-control-text value for systemPreferences.getColor has been removed. Use selected-content-background instead.

// Removed
systemPreferences.getColor('alternate-selected-control-text');
// Replace with
systemPreferences.getColor('selected-content-background');

新功能

¥New Features

  • 添加了应用辅助功能透明度设置 API #39631

    ¥Added app accessibility transparency settings api #39631

  • 添加了对 chrome.scripting 扩展 API #39675 的支持

    ¥Added support for chrome.scripting extension APIs #39675

  • 默认启用 WaylandWindowDecorations#39644

    ¥Enabled WaylandWindowDecorations by default #39644

24.x.y 支持终止

¥End of Support for 24.x.y

根据项目的 支持政策,Electron 24.x.y 已达到支持终止状态。建议开发者和应用升级到较新版本的 Electron。

¥Electron 24.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E27 (2023 年 10 月)E28 (2023 年 12 月)E29 (2024 年 2 月)
27.x.y28.x.y29.x.y
26.x.y27.x.y28.x.y
25.x.y26.x.y27.x.y

22.x.y 扩展支持终止

¥End of Extended Support for 22.x.y

今年早些时候,Electron 团队将 Electron 22 的计划终止日期从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日,以配合 Chrome 对 Windows 7/8/8.1 的扩展支持(更多详情请参阅 告别 Windows 7/8/8.1)。

¥Earlier this year, the Electron team extended Electron 22's planned end of life date from May 30, 2023 to October 10, 2023, in order to match Chrome's extended support for Windows 7/8/8.1 (see Farewell, Windows 7/8/8.1 for more details).

根据项目的 支持政策 和此支持扩展,Electron 22.x.y 已达到支持终止状态。这将使对最新的三个主要稳定版本的支持降级,并终止对 Windows 7/8/8.1 的官方支持。

¥Electron 22.x.y has reached end-of-support as per the project's support policy and this support extension. This will drop support back to the latest three stable major versions, and will end official support for Windows 7/8/8.1.

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.