Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.

Add auto-updater API to Electron server#213

Merged
SRWieZ merged 6 commits into
NativePHP:mainfrom
WINBIGFOX:add-auto-updater-api
May 8, 2025
Merged

Add auto-updater API to Electron server#213
SRWieZ merged 6 commits into
NativePHP:mainfrom
WINBIGFOX:add-auto-updater-api

Conversation

@WINBIGFOX
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

@SRWieZ I fixed the test and added the DownloadProgress event

@SRWieZ SRWieZ requested a review from gwleuverink April 29, 2025 10:47
Comment thread resources/js/electron-plugin/dist/server/api/autoUpdater.js Outdated
const router = express.Router();
const { autoUpdater } = electronUpdater;
router.post("/check-for-updates", (req, res) => {
autoUpdater.checkForUpdates();
Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's such a bad idea, but I don't know how reliably it will work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah it def needs some manual testing. We can always add it later if we want. What do you think @SRWieZ ?

Simplified the import syntax by directly importing `autoUpdater` from `electron-updater` instead of using the default export. Adjusted related mock implementation and type imports to align with this change, improving code readability and maintainability.
@SRWieZ SRWieZ merged commit ae8a902 into NativePHP:main May 8, 2025
26 of 27 checks passed
PeteBishwhip pushed a commit that referenced this pull request May 8, 2025
* Add auto-updater API to Electron server

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.

* Add download-progress listener to autoUpdater

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.

* Update api.test.ts

* Refactor electron-updater imports for consistency and clarity

Simplified the import syntax by directly importing `autoUpdater` from `electron-updater` instead of using the default export. Adjusted related mock implementation and type imports to align with this change, improving code readability and maintainability.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants