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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent .deb packages from being opened with archive manager. #7502

Merged
merged 11 commits into from
Jul 7, 2022

Conversation

Ruk33
Copy link
Collaborator

@Ruk33 Ruk33 commented Mar 3, 2022

Fixes

Issue Number: #7495

What is the current behavior?

With Ubuntu >= 20 .deb packages are opened with archive explorer.

What is the new behavior?

.deb packages are properly installed and the app relaunches when the installation finishes.

image

image

image

^ if there is an error (ie, incorrect password or permission wasn't granted), we let the user know.

image

When the installation finishes, the app will relaunch automatically.

Other information

How to test

From /lbry-desktop/ui/redux/actions/app.js, replace lines 218:224 with:

      // if (
      //   upgradeAvailable &&
      //   !selectModal(state) &&
      //   (!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
      // ) {
      //   dispatch(doOpenModal(MODALS.UPGRADE));
      // }
      dispatch(doOpenModal(MODALS.UPGRADE));

And update line 213 with:

      dispatch({
        type: ACTIONS.CHECK_UPGRADE_SUCCESS,
        data: {
          upgradeAvailable: true, // <- here
          remoteVersion,
        },
      });
  • Run yarn build
  • Install deb package from /lbry-desktop/dist/electron
  • Open up the recent installed version with lbry

PR Checklist

Toggle...

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes)
  • Documentation changes
  • Other - Please describe:

Please check all that apply to this PR using "x":

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I added a line describing my change to CHANGELOG.md
  • I have checked that this PR does not introduce a breaking change
  • This PR introduces breaking changes and I have provided a detailed explanation below

@jessopb
Copy link
Member

jessopb commented Mar 3, 2022

Good progress. I can still get into double downloads. Flow feels good otherwise.

@Ruk33
Copy link
Collaborator Author

Ruk33 commented Mar 4, 2022

Thank you @jessopb for the review. I have sent a fix for it.

@Ruk33 Ruk33 force-pushed the 7495-deb-update-fails-to-launch-on-ubuntu branch from 522ce7a to d4b8c9c Compare March 4, 2022 21:00
@jessopb
Copy link
Member

jessopb commented Mar 7, 2022

I tested this on linux by yarn build this branch after changing the version in package.json to 0.52.4. Then installing that build from the .deb.
Unfortunately, it's throwing an error looking for app-update.yml when lbry is launched from console and never shows the update available notifications. It does provide, in help page, the suggestion to download the lastest version which navigates the user to the download website.
To confirm it was this branch, I built master locally in the same way, with version set to 0.52.4 as well, and the update notifications and nags were present in that case. And there were no console complaints about app-update.yml
It doesn't look to me like something in this pr could change that, but it does ???

@Ruk33
Copy link
Collaborator Author

Ruk33 commented Mar 14, 2022

Hello @jessopb. I'm pretty sure the error you are facing isn't coming from this PR but for this: https://github.com/lbryio/lbry-desktop/pull/7492/files#diff-9e864f33e9f6d8e9a52d5df4de9861f47a3a45222f1f8fb620acd9c37193bb12R198
Notice how we previously, for .deb installations, we check for updates using Native.getAppVersionInfo().then(success, fail); but after the change, it always uses the ipcRenderer.send('check-for-updates', ...) call.

@Ruk33
Copy link
Collaborator Author

Ruk33 commented Mar 14, 2022

To prevent having this error, you can create the following file app-update.yml in /opt/LBRY/resources

owner: lbryio
repo: lbry-desktop
provider: github

And re-open the app. With that, the error no longer shows up:

image

@Ruk33
Copy link
Collaborator Author

Ruk33 commented Mar 21, 2022

Hello, is there anything I need to update in this pr? Please let me know, happy to update if required. Thanks.

@jessopb
Copy link
Member

jessopb commented Mar 23, 2022

This may be the right track, but I'm not sure how this is a solution fit for production. The problem is not only the console error, but also the lack of update notification in the app, which did not happen before, if I recall correctly.
#7502 (comment)

Perhaps the solution is this sort of file copy? https://www.electron.build/configuration/contents#extraresources

@Ruk33 Ruk33 force-pushed the 7495-deb-update-fails-to-launch-on-ubuntu branch from 386d9d0 to 4b922d4 Compare June 22, 2022 02:55
@Ruk33
Copy link
Collaborator Author

Ruk33 commented Jun 22, 2022

@jessopb I have sent an update for the missing app-update.yml. After reading, it seems like just adding it as a additional resource is the best option. Will keep testing tomorrow to make sure everything is ok.

@jessopb
Copy link
Member

jessopb commented Jun 22, 2022

I'm seeing windows misreporting the title of the prerelease as a release, though it upgrades properly.
I'm seeing deb misreporting the release instead of prerelease in the "begin upgrade" modal sudo... [release].deb
Also, closing the upgrade modal (reexposing the nag) and opening it again reinitiates the download.

@Ruk33 Ruk33 force-pushed the 7495-deb-update-fails-to-launch-on-ubuntu branch from b938d31 to f46d008 Compare July 6, 2022 21:15
@jessopb
Copy link
Member

jessopb commented Jul 7, 2022

I'm going to merge this anyways, but:

Couple small bugs for .deb -
Flood of these while downloading

Function provided here: ui.js:2:3954536

Attempting to call a function in a renderer window that has been closed or released.

And, after cancelling download and restarting, progress bar is back at 0 and titled "Downloading Update" (but not making progress). The modal is otherwise ready to upgrade.

Otherwise, the sudo-prompt worked very well.

@@ -35,7 +36,7 @@ const LastReleaseChanges = (props: Props) => {
);

useEffect(() => {
const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest';
const lastReleaseUrl = `https://api.github.com/repos/lbryio/lbry-desktop/releases/tags/${releaseVersion}`;
Copy link
Member

@jessopb jessopb Jul 7, 2022

Choose a reason for hiding this comment

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

There's also something strange that happened - I pushed a tag with 'alpha' in it which ended up on top of the list, but there were no builds associated with it (also, the tag erroneously was nested in "", so updates were failing. Probably some library code that just gets the last tag with a prerelease keyword in it. After I deleted the bad tag, it was fine.

@@ -67,6 +67,7 @@
"remove-markdown": "^0.3.0",
"rss": "^1.2.2",
"source-map-explorer": "^2.5.2",
"sudo-prompt": "^9.2.1",
Copy link
Member

Choose a reason for hiding this comment

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

This repository is archived on github. Something to keep an eye on, or fork for our selves.

// When downloading, we need to remove the initial
// v, ending up with a file name like
// LBRY_0.53.5-alpha.test7495b.deb
const fileName = 'LBRY_' + (releaseVersion || '').replace('v', '') + '.deb';
Copy link
Member

Choose a reason for hiding this comment

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

This could maybe use some error catching/validation. It's fine though.

@jessopb jessopb merged commit f065218 into master Jul 7, 2022
@jessopb jessopb deleted the 7495-deb-update-fails-to-launch-on-ubuntu branch July 7, 2022 20:48
@jessopb
Copy link
Member

jessopb commented Jul 7, 2022

frodo after the thing is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants