Skip to content

Conversation

@benbucksch
Copy link
Collaborator

Fixes #810

@benbucksch
Copy link
Collaborator Author

@jermy-c Let me know whether this works, please.

@jermy-c
Copy link
Collaborator

jermy-c commented Aug 20, 2025

@jermy-c Let me know whether this works, please.

Sorry, I was trying to test it with an unsigned build but so far I haven't found any way to test auto-updates with unsigned builds.

@benbucksch
Copy link
Collaborator Author

Does the old running build have to be signed, or only the downloaded update needs to be signed?
If the latter, you can simply reduce the local version lower than the release.

@jermy-c
Copy link
Collaborator

jermy-c commented Aug 20, 2025

Does the old running build have to be signed, or only the downloaded update needs to be signed? If the latter, you can simply reduce the local version lower than the release.

The old running build has to be signed. The downloaded update is already signed since it's fetched from GitHub.

@benbucksch
Copy link
Collaborator Author

So, should I just merge this and we test it after 2 releases?

Can you please check the source code, whether you think it will break anything?

Copy link
Collaborator

@jermy-c jermy-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me!

import { ipcMain } from 'electron/main';
import { join } from 'path'
import electronUpdater from 'electron-updater';
import electronUpdater, { UpdateCheckResult } from 'electron-updater';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import electronUpdater, { UpdateCheckResult } from 'electron-updater';
import electronUpdater, { type UpdateCheckResult } from 'electron-updater';

update = await autoUpdater.checkForUpdatesAndNotify();
setInterval(async () => {
try {
if (update?.updateInfo.version) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (update?.updateInfo.version) {
if (update?.isUpdateAvailable) {

Why not use isUpdateAvailable ? Is there still a problem on Linux?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There definitely was a problem on Linux. I don't remember whether I tried this specific code.

});

async function updateAndRestartNowIfNeeded() {
if (update?.updateInfo.version) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (update?.updateInfo.version) {
if (await update?.downloadPromise) {

Maybe we should check if the update is downloaded before installing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (update?.updateInfo.version) {
await update?.downloadPromise;
if (update?.updateInfo.version) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac: Auto-updates are not installed

3 participants