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

Linux Love and Care: Major rewrite which adds support for Linux Native, Flatpaks, Snaps and refactors most of the code #282

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

Commits on Aug 23, 2022

  1. Deps: Update from Electron 9 to 13, and update all other dependencies

    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.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    ef8a242 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    701d36a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3279268 View commit details
    Browse the repository at this point in the history
  4. paths.js: Refactoring and add support for Linux Native, Flatpaks & Snaps

    - 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.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    5cd8bf5 View commit details
    Browse the repository at this point in the history
  5. kill.js: Add support for killing/starting Linux Native, Flatpaks & Snaps

    - 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.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    d295a83 View commit details
    Browse the repository at this point in the history
  6. install.js: Complete rewrite of the installation code, adds Flatpak/Snap

    - 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.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    839b86d View commit details
    Browse the repository at this point in the history
  7. repair.js: Complete rewrite of the repair code, adds Flatpak/Snap

    - 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.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    5850f9a View commit details
    Browse the repository at this point in the history
  8. uninstall.js: Complete rewrite of the uninstall code, adds Flatpak/Snap

    - 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.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    06c4a00 View commit details
    Browse the repository at this point in the history
  9. Release v1.2.0 with support for Linux Native, Flatpaks and Snaps

    - Semantic versioning. Increments the minor version to signify all the new features.
    Arcitec committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    64e6165 View commit details
    Browse the repository at this point in the history