JsSucks / BetterDiscordApp

Better Discord App enhances Discord desktop app with new features.
MIT License
589 stars 117 forks source link

[Bug] Unable to inject BetterDiscord from source, complains about node-sass not being signed. #332

Open FrobtheBuilder opened 5 years ago

FrobtheBuilder commented 5 years ago

Describe the bug Can't inject into Discord on macOS when building from source. Discord launches with a JS error complaining about the node-sass binary being unsigned.

To Reproduce Run npm install, npm run build,npm run release, etc, then npm run inject and get this stupid error on startup then Discord launches without BetterDiscord being properly injected. Try to fix it with npm run build_node-sass and rebuilding but it still doesn't work.

Expected behavior I assume it should launch without that error and have BetterDiscord injected into the client, but it doesn't.

Screenshots image

System information macOS Mojave, Mainline Discord latest version

Are you willing and able to fix this? I assume it has something to do with signing the node-sass binary so Electron will accept it, but I'm not sure exactly what that entails, so I guess not. Perhaps I could figure it out if given enough time but I assume somebody else is probably more qualified to handle this.

samuelthomas2774 commented 5 years ago

I've never had this issue (maybe because I compiled the bindings myself?) but @qwerasd205 has worked around this by removing Discord's signature. You should be able to ad-hoc sign the binding though as suggested in the error:

codesign --force -s - node_modules/node-sass/vendor/darwin-x64-69/binding.node
FrobtheBuilder commented 5 years ago

I tried compiling my own bindings with the build_node-sass thing but I'll try that real quick.

FrobtheBuilder commented 5 years ago

Doesn't work, complains about it being signed adhoc. image

FrobtheBuilder commented 5 years ago

I found something on this here https://github.com/Valloric/YouCompleteMe/issues/3216. I have Homebrew's python@2 installed and I know node-gyp uses python so I'll try removing it and building again. Let me see if that fixes it.

FrobtheBuilder commented 5 years ago

Still doesn't work. Not sure what's up with this.

FrobtheBuilder commented 5 years ago

I fixed it by running codesign --remove-signature on /Applications/Discord.app/Contents/MacOS/Discord.

Phwew, that was annoying. You think there might be a better solution for this?

qwerasd205 commented 5 years ago

The unsigning of the executable will be an automated part of the install process on macOS in the installer.

FrobtheBuilder commented 5 years ago

Alright, then at least it's documented in this issue in case anybody else runs into the same problem.