Update release server based on Hazel and used by the desktop app.
Deploy this server to https://desktop.replit.com/ via the deployments pane in the Repl
Then set the following code in the Electron client:
const { app, autoUpdater } = require('electron')
const server = "https://desktop.replit.com"
const url = `${server}/update/${process.platform}/${app.getVersion()}`
autoUpdater.setFeedURL({ url })
That's it! ✅
From now on, the auto updater will ask your server for updates!
The following environment variables must be set:
ACCOUNT
: The name of the account that owns the repositoryREPOSITORY
: The name of the repositoryTOKEN
: Your GitHub token (for private repos)URL
: The server's URL
The token must be set to a fine-grained personal access token with access to the replit/desktop repo and content-read permissions.
Such tokens have a max expiry date of 1 year so make sure to rotate them accordingly.
You can view and update the token in the Repl via the secrets pane for development and the deployments pane for production builds.
Displays an overview page showing the cached repository with the different available platforms and file sizes. Links to the repo, releases, specific cached version and direct downloads for each platform are present.
Returns metadata about the latest version of the app from the cache.
Automatically detects the platform/OS of the visitor by parsing the user agent and then downloads the appropriate copy of your application.
If the latest version of the application wasn't yet pulled from GitHub Releases, it will return a message and the status code 404
. The same happens if the latest release doesn't contain a file for the detected platform.
Accepts a platform (like "darwin" or "win32") to download the appropriate copy your app for. I generally suggest using either process.platform
(more) or os.platform()
(more) to retrieve this string.
Also used to download certain platform-specific binaries like .dmg
and nupkg
files.
If the cache isn't filled yet or doesn't contain a download link for the specified platform, it will respond like /
.
Checks if there is an update available by reading from the cache.
If the latest version of the application wasn't yet pulled from GitHub Releases, it will return the 204
status code. The same happens if the latest release doesn't contain a file for the specified platform.
This endpoint was specifically crafted for the Windows platform (called "win32" in Node.js).
Since the Windows version of Squirrel (the software that powers auto updates inside Electron) requires access to a file named "RELEASES" when checking for updates, this endpoint will respond with a cached version of the file that contains a download link to a .nupkg
file (the application update).
To run the Jest tests under test/
, simply run yarn run jest
.
Make sure the TOKEN
and URL
env vars are set before doing so as some tests require them.