Installer
Installer copied to clipboard
Flatpak/snap compatibility
Is your feature request related to a problem? Please describe. The current installer doesn't work in Flatpak.
Describe the solution you'd like
Add flatpak support. You might want to look into the code of betterdiscordctl
to see how that would be done.
Describe alternatives you've considered
I've tried changing the discord path to ~/.var/app/com.discordapp.Discord/config/discord
, but Discord just spit out a "fatal javascript error".
Honestly, supporting flatpak and snap in betterdiscordctl has been a PITA…
This function should be able to find the paths for both flatpak and snap but I haven't tested it:
const {execSync} = require("child_process");
const getLinuxBasedir = function(channel) {
if (channel == "flatpak") {
const output = execSync("flatpak run --command=sh com.discordapp.Discord -c 'printf -- \"$XDG_CONFIG_HOME\"'");
return path.join(output.toString(), "discord");
}
if (channel == "snap") {
const output = execSync("echo 'printf -- \"$SNAP_USER_DATA\"' | snap run --shell discord");
return path.join(output.toString(), ".config", "discord");
}
return path.join(remote.app.getPath("userData"), "..", channel.toLowerCase().replace(" ", ""))
}
It's up to you on how (and if) you will adapt the installer accordingly.
Yeah I'm not sure yet about snap and flatpak support. It would also require a corresponding change in BD (at least for snap).
Flatpak is also sandboxed so I assume it would require the same change.
Also, don't forget Nix.
Nix seems to work fine: NixOS/nixpkgs#118471
Good. Unfortunately, I have left discord (because it's garbage) so farewell, I won't be able to test it.
I was interested in this feature myself, so I made this half-assed build with Flatpak compatibility. It seems to work, though. :)
Here's how:
- Download the pre-compiled AppImage from here (alternatively, you can build it yourself from the flatpak-dev branch).
- Give the AppImage execute permission (if you don't know how, Google it)
- Run the AppImage
- Follow the installer instructions
I've tested the install/repair/remove features and all of them work.
I don't plan on upstreaming that ~~garbage~~ masterpiece, but if someone else wants to, be my guest. However, I do plan to keep the code in sync with upstream (unless Flatpak support is added to the official installer, of course).
About that fork, maybe flatpak option could be automatically applied when ~/.var/app/com.discordapp.Discord/
is detected?
Or automatically applied anyway since it's a fork made specifically for flatpak…
Thanks for the suggestions! It does make sense to make Flatpak the default one, so I did just that.
I've updated the AppImage and instructions as well.
if it ever gets installable on the normal installer put some more focus on flatpak. snap has security issues and flatpak has more priority on non canonical distros
You can try betterdiscordctl
now that it has been updated.
+1
On Fri, May 14 2021 at 12:43:51 PM -0700, alt1478 @.***> wrote:
if it ever gets installable on the normal installer focus on flatpak. snap has security issues and flatpak has more priority on non canonical distros
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BetterDiscord/Installer/issues/26#issuecomment-841463544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3WNPAGGETY2TNL2HZFKWTTNV4PPANCNFSM42IQUUNQ.
any update on this?
any update on this?
Try betterdiscordctl as ObserverOfTime already said
That's not an update
It took you 2 months to come up with that retort?
yes lol. i havent checked my gh notifs
If we give the flatpak discord directory manually we get missing asar error, I solved by running this command:
sudo flatpak override com.discordapp.Discord --filesystem=~/.config/BetterDiscord
While ctl works for normal flatpak it'd be nice to see both beta and normal version since the beta on flathub is canary too. It stinks having to go back to the standard flatpak just to get compatibility on that end with @ObserverOfTime 's clt and just not having luck plugging in where it should be installed from what I can gather....
Hey... I don't see what all the fuss is about and why this has been discussed for years, or even why anyone needs or trusts those "fancy" "betterdiscordctl" or "BetterDiscord-Installer.AppImage" tools anyway. It's literally just 1 little .asar
file that needs to be placed in the Discord folder, and one little config edit. No need for all that hassle or all those bloated applications just to do such a simple little job.
I wrote this oneliner which automatically installs/updates BetterDiscord. It's really that easy, yes. Compare my simple line below to the huge, bloated code (example) of the other methods...
:notebook: The Code:
DISC_CONFIG="$HOME/.var/app/com.discordapp.Discord/config/discord" && BD_ASAR=betterdiscord.asar && wget --timestamping -P "${DISC_CONFIG}/../BetterDiscord/data" -- "https://github.com/BetterDiscord/BetterDiscord/releases/latest/download/${BD_ASAR}" && DISC_VER="$(ls --sort=time --time=creation "${DISC_CONFIG}" | grep -E -m 1 '^[0-9]+\.[0-9]+\.[0-9]+$')" && echo -e "require('../../../../BetterDiscord/data/${BD_ASAR}');\nmodule.exports = require('./core.asar');" | tee "${DISC_CONFIG}/${DISC_VER}/modules/discord_desktop_core/index.js" && echo -e "\nBetterDiscord installed. Restart Discord if currently running." || echo -e "\nInstallation failed."
:sunglasses: You can set the Discord version that you want to install into as follows:
- Edit the
DISC_CONFIG
variable at the start of the line, by only modifying the path that comes afterHOME/
. -
Discord Flatpak (Already DEFAULT in command above, NO NEED to edit anything if you're using this):
.var/app/com.discordapp.Discord/config/discord
-
Discord Native:
.config/discord
-
Discord CANARY Flatpak:
.var/app/com.discordapp.DiscordCanary/config/discordcanary
-
Discord CANARY Native:
.config/discordcanary
:strawberry: How to use:
Just run that command, and it will do the following:
- This is only for the Flatpak and Native versions of Discord and Discord CANARY, obviously. I don't use Snap.
- Automatically downloads the latest BetterDiscord, but only if an update is available. It doesn't download anything at all if there are no updates. It does this by looking at the installed
betterdiscord.asar
file modification timestamp. -
Injects the
betterdiscord.asar
into Discord's loader script for the latest installed Discord version (version is auto-detected). - Verifies every step of the installation process and tells you if it succeeded or if there were any issues.
That's it. Just save this command somewhere. Run it once. That's it. Run it again when you want to update BetterDiscord. You can run it as many times as you want, since it won't change anything if BetterDiscord is already installed and up-to-date.
:arrow_up: Making an easy auto-update alias:
You can even make an alias in your ~/.zshrc
or ~/.bashrc
if you want to easily run this command in your terminal anytime in the future:
alias betterdiscord-update="DISC_CONFIG=\"\$HOME/.var/app/com.discordapp.Discord/config/discord\" && BD_ASAR=betterdiscord.asar && wget --timestamping -P \"\${DISC_CONFIG}/../BetterDiscord/data\" -- \"https://github.com/BetterDiscord/BetterDiscord/releases/latest/download/\${BD_ASAR}\" && DISC_VER=\"\$(ls --sort=time --time=creation \"\${DISC_CONFIG}\" | grep -E -m 1 '^[0-9]+\\.[0-9]+\\.[0-9]+\$')\" && echo -e \"require('../../../../BetterDiscord/data/\${BD_ASAR}');\\nmodule.exports = require('./core.asar');\" | tee \"\${DISC_CONFIG}/\${DISC_VER}/modules/discord_desktop_core/index.js\" && echo -e \"\\nBetterDiscord installed. Restart Discord if currently running.\" || echo -e \"\\nInstallation failed.\""
(Be sure to set your personal DISC_CONFIG
path here if you aren't using the default Flatpak version of Discord.)
:warning: Important:
Note that GitHub presents oneliners as a very long line. Be sure to copy these correctly, or use the "copy text" button that GitHub provides.
:rocket: Updating BetterDiscord:
As for long-term usage and updates, it's very simple too: When Discord starts up, BetterDiscord always does a version check and shows a popup screen to let you know when a new version is available.
In some situations, Discord updates will break BetterDiscord so that it doesn't load at all, and in that case you won't see any notification, but you'll easily notice that BetterDiscord isn't working anymore. In that case, simply run my command to update BetterDiscord to the latest version.
In both scenarios, it's literally brainless. You don't have to think at all. You just look at the built-in Discord notification saying that a new BetterDiscord version is available, or you notice that BetterDiscord is suddenly broken, and you do the update.
It's that easy! :star:
:banana: The End :banana:
Have fun! I hope this helps someone else who just wants a simple, clean and totally safe way to install BetterDiscord for Linux Flatpaks and Native alike, while also helping you effortlessly install BD regardless of whether you use Discord or the Discord CANARY client! This is important since CANARY isn't supported by any of the other installation tools. :beach_umbrella:
In fact, if you're using the Flatpak version of Discord together with my installation method, then you will be totally protected along every step of the way, for both the installation of BetterDiscord itself (there's no malicous code in my script, which is super easy to audit), and you'll also be protected for the usage of all 3rd party plugins inside BetterDiscord itself (since they will run inside the Flatpak sandbox and won't be able to steal all your personal files). That's the installation method that I would recommend to people! :heart_decoration:
:cat2:
@ObserverOfTime LMFAO. You're the guy who made "betterdiscordctl". I noticed that you downvoted my clean solution 30 minutes after I posted it. The amount of saltiness in you doing without a word is hilarious. I'll upvote myself just to annoy you even more. :kiss:
Moving all discussion to #157