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

LL&C 2: Electric Boogaloo #348

Draft
wants to merge 9 commits into
base: development
Choose a base branch
from

Conversation

samfundev
Copy link

I've rebased #282 with the development branch and tried to fix the comments that were left on the original PR. The move to core injection (#299) changed a bunch of stuff. I most likely didn't incorporate everything correctly, so please double check things.

@rauenzi
Copy link
Member

rauenzi commented May 4, 2023

Thanks for doing this Sam, I'll take a look soon. Just at a glance, it looks like a lot of my comments from then will still apply here.

@kaosine
Copy link

kaosine commented Dec 15, 2023

Is there any updates on this version? I know it's a bit out of date now, but the original this is based on seems to have stopped working on fedora 39 so I'm not sure if there's some update that needs to be made on this one too. I just want to be able to install the flatpak canary version somehow since other options aren't working either anymore...

@samfundev
Copy link
Author

I was mostly waiting for feedback from @rauenzi about the PR. Not sure if I should catch this PR up to the latest changes.

@samfundev samfundev changed the title L:heart:&C 2: Electric Boogaloo L :heart &C 2: Electric Boogaloo Mar 9, 2024
@samfundev samfundev changed the title L :heart &C 2: Electric Boogaloo LL&C 2: Electric Boogaloo Mar 9, 2024
We need Electron 13 so that we can successfully launch on modern Linux distros which have a new version of "glibc".

However, we can't go beyond Electron 13 since the "remote" API which this application is entirely built around has been removed in newer versions. They now require that all applications use sockets to talk to the backend to interact with the operating system, rather than directly interacting via calls to "remote" in the GUI code. So a switch to Electron 14 or newer would require a heavy rewrite of this project.

All other dependencies have also been updated to fix bugs in the dependencies. And the "tmp" dependency has been added for generation of safe, cross-platform temp filenames.
- The per-platform path discovery algorithms have now been separated into individual functions for easier maintainability.

- The code now supports finding multiple paths, if the person has installed the client in multiple locations (such as Flatpak, Snap and Native). However, since all the other code expects a single path, we currently just grab the first path we find, prioritizing Flatpak paths over Snap paths over Native paths, in that order.

- The Linux code for finding the Discord path now uses the proper "xdg-config" variable (~/.config).

- Linux support has been added for Flatpaks, Snaps and Native installations of Discord. The hardcoded config paths we use are completely universal for all machines, since they are standardized by Flatpak and Snap, respectively. For native, we respect xdg-config as intended.

- Version detection has been refactored into a single function that is called everywhere in the code, rather than having 5 spread out code locations that all contain their own implementations of the same thing (which was a potential source of future bugs).

- Added comments to all code to help future maintainers/contributors.
- Raised relaunch delay from 1s to 1.5s for all platforms. It's safer for people with slow computers.

- Implemented detection of whether a Linux binary was launched as a Flatpak, Snap or Native.

- Added support for launching Discord's Linux Flatpaks, Snaps and Native, via their proper launch methods ("flatpak run", "snap run" or directly calling the native binary), along with now using the correct way to "spawn()" binaries on Linux (the old code used shell.openPath which does not work on Linux at all). All launch methods now set the correct "working directory" for the launched binary, to ensure that everything launches properly.

- Improved the GUI's logging messages. Words like "kill" have been replaced with "close", since non-technical users are the primary audience of BetterDiscord-Installer.

- Added detailed comments for future maintainers and contributors.
- Functions now take arguments rather than abusing global variables.

- Fixed the BetterDiscord ASAR downloading code to handle missing URLs without crashing.

- Implemented a better method of loading the BetterDiscord ASAR on Linux, via relative paths rather than hardcoding absolute paths. This makes the config portable between Native, Flatpak and Snap installations, and means that it won't break anymore if the user's home-folder is renamed or if they move the data to another computer/account.

- Added support for installing BetterDiscord's ASAR into multiple folders at the same time (via the "bdFolders" variable that we now build). This new feature is used for the Linux Flatpak/Snap support, since we need to install BetterDiscord separately into their sandboxes.

- The ASAR downloading process is now 2-3x faster, since it now saves it to a single, temporary file, and then copies that file into *all* Discord target paths (all Discord versions), so that it doesn't waste time downloading the exact same file over and over again for all destinations whenever the user has multiple Discord versions/paths on their system.

- The code for migrating old BetterDiscord installations has been rewritten to support all platforms, not just Macs. This makes it easy to do future moves of the BD data folders on any platform.

- Improved the GUI's logging messages, with better explanations instead of technical words such as "shims", since non-technical users are the primary audience of BetterDiscord-Installer.

- Added detailed comments for future maintainers/contributors.
- Now uses the unified function to "find latest Discord version", which solves the previous issues of having differing implementations everywhere.

- The "deleteAppDirs" function has been disabled on Linux, since it's completely irrelevant there. And its logging on Mac/Windows has been revised so that it doesn't output anything if there's nothing to delete.

- The "deleteModuleDirs" function has been rewritten to support Linux, and to support Flatpaks and Snaps. Its logging has also been revised for all platforms so that it doesn't output anything if there's nothing to delete.

- The "showInstallNotice" function has been completely rewritten to handle the fact that Discord *must* be started manually by the user to re-download its latest modules before we're able to install BetterDiscord again. The old "Repair" code was broken since it deleted Discord's modules-folders and then attempted to install BetterDiscord into those deleted folders. The new code warns the user about the situation and provides instructions for what they have to do, and won't let them proceed with the installation of BetterDiscord again until it has verified that the user has launched Discord manually (by checking that the installaton paths exist again).

- Improved the popup message formatting, for greater clarity.

- Improved the GUI's logging messages, with better explanations such as "exiting" instead of "killing", since non-technical users are the primary audience of BetterDiscord-Installer.

- Added detailed comments for future maintainers/contributors.
- Now uses clearer variable names and improved code formatting.

- Improved the GUI's logging messages, with better explanations such as "restarting" instead of "killing", since non-technical users are the primary audience of BetterDiscord-Installer.

- Added detailed comments for future maintainers/contributors.
- Semantic versioning. Increments the minor version to signify all the new features.
@rauenzi
Copy link
Member

rauenzi commented Mar 10, 2024

Just for any curious people looking for updates, Sam and I have spoken in Discord DMs and I better understand the process and folder structure needed for snap and flatpak support. The installer is in the process of being rewritten to de-couple the frontend and backend and I'll be sure Sam is involved in the process as well as the testing

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.

None yet

4 participants