Progress
- With the help of @laurent , I fixed the problem from last week by setting the parameter
forceDevUpdateConfig
from autoUpdater to true. - Added caching -
updaterCacheDirName
is a configuration option used in electron-builder to specify the name of the directory where update-related files (such as downloaded updates) are cached. This directory is used by the auto-updater to store downloaded update files before they are applied. I have named the directory joplin-update-cache. - Added differential updates - for differential updates to work, both the current version and the new version of the application need to have blockmap files.
- Files required for differential updates to work: latest.yml, blockmaps of both versions (the current one and the new one), the full installer for the new version.
- Added the logger from electron-log.
- Now the notification will only be opened once, there will not be multiple instances, even if the checking period passes.
Process Flow for Differential Updates
- Check for Updates:
- The updater checks if a new version is available by comparing the current version with the latest version info from the server.
- Download Blockmap Files:
- If a new version is available, the updater downloads the blockmap files for both the old and new versions.
- Apply Differential Update:
- The updater compares the old and new blockmap files to identify the differences.
- It uses the old version installer file (cached locally) and the new version blockmap to apply only the changed parts.
- This reduces the download size and speeds up the update process.
- Fallback to Full Download:
- If the differential update fails (e.g., missing old version installer file), the updater falls back to downloading the entire new version installer.
Plans
- Write code for a new notification, similar to the trash notification that Joplin uses and similar to the update notification from VSCode, to let the user decide if she/he wants to update now or later.
- Addition of signature for updates? I have found this code: tutanota/src/desktop/ElectronUpdater.js at 12f10bed6a1048ba28d6d9d0d89d95a58e6971f7 · tutao/tutanota · GitHub which implements it ... maybe it would be a good idea?
- Tests for the service (not next week)
- Check to use github releases instead of local server (not next week)
Problems
- I have the error
Cannot download differentially, fallback to full download: Error: ENOENT: no such file or directory, open 'C:\Users\alice\AppData\Local\joplin-update-cache\installer.exe'
. The installer for the current version is not cached, I have to investigate this. But the files mentions above are retrieved and compared. - This is from last week, I didn't manage to look over it yet: Right now, even if I close the application (or even uninstall it), the server still checks for updates, which I think is weird. I want to investigate this. It is not hard to solve it. On the dev environment this is not reproduced though.