Skip to content

Add auto-updater API to Electron server #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

WINBIGFOX
Copy link
Contributor

@WINBIGFOX WINBIGFOX commented Apr 26, 2025

Integrates new auto-updater routes for checking updates and installing them. Also includes event listeners to notify Laravel about update states like availability, download completion, and errors. This enhances the app's ability to manage updates seamlessly.

PR:
NativePHP/laravel: NativePHP/laravel#570

Integrates new auto-updater routes for checking updates and installing them. Also includes event listeners to notify Laravel about update states like availability, download completion, and errors. This enhances the app's ability to manage updates seamlessly.
Copy link
Member

@SRWieZ SRWieZ left a comment

Choose a reason for hiding this comment

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

Looks good, but plugin:test seems to be failing. Can you look into it?

@WINBIGFOX
Copy link
Contributor Author

Oh, okay, I'll check that again.

This commit introduces a new "download-progress" event listener in the autoUpdater module. It forwards progress details, such as percentage and speed, to Laravel via the notifyLaravel function. Additionally, the electron-updater module is now mocked in tests for better coverage.
@WINBIGFOX
Copy link
Contributor Author

@SRWieZ I fixed the test and added the DownloadProgress event

@SRWieZ SRWieZ requested a review from gwleuverink April 29, 2025 10:47
@@ -0,0 +1,61 @@
import express from "express";
import electronUpdater from "electron-updater";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Importing the autoUpdater directly might decrease bundle size (untested)

const router = express.Router();
const { autoUpdater } = electronUpdater;
router.post("/check-for-updates", (req, res) => {
autoUpdater.checkForUpdates();
Copy link
Contributor

Choose a reason for hiding this comment

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

Idea: If you add a guard clause here you might be able to prevent the download from happening multiple times.

Set a Boolean & make sure to reset it when the download finishes/fails

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.

3 participants