Skip to main content

本周项目:WordPress 桌面版

· 10 min read

本周,我们采访了 Automattic 的同事,一起探讨了 WordPress 桌面版。这是一款用于管理 WordPress 内容的开源桌面客户端。

¥This week we caught up with folks at Automattic to talk about WordPress Desktop, an open-source desktop client for managing WordPress content.


WordPress Apps

大家都知道 WordPress,但 WordPress 桌面版是什么呢?

¥Everyone knows about WordPress, but what is WordPress Desktop?

WordPress.com 桌面应用 提供无缝的跨平台体验,让你可以专注于内容和设计,而不会被浏览器标签页分散注意力,或者让你的网站保持边缘化但仍然可访问。结合我们的浏览器支持和移动应用,你可以在任何地方以任何有助于你完成工作的方式构建你的网站。

¥The WordPress.com Desktop app provides a seamless cross-platform experience that allows you to focus on your content and design with no browser tabs to distract you — or to keep your sites sidelined but accessible. In combination with our browser support and mobile app you can build your site anywhere, in whatever way helps you get your work done.

为什么要构建一个用于管理 WordPress 网站的桌面应用?难道不能全部基于 Web 吗?

¥Why build a Desktop app for managing WordPress sites? Couldn't it all be web-based?

它实际上使用的技术与你在浏览器中访问 WordPress.com 时使用的技术完全相同。然而,它全部在本地托管,因此加载时间极短。借助原生功能(例如在 Dock 中显示、通知等),你可以真正专注于 WordPress 网站和博客。

¥It's actually using exactly the same technology you get when visiting WordPress.com in your browser. However, it's all locally hosted, so it has minimal load times. With the benefit of native features such as being in your dock, notifications, etc., you really can focus on your WordPress sites and blogging.

为什么选择在 Electron 上构建 WordPress 桌面?

¥Why did you choose to build WordPress Desktop on Electron?

2015 年底,我们以 Calypso 的形式重建了 WordPress.com 的大部分内容,Calypso 是一个使用 React 的开源现代 JavaScript 应用。我们开始研究 Electron,并对 Calypso 进行了一些修改,使其能够在本地运行。这是一个引人入胜的体验,我们认为进一步开发它具有很大的价值。

¥At the end of 2015 we rebuilt much of WordPress.com in the form of Calypso, an open-source modern JavaScript app using React. We started looking at Electron and with some changes to Calypso were able to get it running locally. It was a compelling experience and we thought there was a lot of value in developing it further.

我们有几个团队在开发 Calypso。如果使用传统的桌面技术来制作一个完整的多平台 GUI 客户端,需要做更多的工作。通过使用 Electron,我们一个由 2-4 人组成的小团队能够利用其他团队的努力,在几个月内构建桌面应用。

¥We had several teams working on Calypso. To make a full multi-platform GUI client that matched this using traditional desktop technologies would have taken more work. By using Electron, a small team of 2-4 of us were able to leverage the other team’s efforts and build the Desktop app in a couple of months.

在构建 WordPress Desktop 时,你遇到了哪些挑战?

¥What are some challenges you've faced while building WordPress Desktop?

我们很快就让该应用的初始版本运行起来,但将其调整为桌面应用的最佳运行方式则花费了更多时间。该应用的一大挑战是你实际上是在自己的机器上运行 Calypso 的副本。 - 它纯粹是一个由 API 驱动的 UI。这其中涉及大量的衔接工作,并将更改反馈给了 Calypso 本身。

¥We got an initial version of the app running very quickly, but tuning it to behave optimally as a desktop app took a lot more time. One big challenge with the app is that you're actually running a copy of Calypso on your own machine - it’s purely an API driven UI. There was a lot of bridging work involved in this, and changes were fed back to Calypso itself.

此外,我们投入了大量精力为不同平台打包应用。 - 我们提供 Windows、macOS 和 Linux 版本 - 并且存在足够的差异,使得这个问题变得棘手。

¥Additionally a lot of effort was spent packaging the app for different platforms - we provide Windows, macOS, and Linux versions - and there are sufficient differences to make this tricky.

当时 Electron 相对较新,我们不断遇到一些问题,这些问题很快就得到了解决(有时甚至当天就能解决!)。

¥At the time Electron was relatively new and we kept running into issues that were shortly fixed (sometimes the same day!)

Electron 应该在哪些方面改进?

¥In what areas should Electron be improved?

Electron 已经提供了我们桌面应用所需的大部分功能,并且自我们开始使用它以来,它一直在快速发展。话虽如此,桌面应用中有些功能是理所当然的,例如拼写检查和查找/替换,在 Electron 中很难照搬。

¥Electron already provides most of what we need for the Desktop app, and it's progressed rapidly since we started using it. That said, there are some areas that are taken for granted in a desktop app, such as spell checking and find/replace, that are harder to replicate with Electron as-is.

我们也希望看到一些较新的 Chrome 技术也能融入到 Electron 中。我们尤其热衷于尝试 WebVR。

¥We’d also love to see some of the newer Chrome technologies filtering down into Electron too. We’re particularly keen on experimenting with WebVR.

你最喜欢 Electron 的哪些方面?

¥What are your favorite things about Electron?

我们选择 Electron 的主要原因,也是它最大的优势,是其非常活跃和开放的社区。Automattic 始终坚信开源。这是我们的核心原则之一,Electron 项目和社区也遵循许多非常开放和积极的核心信念。

¥The main reason we chose Electron, and it's biggest strength, is the very active and open community. Automattic has always believed in open source. It is one of our core tenets, and the Electron project and community follows a lot of the core beliefs of being very open and positive.

WordPress Desktop 的下一步计划是什么?

¥What's coming next in WordPress Desktop?

我们模型的优点在于桌面应用可以从任何新的 Calypso 功能中受益。 - 我们不断改进。我们希望能够为该应用添加更多功能,例如离线支持(这将真正使该应用进入原生字段)以及更好的系统通知。

¥The great thing about our model is that the Desktop app benefits from any new Calypso feature - there are constant improvements. We’re hoping we can add additional features to the app such as offline support, which would really take the app into native territory, and better system notifications.

Automattic 是否有团队正在开发其他 Electron 应用?

¥Are there any teams at Automattic working on other Electron apps?

是的,在我们努力开发桌面应用之后,Simplenote 团队决定使用 Electron 构建适用于 Windows 和 Linux 的桌面应用(原生 Mac 客户端已存在)。Simplenote Electron 应用 也是开源的,可在 Github 上获取。

¥Yes, after our efforts on the Desktop app, the Simplenote team decided to use Electron to build desktop apps for Windows and Linux (a native Mac client already exists). The Simplenote Electron app is also open source and available on Github.

我们还即将推出使用 Electron 的 Raspberry Pi 集成。

¥We've also got an upcoming Raspberry Pi integration that uses Electron.

如果其中任何一个听起来有趣,那么我们就使用 期待你的反馈

¥If any of that sounds interesting then we'd love to hear from you!

有哪些 Electron 开发技巧可能对其他开发者有用?

¥Any Electron tips that might be useful to other developers?

发布已签名桌面软件的过程对我们来说相对较新,尤其是在 Windows 平台上。我们为 Windows 应用代码签名 撰写了一篇文章,其中包含了整个过程以及我们为了做好这项工作所遇到的一些困难。

¥The process of shipping signed desktop software is relatively new to us, especially for Windows. we wrote up an article for Code Signing a Windows App which includes the process and a few of the hurdles we went through to do it right.