博客
关于我
electron部署更新服务器
阅读量:80 次
发布时间:2019-02-26

本文共 759 字,大约阅读时间需要 2 分钟。

electron更新有两种常见的实现方式,分别是基于squirrel打包的传统更新方式以及基于nsis安装的现代化解决方案。

对于windows应用程序的打包更新,squirrel是一个非常流行的选择。这种方法通过electron包中的autoUpdater模块来实现自动更新。在项目中,开发者需要配置github的用户名和仓库名,进而生成feedurl为https://update.electronjs.org/${username}/${repository}。这样一来,更新服务器会自动向github release API获取最新的.nupkg文件并下载最新版本的程序包。通过访问提供的url,可以直接下载最新的更新文件。需要注意的是,这种更新方式仅适用于基于squirrel打包的windows应用程序。

而对于nsis打包的项目而言,传统的更新方式存在一定的局限性,尤其是在与github release无缝集成方面。因此,开发者通常会选择使用开源项目hazel来搭建自定义的更新服务器,并将其部署到平台如vercel上。通过这种方式,开发者可以自由配置安装路径,并通过hazel提供的api接口,动态获取最新版本的程序包。

在实际操作中,开发者需要在环境变量中配置github的账号信息,并通过hazel服务器获取最新的版本信息。然后,将获取到的url拼接到feed = ${url}/update/${process.platform}/${app.getVersion()},从而获取最新的更新文件路径。最后,将这一路径对应的latest.yml中的下载链接用于安装程序的更新。

这种基于hazel的更新方案,不仅提供了灵活的安装路径配置,还能够通过自定义的更新服务器规则,实现更为精细的版本管理。

转载地址:http://pwuk.baihongyu.com/

你可能感兴趣的文章
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
查看>>
No new migrations found. Your system is up-to-date.
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No qualifying bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?>‘ available
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
no session found for current thread
查看>>
no such file or directory AndroidManifest.xml
查看>>