问题描述
我正在尝试使用 amazon s3 存储桶设置电子自动更新程序。我没有收到任何错误,但是当我发布新版本时,自动更新程序不会在应用程序屏幕上显示任何更新。但是已发布的最新版本显示在亚马逊 s3 存储桶中。下面显示了它是如何添加的:
require('dotenv').config({path: __dirname + '/.env'});
const aws4 = require('aws4');
const pkg = require('./package.json');
const {app,browserWindow,Menu,protocol,ipcMain} = require('electron');
const log = require('electron-log');
const {autoUpdater} = require("electron-updater");
autoUpdater.on('checking-for-update',() => {
alert('checking')
console.log('checking for updates')
const opts = {
service: 's3',region: pkg.build.publish.region,method: 'GET',host: `s3-${pkg.build.publish.region}.amazonaws.com`,path: path.join('/',pkg.build.publish.bucket,latest_yml_path)
};
aws4.sign(opts,{
accessKeyId: 'access key',secretAccessKey: 'secret access key'
});
// signer.sign(opts); --remove this line --
autoUpdater.requestHeaders = opts.headers
document.getElementById('messages').innerText = "checking for updates"
sendStatusToWindow('Checking for update...');
})
autoUpdater.on('update-available',(info) => {
alert('update available')
sendStatusToWindow('Update available.');
})
autoUpdater.on('update-not-available',(info) => {
sendStatusToWindow('Update not available.');
})
autoUpdater.on('error',(err) => {
sendStatusToWindow('Error in auto-updater. ' + err);
})
autoUpdater.on('download-progress',(progressObj) => {
let log_message = "Download speed: " + progressObj.bytesPerSecond;
log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
sendStatusToWindow(log_message);
})
autoUpdater.on('update-downloaded',(info) => {
sendStatusToWindow('Update downloaded');
});
app.on('ready',function() {
// Create the Menu
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
console.log('ready')
createDefaultwindow();
autoUpdater.checkForUpdatesAndNotify();
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)