amazon-s3 - 通过亚马逊 s3 的电子自动更新不起作用
问题描述
我正在尝试使用 amazon s3 存储桶设置电子自动更新程序。我没有收到任何错误,但是当我发布新版本时,自动更新程序不会在应用程序屏幕上显示任何更新。但是已发布的最新版本显示在 amazon 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();
});
没有错误显示,但也没有消息显示。哪里可能出错了?
解决方案
推荐阅读
- ruby - Vagrantfile:如何传递带有未转义美元符号的主机环境变量?
- laravel - Laravel 从表单获取值到日期('request->date')
- c# - 具有单个通用参数和多个约束的最小起订量方法
- python - 如何从 pandas DataFrames 列表创建一个 csv 文件?
- wordpress - 如何在 WordPress 中访问成员函数到模板文件?
- javascript - 等到ajax完成后再返回函数
- reactjs - 使用克隆反应拖放
- reactjs - 在没有渲染方法的情况下触发 componentDidMount
- python - 在熊猫数据框中获取成对余弦相似度
- javascript - 在箭头函数中调用 setState 不会改变状态?