Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch macOS update mechanism to static JSON mode #461

Merged
merged 5 commits into from
Dec 5, 2022
Merged

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Nov 25, 2022

Notes: This allows the update server to be entirely static, such as a CDN or object store, as defined at https://github.com/Squirrel/Squirrel.Mac#update-file-json-format

This is a high risk change but has undergone manual testing. When we migrate packages.element.io over to R2 we won't be able to maintain the PHP script for Squirrel.Mac updating so have switched to its newer JSON mode. For backwards compatibility we will set up rewrites from https://packages.element.io/{desktop,nightly}/update/macos/ -> $/releases-legacy.json (file example) - this will instruct all clients still looking in the old path (outdated ones) to update to a modern build which looks at the new releases.json and handles update recognition itself.


Here's what your changelog entry will look like:

馃毃 BREAKING CHANGES

  • This allows the update server to be entirely static, such as a CDN or object store, as defined at https (#461).

@t3chguy t3chguy added the T-Task Tasks for the team like planning label Nov 25, 2022
@t3chguy t3chguy added X-Breaking-Change T-Enhancement and removed T-Task Tasks for the team like planning labels Nov 28, 2022
@t3chguy t3chguy changed the title Prepare for switching macOS update mechanism Switch macOS update mechanism to static JSON mode Nov 28, 2022
@t3chguy t3chguy marked this pull request as ready for review November 30, 2022 15:22
@t3chguy t3chguy requested a review from a team as a code owner November 30, 2022 15:22
@richvdh
Copy link
Member

richvdh commented Dec 1, 2022

This allows the update server to be entirely static, such as a CDN or object store, as defined at https (#461).

This doesn't seem like a complete changelog entry.

@richvdh
Copy link
Member

richvdh commented Dec 1, 2022

For reference, here is the proposal as I understand it.

The current update URL for macOS is something like https://packages.element.io/desktop/update/macos/?localVersion=1.11.10, and that returns a JSON response that looks like:

{ "url": "https://packages.element.io/desktop/update/macos/Element-1.11.15-universal-mac.zip" } 

(similarly for s/desktop/nightly/.)

However, importantly, if the version in the query string is up to date, it returns a 204 to indicate no update is necessary. This is problematic, because it is served by a PHP script.

The proposal is:

  1. Set up a rewrite (? or a redirect?) from https://packages.element.io/nightly/update/macos/ to https://packages.element.io/nightly/update/macos/releases-legacy.json, which will return json of the same format:

    { "url": "https://packages.element.io/nightly/update/macos/Element%20Nightly-2022120101-universal-mac.zip" }

    (ditto for desktop). This need never return a 204, because any application hitting that URL must be out of date.

  2. Tell the Squirrel updater to check https://packages.element.io/desktop/update/macos/releases.json instead, which will use an updated format.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Seems plausible to me, though:

  1. I wouldn't have minded a clearer walk-through of the current mechanism and why it won't work on R2, rather than having to figure it out myself.
  2. The documentation at https://github.com/Squirrel/Squirrel.Mac#server-support makes it read like the 204 response is still a requirement. Are you sure it's not? (To be fair, it also says "you can store your update metadata on S3", so it's entirely believable that the docs are just wrong).
  3. It would be nice if we could figure out a way to document that releases-legacy magic somehow so we remember what it's doing when we come back to it in a year's time
  4. Currently these URLs are 404s. I take it that is not a problem?

@t3chguy
Copy link
Member Author

t3chguy commented Dec 2, 2022

You got it all bang on, apologies for not making it clearer straight off the bat.

Tell the Squirrel updater to check packages.element.io/desktop/update/macos/releases.json instead, which will use an updated format.

Yup, and instruct it to use that newer format, unfortunately it isn't smart enough to magically decide based on the response.

The documentation at Squirrel/Squirrel.Mac#server-support makes it read like the 204 response is still a requirement. Are you sure it's not? (To be fair, it also says "you can store your update metadata on S3", so it's entirely believable that the docs are just wrong).

All old clients will get a 200 OK (via transform [rewrite]) with the URL to update to a version which uses the new JSON mechanism, so will unconditionally tell them to update, then they'll never look at the file again. The docs are a little poor, but the last section is a complete alternative, having read the underlying Obj-C code and having performed tests, it works exactly as expected if you just read that last section on its own

It would be nice if we could figure out a way to document that releases-legacy magic somehow so we remember what it's doing when we come back to it in a year's time

It'll be implemented in terraform, we can make sure it is clear there

Currently these URLs are 404s. I take it that is not a problem?

They work fine for me, only thing lacking is the transforms
https://packages.element.io/nightly/update/macos/releases-legacy.json
https://packages.element.io/nightly/update/macos/releases.json
The /desktop/ ones not yet as there hasn't been a release since the element-builder changes landed, and don't need to be in place until the redirects are ready to enable.

@richvdh
Copy link
Member

richvdh commented Dec 2, 2022

The docs are a little poor, but the last section is a complete alternative,

Ok, the docs really fail to make that clear, but thanks for double-checking!

The /desktop/ ones not yet

Right, it was the /desktop/ ones I was looking at. Fair enough, thanks.

@t3chguy t3chguy merged commit 23fac47 into develop Dec 5, 2022
@t3chguy t3chguy deleted the t3chguy-patch-4 branch December 5, 2022 12:41
su-ex added a commit to SchildiChat/element-desktop that referenced this pull request Jan 15, 2023
* This allows the update server to be entirely static, such as a CDN or object store, as defined at https ([\element-hq#461](element-hq#461)).
* Enable threads by default ([\#9736](matrix-org/matrix-react-sdk#9736)). Fixes element-hq/element-web#19270 element-hq/element-web#21910 and element-hq/element-web#23946.
* Add inline code formatting to rich text editor ([\#9720](matrix-org/matrix-react-sdk#9720)).
* Add emoji handling for plain text mode of the new rich text editor ([\#9727](matrix-org/matrix-react-sdk#9727)).
* Overlay virtual room call events into main timeline ([\#9626](matrix-org/matrix-react-sdk#9626)). Fixes element-hq/element-web#22929.
* Adds a new section under "Room Settings" > "Roles & Permissions" which adds the possibility to multiselect users from this room and grant them more permissions. ([\#9596](matrix-org/matrix-react-sdk#9596)). Contributed by @GoodGuyMarco.
* Add emoji handling for rich text mode ([\#9661](matrix-org/matrix-react-sdk#9661)).
* Add setting to hide bold notifications ([\#9705](matrix-org/matrix-react-sdk#9705)).
* Further password reset flow enhancements ([\#9662](matrix-org/matrix-react-sdk#9662)).
* Snooze the bulk unverified sessions reminder on dismiss ([\#9706](matrix-org/matrix-react-sdk#9706)).
* Honor advanced audio processing settings when recording voice messages ([\#9610](matrix-org/matrix-react-sdk#9610)). Contributed by @MrAnno.
* Improve the visual balance of bubble layout ([\#9704](matrix-org/matrix-react-sdk#9704)).
* Add config setting to disable bulk unverified sessions nag ([\#9657](matrix-org/matrix-react-sdk#9657)).
* Only display bulk unverified sessions nag when current sessions is verified ([\#9656](matrix-org/matrix-react-sdk#9656)).
* Separate labs and betas more clearly ([\#8969](matrix-org/matrix-react-sdk#8969)). Fixes element-hq/element-web#22706.
* Show user an error if we fail to create a DM for verification. ([\#9624](matrix-org/matrix-react-sdk#9624)).
* Prevent unnecessary m.direct updates ([\#9805](matrix-org/matrix-react-sdk#9805)). Fixes element-hq/element-web#24059.
* Fix checkForPreJoinUISI for thread roots ([\#9803](matrix-org/matrix-react-sdk#9803)). Fixes element-hq/element-web#24054.
* Load RTE components only when RTE labs is enabled ([\#9804](matrix-org/matrix-react-sdk#9804)).
* Fix issue where thread panel did not update correctly ([\#9746](matrix-org/matrix-react-sdk#9746)). Fixes element-hq/element-web#23971.
* Remove async call to get virtual room from room load ([\#9743](matrix-org/matrix-react-sdk#9743)). Fixes element-hq/element-web#23968.
* Check each thread for unread messages. ([\#9723](matrix-org/matrix-react-sdk#9723)).
* Device manage - handle sessions that don't support encryption ([\#9717](matrix-org/matrix-react-sdk#9717)). Fixes element-hq/element-web#23722.
* Fix hover state for formatting buttons (Rich text editor) (fix element-hq/element-web/issues/23832) ([\#9715](matrix-org/matrix-react-sdk#9715)).
* Don't allow group calls to be unterminated ([\#9710](matrix-org/matrix-react-sdk#9710)).
* Fix replies to emotes not showing as inline ([\#9707](matrix-org/matrix-react-sdk#9707)). Fixes element-hq/element-web#23903.
* Update copy of 'Change layout' button to match Element Call ([\#9703](matrix-org/matrix-react-sdk#9703)).
* Fix call splitbrains when switching between rooms ([\#9692](matrix-org/matrix-react-sdk#9692)).
* bugfix: fix an issue where the Notifier would incorrectly fire for non-timeline events ([\#9664](matrix-org/matrix-react-sdk#9664)). Fixes element-hq/element-web#17263.
* Fix power selector being wrongly disabled for admins themselves ([\#9681](matrix-org/matrix-react-sdk#9681)). Fixes element-hq/element-web#23882.
* Show day counts in call durations ([\#9641](matrix-org/matrix-react-sdk#9641)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants