Skip to content

自动升级插件

配置

js
// electron/config/config.default.js

/**
 * 插件功能
 */
config.addons = {
  autoUpdater: {
    enable: true,
    windows: false, // windows平台
    macOS: false, // macOs 需要签名验证
    linux: false, // linux平台
    options: {
      provider: "generic", // or github, s3, bintray
      url: "http://kodo.qiniu.com/", // resource dir, end with '/'
    },
    force: false, // 强制更新(运行软件时,检查新版本并后台下载安装)
  },
};

代码

js
electron / addon / autoUpdater / index.js;

使用

自动升级功能是程序启动时,就要加载的功能,因此需要在预加载模块使用它。

js
/**
 * 预加载模块入口
 */
const Addon = require("ee-core/addon");

module.exports = async () => {
  Addon.get("autoUpdater").create();
};

开发者可根据自身需求完善它的功能。