gpt4 book ai didi

electron - 将 Electron 应用程序自动更新到特定(非最新)版本

转载 作者:行者123 更新时间:2023-12-03 12:28:15 25 4
gpt4 key购买 nike

我需要支持每个用户(或组)的特殊版本,并且我希望每个用户只有在适合他的情况下才会自动更新到新的可用版本(通过后端中的某种逻辑)。
我试图通过使用 electron-builder 的 electron-updater module 来做到这一点。 ,也可以使用 Electron's autoUpdater内置模块,但似乎两者在调用 autoUpdater.checkForUpdates 时总是获取最新版本.

我见过 deploying my own update server ,其中一些(例如坚果)支持特定版本的下载网址。
如使用 nuts 所述

Specific version for detected platform: http://download.myapp.com/download/1.1.0



但似乎不支持使用 autoUpdater 在应用程序本身中请求特定版本。

总结所有这些: 如何实现自动更新到最新版本以外的特定版本?

最佳答案

我的解决方案是channels .

appUpdater.channel (getter and setter)

Define the channel which the Auto-Updater will follow (see the auto-update with channels tutorial) using appUpdater.channel = 'beta' or get the current channel with currentChannel = appUpdater.channel.



请注意,当使用 GitHub 作为提供者时(目前)不支持 channel ,如 electron-builder autoUpdate documentation 中所述。 :

channel String - Get the update channel. Not applicable for GitHub. Doesn’t return channel from the update configuration, only if was previously set.



您可以将 channel 名称设置为任何名称,甚至可以动态(如果需要)指导您的用户从该 channel 提取更新。

您也可以编辑 {your-channel-name}.latest手动创建文件并添加有助于确定当前“请求更新”用户是否应该使用特定版本的参数(例如,在 update-available 参数中的 updateInfo 事件中)。

关于electron - 将 Electron 应用程序自动更新到特定(非最新)版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59115441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com