Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.idea
.env
.env
.env.development
17 changes: 17 additions & 0 deletions src/releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,23 @@ export async function Retrieve(req: express.Request, res: express.Response) {
select: { version: true, url: true, rolloutPercentage: true, hash: true },
});

/*
Copy link
Contributor

Choose a reason for hiding this comment

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

First time looking at this code, just wanted to note that basing the partial rollout logic on the hash of the device id means that the same devices will always be selected for each rollout chunk (e.g. if 10% of devices are being offered the update, the same set of devices will match every time. Perhaps we should salt the hash with the version that will be offered so that each release will select different devices?

https://github.com/jetkvm/cloud-api/pull/18/files#diff-b6141940aa0947caad5e88ffc5955ac65243ab1b0c21345fc72d360a21614aaeR90-R91

Return the latest release if forceUpdate is true, bypassing rollout rules.
This occurs when a user manually checks for updates in the app UI.
Background update checks follow the normal rollout percentage rules, to ensure controlled, gradual deployment of updates.
*/
const forceUpdate = req.query.forceUpdate === "true";
if (forceUpdate) {
return res.json({
appVersion: latestAppRelease.version,
appUrl: latestAppRelease.url,
appHash: latestAppRelease.hash,
systemVersion: latestSystemRelease.version,
systemUrl: latestSystemRelease.url,
systemHash: latestSystemRelease.hash,
});
}

const defaultAppRelease = await getDefaultRelease("app");
const defaultSystemRelease = await getDefaultRelease("system");

Expand Down