-
Notifications
You must be signed in to change notification settings - Fork 829
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement auto updater for Windows and Mac #582
Conversation
Wow wow wow!!! Thanks! Will begin the review soon (we're cutting the release candidate for the next server release tomorrow so it might be a couple of days) |
return ( | ||
<div> | ||
<Navbar> | ||
<h1 className='UpdaterPage-heading'>{'New update is available'}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these strings need to be translated into the users' language? Is it possible to access the localization system from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary because the desktop app doesn't have any localization system for now.
const AutoLaunch = require('auto-launch'); | ||
|
||
async function upgradeAutoLaunch() { | ||
if (process.platform === 'darwin') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darwin is MacOS, right? What does this do on Linux platforms? If it's only supported on Windows, I wonder if a whitelist approach might be best here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, darwin
means macOS. On Linux, this function should behave as well as Windows: Reconfigure auto-start for the current version. The feature is not supported on macOS, so it returns soon.
src/main/autoUpdater.js
Outdated
} | ||
|
||
function isUpdateApplicable(appState, updateInfo) { | ||
if (appState.updateCheckedDate.value - (new Date(updateInfo.releaseDate)).value < interval48hours) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these two dates always in a fixed time zone? Like are they both UTC dates? If either is based on the user's timezone, then we may not actually wait 48 hours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UTC is always used.
- updateCheckedDate: Date.prototype.toISOString()
- releaseDate: I can't show in source code. But I confirmed that the date uses UTC ('Z' in ISO format)
Does this mean we as in "us" or can the admin modify this in anyway (I assume it's "us" but thought to ask). As for testing, wondering if there's anything I can test (except review the UI you posted above) until we have a local http server of some kind |
Yeah, it means "us". We can choose one of them:
Whichever we choose one of them, we can add the option to select install location by adding install wizard. This should be discussed at #491, but I wanted to tell a little here. |
Updated the artifacts link and test cases. You would be able to see the dialog after 48 hours by following the steps A. |
@jasonblais Okay, I will continue to work on this branch. |
Thanks @yuya-oc! I'll also get feedback from others about our approach |
30a3a41
to
496838d
Compare
Rebased and added a feature for Windows zip. When using zip packages, "Install Update" button becomes "Download Update" button and it opens https://about.mattermost.com/download/#mattermostApps in user's default browser. |
496838d
to
d01c589
Compare
Rebased: https://circleci.com/gh/yuya-oc/desktop/500#artifacts @jasonblais To test Mac, we need code-signing for newer app (v9.9.9: https://circleci.com/gh/yuya-oc/desktop/501#artifacts) Would you help this? (automation is not needed for now) |
@yuya-oc Awesome! Thanks. I've set time for myself to test this PR thoroughly, and planning to ask other team members to help as well. I'll ask Joram or Jonathan to help code-signing for the Mac |
@yuya-oc I installed the Windows .exe file and edited the URL for I'll wait for 48 hours to see if the update prompt comes up Tuesday evening. Few initial questions/thoughts:
|
Also, just want to reiterate a big thanks for your help on this PR. It'll be a great feature to add for v4.0. My aim is to get all testing and feedback summarized here in the next few days, and prepare to merge this PR within the next two weeks for v4.0 🎉 |
@jasonblais Sorry, probably I had mistake when rebasing. Please stop test for a moment. |
Updated: https://circleci.com/gh/yuya-oc/desktop/502#artifacts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to follow exactly what this is doing as I don't have any experience with electron.
Are we checking the signatures of the downloaded binaries? Where is that done?
onClickRemind: propTypes.func.isRequired, | ||
onClickSkip: propTypes.func.isRequired, | ||
*/ | ||
const appName = 'Storybook App'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for storybook previewing. It appears as application name as a part of dialog sentences. To white labeling the app (e.g. uchat), the app name is injected to the component as a prop.
You can see this name at http://localhost:9001 while running npm run storybook
.
notifyOnly={false} | ||
isDownloading={false} | ||
progress={0} | ||
onClickInstall={action('clicked install')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't this match anything? Is it supposed to be click-install
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. On the actual app, click-install
ipc message is sent from the updater dialog to the main process in order to invoke the function of electron-updater.
@crspeller feedback above ^ |
@yuya-oc Looking for answer to my question so we can get stuff resolved and merged. |
Like discussed/agreed during the videoconf dev meeting yesterday: On Windows:The new msi installers are writing to Program Files which requires admin rights to write into. This auto updater feature is brought by electron and is running in user mode. Therefore, it hasn't rights to write in the Program Files folder. On my side, the development of the Windows service will start soon. On macOS:Keep this auto updater feature like this WITH the "Install Update" button. On GNU/Linux:Like Windows: provide a notification, but WITHOUT offering the ability to update (GNU/Linux distribution have package managers and we really don't want to conflict with them). |
@crspeller Sorry, I missed the question. Checksum and signature are automatically verified by |
Thanks @wget. Please let me confirm. WindowsShould v4.2 app always use "Download Update" button for the dialog? The button opens a web page, https://mattermost.com/download/ macOSAgree. In addition, recent LinuxAgree. However, currently there is no implementation for Linux because I had thought we need to finalize Windows/macOS solution first. Can we continue to discuss on another issue? |
@yuya-oc I don't see our public key anywhere in this PR, how does the signature verification work? |
If this is just a link to a web page. No issue.
Ok. Understood.
Ok. Understood. GNU/Linux is indeed low priority now because its the only OS having excellent package managers. End users won't suffer from a missing auto updater (especially on Arch Linux, since the packages are well maintained <3). |
Indeed this needs to get sorted out. This is a feature I need for msi installer as well. Please provide info how you are singing the applications. So that I can follow the same path for my msi. This is what happens with non signed msi installers that have been downloaded from the web: |
Yeah, “Download Update” button behaves like a link. The download page is opened in their default web browser. @wget @crspeller In my understanding, signature verification is done by Windows itself. So what we need to do in ourselves is verify checksum. Codesining is done by our jenkins, https://build.mattermost.com. So the script to sign exe is included in the private repository (shared pipeline), not in this repository. The script gets private files from Mattermost’s Amazon S3 which stores certificates. The script manually signs the code with osslsigncode. However electron-builder has a mechanism to do code-signing while building the app. We move to AppVeyor, so I believe we can use it. |
@yuya-oc Thanks. Super. I will add these pieces of info together and will try to figure out to add the code signing in the AppVeyor pipeline. |
Updated with "Download Update" (notifyOnly) configuration for Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sounds good. Thanks.
@yuya-oc can you please address the build issue when you can ^ Then I think we are good to merge this? This should be the last PR before we cut the RC for 4.2? |
@esethna Now the error is resolved, so I think this is ready to merge. I'll make another PR. That's the final PR for v4.2: #841 (comment) |
276c199
to
85495ef
Compare
Merged the master branch. For now I merge this branch to suppress more conflicts. We can disable the feature when we need. |
Before submitting, please confirm you've
npm run lint:js
for proper code formattingPlease provide the following information:
Summary
Implement auto updater.
This is a first prototyping of auto-updater. At this time, this PR only considers the Windows installer.
NSIS installer is introduced. It integrates 32-bit and 64-bit installers into one installer file. And the new installation folder becomes
%USERPROFILE%\AppData\Local\Programs\mattermost
(Per user install). We can also chooseC:\Program Files
(Per machine install) by modifying electron-builder settings.Issue link
#15
Test Cases
I prepared a version, v9.9.9 for testing: https://circleci.com/gh/yuya-oc/desktop/366#artifacts
A. simple case with CircleCI
%USERPROFILE%\AppData\Local\Programs\mattermost\resources\app-update.yml
'https://366-67276967-gh.circle-artifacts.com/0/tmp/circle-artifacts.0utXb6g/'
to the value ofurl
B. manual testing for various cases.
latest.yml
andmattermost-setup-9.9.9.exe
.Example:
http-server
npm install -g http-server
http-server -p 8081
under the folder where artifacts are located.http://localhost:8081/latest.yml
.latest.yml
.Additional Notes
https://circleci.com/gh/yuya-oc/desktop/365#artifacts