如何设置Squirrel.window以检查电子发布服务器上的更新-Electron

时间:2018-08-22 22:08:31

标签: javascript node.js electron squirrel.windows electron-forge

我正在尝试使用Electron-release-server更新由电子伪造(以及Squirrel.Windows作为制造商)构建的电子应用程序。 我无法正确设置的是更新Feed。实际上,检查更新的代码部分如下:

const server = 'http://185.25.204.245:1337';
    const platform = 'win' + process.arch.substr(1);
    const feed = `${server}/update/win64/${globals.app.getVersion()}/beta/RELEASES`;
    console.log(feed);
    autoUpdater.setFeedURL(feed);

    autoUpdater.on('error', err => console.log(err));
    autoUpdater.on('checking-for-update', () => console.log('checking-for-update'));
    autoUpdater.on('update-available', () => console.log('update-available'));
    autoUpdater.on('update-not-available', () => console.log('update-not-available'));

    autoUpdater.checkForUpdates();

    /*setInterval(() => {
        autoUpdater.checkForUpdates()
    }, 60000);*/

    autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
        const dialogOpts = {
            type: 'info',
            buttons: ['Restart', 'Later'],
            title: 'Application Update',
            message: process.platform === 'win32' ? releaseNotes : releaseName,
            detail: 'A new version has been downloaded. Restart the application to apply the updates.'
        }

        dialog.showMessageBox(dialogOpts, (response) => {
            if (response === 0) autoUpdater.quitAndInstall()
        })
    });

    autoUpdater.on('error', message => {
        console.error('There was a problem updating the application')
        console.error(message)
    })

启动应用程序时,出现控制台日志:https://hastebin.com/witogagepi.sql 如果您尝试打开feed url,则它实际上可以工作。关于如何正确设置它的任何建议?

0 个答案:

没有答案