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

discord: krisp module doesn't load #195512

Open
surfaceflinger opened this issue Oct 11, 2022 · 48 comments · May be fixed by #290077
Open

discord: krisp module doesn't load #195512

surfaceflinger opened this issue Oct 11, 2022 · 48 comments · May be fixed by #290077
Labels
0.kind: bug Something is broken

Comments

@surfaceflinger
Copy link
Member

Describe the bug

Discord has supported Krisp audio filtering for about 2 months now on GNU/Linux. The problem is that Krisp module simply doesn't load if we're using Discord from nixpkgs. It works on all my machines when I install Discord from Flatpak.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-env --install discord
  2. discord
  3. Check voice settings or stdout

Expected behavior

Krisp should be available

Screenshots

On the left - discord from nixpkgs
On the right - discord-canary from flathub
image

Additional context

I have OpenAsar installed but I tried without it and it's still not loading. Friend has also suggested that probably Discord expects some more standard paths but Krisp is being loaded from home directory. eg. ./.config/discord/0.0.20/modules/discord_krisp so it shouldn't be a problem.

nixpkgs discord log:

[OpenAsar > Init] OpenAsar unstable-2022-10-02
[OpenAsar > Settings] /home/nat/.config/discord/settings.json {
  DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING: true,
  IS_MAXIMIZED: false,
  IS_MINIMIZED: true,
  WINDOW_BOUNDS: { x: 661, y: 271, width: 1280, height: 720 },
  openasar: { setup: true, cmdPreset: 'perf' },
  trayBalloonShown: true
}
[OpenAsar > BuildInfo] { releaseChannel: 'stable', version: '0.0.20' }
[OpenAsar > Modules] Checking
Optional module ./ElectronTestRpc was not included.
[OpenAsar > Modules] Checking
[OpenAsar > AsarUpdate] Removed
[OpenAsar > Settings] Saved

flathub discord log:

[OpenAsar > Init] OpenAsar nightly-c72f1a3
[OpenAsar > Settings] /home/nat/.var/app/com.discordapp.DiscordCanary/config/discordcanary/settings.json {
  openasar: { setup: true, noTyping: true },
  SKIP_HOST_UPDATE: true,
  IS_MAXIMIZED: false,
  IS_MINIMIZED: false,
  WINDOW_BOUNDS: { x: 720, y: 389, width: 1617, height: 885 },
  trayBalloonShown: true
}
[OpenAsar > BuildInfo] { releaseChannel: 'canary', version: '0.0.139' }
[OpenAsar > Modules] Checking
Optional module ./ElectronTestRpc was not included.
WEIGHT /home/nat/.var/app/com.discordapp.DiscordCanary/config/discordcanary/0.0.139/modules/discord_krisp/NC_small_8k.thw
WEIGHT /home/nat/.var/app/com.discordapp.DiscordCanary/config/discordcanary/0.0.139/modules/discord_krisp/NC_small_16k.thw
WEIGHT /home/nat/.var/app/com.discordapp.DiscordCanary/config/discordcanary/0.0.139/modules/discord_krisp/c6.s.f.27f1a3.thw
WEIGHT /home/nat/.var/app/com.discordapp.DiscordCanary/config/discordcanary/0.0.139/modules/discord_krisp/VAD_weight.thw
[OpenAsar > Modules] Checking
[OpenAsar > AsarUpdate] Updating...
[OpenAsar > Settings] Saved

Notify maintainers

@devins2518 @Artturin @Infinidoge

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.71-hardened1, NixOS, 22.11 (Raccoon), 22.11.20221008.c592415`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@surfaceflinger surfaceflinger added the 0.kind: bug Something is broken label Oct 11, 2022
@surfaceflinger surfaceflinger changed the title discord doesn't load krisp module discord: krisp module doesn't load Oct 11, 2022
@Artturin
Copy link
Member

i checked the flatpak repo (commits,issues) but couldn't find a mention of krisp

no mention of krisp in strace either

@pupbrained
Copy link
Member

pupbrained commented Nov 11, 2022

Still an issue on latest canary build (a491bc2, host 0.0.143).

UPDATE: It seems the issue originates from binary stripping. Arch Linux had the same issue, and their fix was to skip binary stripping with options=(!strip).

@ReplayCoding
Copy link
Contributor

This is due to discord adding a signature check against the discord binaries inside the Krisp module, which fail because we patch the binaries to make discord load properly in nixpkgs. Unfortunately we can't patch this from nixpkgs, since discord downloads modules at runtime. But it is possible to manually do it yourself by editing the file ~/.config/discord[canary]/<version>/modules/discord_krisp/discord_krisp.node after discord downloads it.

Inside the function discord::KrispInitialize, we can see that it calls the function discord::util::IsSignedByDiscord (decompiled using ghidra):

util::GetMyProcessFilename(&discord_exe_filename);
is_signed = util::IsSignedByDiscord(&discord_exe_filename);
if (is_signed) {
  // Load Krisp...
}
else {
  puts("Application not signed by Discord, Krisp is not enabled");
  return -3;
}

Looking at the assembly code for the linux version, we can patch the JZ instruction with a 2 byte NOP to go directly to the Krisp loading code, instead of failing:

LEA        RBX=>discord_exe_filename,[RSP + 0xe8]
MOV        RDI,RBX
CALL       discord::util::GetMyProcessFilename
MOV        RDI,RBX
CALL       discord::util::IsSignedByDiscord
TEST       is_signed,is_signed
JZ         return_application_not_signed_error ;; instruction is two bytes long
  ;; Code to load Krisp
return_application_not_signed_error:
  ;; Failure

I've attached an already patched file, which you can replace the already existing file mentioned above with after unpacking it with gunzip. It's based on the krisp module from discord version 0.0.21:

discord_krisp.node patched ver.gz

@Artturin
Copy link
Member

doing it in the wrapper is possible like i did with disabling breaking updates in #197248

@ReplayCoding
Copy link
Contributor

ReplayCoding commented Nov 19, 2022

doing it in the wrapper is possible like i did with disabling breaking updates in #197248

How exactly could this be done? I'm assuming that putting the patched file in the nixpkgs repo would be impossible due to license issues. There's also the issue of version differences, which will complicate things further

@S-NA
Copy link
Contributor

S-NA commented May 14, 2023

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p rizin

addr=$(rz-find -x '4889dfe8........4889dfe8' discord_krisp.node | head -n1)
rizin -q -w -c "s $addr + 0x12 ; wao nop" discord_krisp.node

Here is a patcher script, it should work for future versions given the AoB stays valid. It requires no interaction and does not require distributing a patched file so someone can incorporate this into nixpkgs.

@surfaceflinger
Copy link
Member Author

What about packaging discord inside an fhs env without patching discord executable at all?

@steinerkelvin
Copy link

steinerkelvin commented Jul 2, 2023

I've packaged @S-NA 's solution on github:steinerkelvin/dotfiles#discord-krisp-patch

One can just run:

nix run "github:steinerkelvin/dotfiles#discord-krisp-patch"

and Discord will be patched.

(it's not a package for Discord, just to run the patching script)

@surfaceflinger
Copy link
Member Author

Looks like patches above no longer work on discord-canary

Invalid delta
search: update read error at 0x00151000
WARNING: bin_file_strings: search interval size (0x19c5ac0) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x1ca6414) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x19c5ac0) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x1ca6414) exeeds bin.maxstrbuf (0xa00000), skipping it.
ERROR: core: hack: analysis op fail

@S-NA
Copy link
Contributor

S-NA commented Jul 17, 2023

You can try this, make sure to start from a clean discord_krisp.node by removing your old modules folder. I have not tested this, but from the disassembly I did it should probably work for both canary and stable.

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p rizin

addr=$(rz-find -x '4881ec00010000' discord_krisp.node | head -n1)
rizin -q -w -c "s $addr + 0x30 ; wao nop" discord_krisp.node

@surfaceflinger
Copy link
Member Author

Thanks! Checked on canary and it indeed works :)

@steinerkelvin
Copy link

It seems Discord updated to 0.0.29. Should the patch be updated? If so, how can I do it? @S-NA @ReplayCoding

@blkgoose
Copy link

@steinerkelvin I just tried running the latest patcher on 0.0.29 and it seem to be working correctly.

@steinerkelvin
Copy link

@blkgoose oh, nice. I'll update my flake.

@NovaViper
Copy link
Contributor

I've packaged @S-NA 's solution on github:steinerkelvin/dotfiles#discord-krisp-patch

One can just run:

nix run github:steinerkelvin/dotfiles#discord-krisp-patch

and Discord will be patched.

(it's not a package for Discord, just to run the patching script)

Hey how do I run this? I try to run it inside and outside of nix-shell and my terminal just tells me no matches fround: github:steinerkelvin/dotfiles#discord-krisp-patch

@Artturin
Copy link
Member

I've packaged @S-NA 's solution on github:steinerkelvin/dotfiles#discord-krisp-patch
One can just run:

nix run github:steinerkelvin/dotfiles#discord-krisp-patch

and Discord will be patched.
(it's not a package for Discord, just to run the patching script)

Hey how do I run this? I try to run it inside and outside of nix-shell and my terminal just tells me no matches fround: github:steinerkelvin/dotfiles#discord-krisp-patch

It wasn't quoted, I fixed it.

@NovaViper
Copy link
Contributor

It wasn't quoted, I fixed it.

Thank you! I gave it try again but now it's saying the flake doesn't provide the attributes apps.x86_64-linux.default, defaultApp.x86_64-linux, packages.x86_64-linux.default, and defaultPackage.x86_64-linux

@surfaceflinger
Copy link
Member Author

surfaceflinger commented Sep 21, 2023

btw I have a patcher for discord-canary in my flake, it should also update itself depending on discord-canary version in nixpkgs

nix run github:surfaceflinger/flake#krisp-patch

https://github.com/surfaceflinger/flake/blob/master/packages/krisp-patch/default.nix

@NovaViper
Copy link
Contributor

Has anyone made a patcher for v0.0.29? The patchers listed here don't seem to work at all.
I keep getting this error when I try to run the proposed solution

❯ nix run "github:steinerkelvin/dotfiles#discord-krisp-patch"

Cannot open file '/home/novaviper/.config/discord/0.0.28/modules/discord_krisp/discord_krisp.node'
/nix/store/8282h0glfi8bv28j8z0g09hh37qfgicj-rizin-0.5.2/share/rizin/magic/archive, 139: Warning: New continuation level 2 is more than one larger than current level 0
ERROR: core: hack: analysis op fail

@S-NA
Copy link
Contributor

S-NA commented Oct 3, 2023

Instead of hard coding the Discord version why not just wildcard it?

@Artturin
Copy link
Member

Artturin commented Oct 4, 2023

Has anyone made a patcher for v0.0.29? The patchers listed here don't seem to work at all. I keep getting this error when I try to run the proposed solution

❯ nix run "github:steinerkelvin/dotfiles#discord-krisp-patch"

Cannot open file '/home/novaviper/.config/discord/0.0.28/modules/discord_krisp/discord_krisp.node'
/nix/store/8282h0glfi8bv28j8z0g09hh37qfgicj-rizin-0.5.2/share/rizin/magic/archive, 139: Warning: New continuation level 2 is more than one larger than current level 0
ERROR: core: hack: analysis op fail

pin the nixpkgs in the registry to your system revision and do --override-input nixpkgs nixpkgs to override it to your version

@NovaViper
Copy link
Contributor

Has anyone made a patcher for v0.0.29? The patchers listed here don't seem to work at all. I keep getting this error when I try to run the proposed solution

❯ nix run "github:steinerkelvin/dotfiles#discord-krisp-patch"

Cannot open file '/home/novaviper/.config/discord/0.0.28/modules/discord_krisp/discord_krisp.node'
/nix/store/8282h0glfi8bv28j8z0g09hh37qfgicj-rizin-0.5.2/share/rizin/magic/archive, 139: Warning: New continuation level 2 is more than one larger than current level 0
ERROR: core: hack: analysis op fail

pin the nixpkgs in the registry to your system revision and do --override-input nixpkgs nixpkgs to override it to your version

Thank you! But how the issue is that it's still hardcoded to 0.0.28 and not to the latest version of Discord (which is 0.0.29). Like what @S-NA, the versions shouldn't be hardcoded because then it requires the repo to be updated every time Discord updates

@peat734
Copy link

peat734 commented Nov 14, 2023

I get this error when i run nix run "github:steinerkelvin/dotfiles#discord-krisp-patch" . Using sudo does not help

Cannot open file '/root/.config/discord/0.0.31/modules/discord_krisp/discord_krisp.node'
rz_io_create: Permission denied.
ERROR: [w] Cannot open '/root/.config/discord/0.0.31/modules/discord_krisp/discord_krisp.node' for writing.

@Dokkae6949
Copy link

@peat734 I "fixed" by applying the patch manually. But perhaps you could also try to change the permissions of the file.

@peat734
Copy link

peat734 commented Nov 14, 2023

@Dokkae6949 i also tried applying the patch manually and i got this new error
WARNING: bin_file_strings: search interval size (0x19c31c0) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x1ca3544) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x19c31c0) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x1ca3544) exeeds bin.maxstrbuf (0xa00000), skipping it.

@steinerkelvin
Copy link

steinerkelvin commented Nov 15, 2023

@peat734 If I'm not mistaken, these warnings are always shown, independently if it worked or not. So, if the script didn't fail, your Discord should be patched.

Instead of hard coding the Discord version why not just wildcard it?

@S-NA I'll work on it.

@sersorrel
Copy link
Contributor

fwiw, I have a script that doesn't produce those warnings: https://github.com/sersorrel/sys/blob/f7ff2fa325f786123a9b9e9a61b07be409dfb0b1/hm/discord/krisp-patcher.py (see the adjacent default.nix for a derivation)

use like so: krisp-patcher ~/.config/discord/*/modules/discord_krisp/discord_krisp.node

@peat734
Copy link

peat734 commented Nov 16, 2023

@peat734 If I'm not mistaken, these warnings are always shown, independently if it worked or not. So, if the script didn't fail, your Discord should be patched.

Instead of hard coding the Discord version why not just wildcard it?

@S-NA I'll work on it.

After using the script the krisp module still doesn't load

@eyJhb
Copy link
Member

eyJhb commented Nov 16, 2023

fwiw, I have a script that doesn't produce those warnings: https://github.com/sersorrel/sys/blob/f7ff2fa325f786123a9b9e9a61b07be409dfb0b1/hm/discord/krisp-patcher.py (see the adjacent default.nix for a derivation)

use like so: krisp-patcher ~/.config/discord/*/modules/discord_krisp/discord_krisp.node

Thanks for sharing the script! Really appreciate it! I made a basic home-manager module around it, which just wraps the Discord binary, and runs the patcher each time. Makes Discord slower to start, but.. doesn't really make any difference.

{ config, pkgs, lib, ... }:

let
  cfg = config.programs.discord;

  discordPatcherBin = pkgs.writers.writePython3Bin "discord-krisp-patcher" {
    libraries = with pkgs.python3Packages; [ pyelftools capstone ];
    flakeIgnore = [
      "E265" # from nix-shell shebang
      "E501" # line too long (82 > 79 characters)
      "F403" # ‘from module import *’ used; unable to detect undefined names
      "F405" # name may be undefined, or defined from star imports: module
    ];
  } (builtins.readFile ./discord-patcher.py);

  wrapDiscordBinary = pkgs.writeShellScriptBin "discord" ''
    ${pkgs.findutils}/bin/find -L $HOME/.config/discord -name 'discord_krisp.node' -exec ${discordPatcherBin}/bin/discord-krisp-patcher {} +
    ${pkgs.discord}/bin/discord "$@"
  '';
in {
  options.programs.discord = {
    enable = lib.mkEnableOption "Discord";
    wrapDiscord = lib.mkEnableOption "wrap the Discord binary with a patching each time";
  };

  config = lib.mkIf cfg.enable {
    home.packages = [ discordPatcherBin ]
                    ++ (if cfg.wrapDiscord
                        then [ wrapDiscordBinary ]
                        else [ pkgs.discord ]
                    );

    # consideered adding a service here, that would patch discord using
    # a systemd service, but instead just opted to patch each time Discord starts
  };
}

Requires putting the script into the same folder, as this nix file :)

@steinerkelvin
Copy link

@peat734 If you want to debug it you can DM me on Discord (steinerkelvin).


I've updated my flake so now it detects the Discord version.

❯ nix run --refresh "github:steinerkelvin/dotfiles#discord-krisp-patch"
The last version of discord this script was tested with was 0.0.31
We will patch the file /home/kelvin/.config/discord/0.0.31/modules/discord_krisp/discord_krisp.node

Proceed (y/[n])? y

Patching...
WARNING: bin_file_strings: search interval size (0x19c5ac0) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x1ca6414) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x19c5ac0) exeeds bin.maxstrbuf (0xa00000), skipping it.
WARNING: bin_file_strings: search interval size (0x1ca6414) exeeds bin.maxstrbuf (0xa00000), skipping it.

Done.
If you received warnings, you should probably just ignore them.

The Python script from @sersorrel seems to be better, tho. Maybe I'll incorporate it later.

@kdb424
Copy link

kdb424 commented Nov 18, 2023

Reporting in that the patch works for me as well, and @eyJhb 's code activates it cleanly. Thanks all for the patches.

@m1cr0man
Copy link
Contributor

m1cr0man commented Dec 2, 2023

Also using this successfully - thanks for the patches folks! I modified @eyJhb's wrapper mostly to add a .desktop file for easy desktop launching. It's in my nix-configs repo here.

@hallowatcher
Copy link

hallowatcher commented Jan 10, 2024

I was also faced with this Krisp issue, as well as the issue where it's not possible to stream a window with audio on my NixOS system. For the audio problem, I saw there was a different build for discord, discord-screenaudio. And for the Krisp problem, I found this thread with the python script solution.

However, I found no nice way of combining the two, until I read through the discord-screenaudio alternatives and found
Vesktop. I also saw that it was already part of nixpkgs here.

So my solution to both problems was:

{
  home.packages = with pkgs; [ vesktop ];
}

Now I can stream with audio, and Krisp is working nicely :) Keep in mind this might be against TOS, but Discord is not likely to ban you (read the disclaimers).

Edit 03.07.2024: Krisp doesn't work anymore on vesktop

@MichaelCDormann
Copy link
Contributor

Hi @m1cr0man, using your modified wrapper I get this:

Traceback (most recent call last):
  File "/nix/store/565hzad4dyhlamvilj7xs0bqvimih137-krisp-patcher.py", line 19, in <module>
    isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

Not sure what's wrong.

@eyJhb
Copy link
Member

eyJhb commented Apr 11, 2024

Hi @m1cr0man, using your modified wrapper I get this:

Traceback (most recent call last):
  File "/nix/store/565hzad4dyhlamvilj7xs0bqvimih137-krisp-patcher.py", line 19, in <module>
    isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

Not sure what's wrong.

Use the latest patcher here https://github.com/sersorrel/sys/blob/main/hm/discord/krisp-patcher.py

@eyJhb
Copy link
Member

eyJhb commented Apr 11, 2024

If anyone wants to update it in the future, you might, maybe, could, potentially, somewhat... Not sure.. But grep for the following strings, and replace them in the patcher script, like so...

[nix-shell:~/stash/discord-krisp]$ strings ~/.config/discord/0.0.46/modules/discord_krisp/discord_krisp.node | grep -i KrispInitializeEv
_ZN7discord15KrispInitializeEv
_ZN7discord15KrispInitializeEv

[nix-shell:~/stash/discord-krisp]$ strings ~/.config/discord/0.0.46/modules/discord_krisp/discord_krisp.node | grep -i IsSignedByDiscord
_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
IsSignedByDiscord
_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE

@eyJhb
Copy link
Member

eyJhb commented Apr 11, 2024

I was also faced with this Krisp issue, as well as the issue where it's not possible to stream a window with audio on my NixOS system. For the audio problem, I saw there was a different build for discord, discord-screenaudio. And for the Krisp problem, I found this thread with the python script solution.

However, I found no nice way of combining the two, until I read through the discord-screenaudio alternatives and found Vesktop. I also saw that it was already part of nixpkgs here.

So my solution to both problems was:

{
  home.packages = with pkgs; [ vesktop ];
}

Now I can stream with audio, and Krisp is working nicely :) Keep in mind this might be against TOS, but Discord is not likely to ban you (read the disclaimers).

Want to add to this as well, it seems like Vesktop has "krisp" now, but it doesn't work, at all. :)

@hallowatcher
Copy link

I was also faced with this Krisp issue, as well as the issue where it's not possible to stream a window with audio on my NixOS system. For the audio problem, I saw there was a different build for discord, discord-screenaudio. And for the Krisp problem, I found this thread with the python script solution.
However, I found no nice way of combining the two, until I read through the discord-screenaudio alternatives and found Vesktop. I also saw that it was already part of nixpkgs here.
So my solution to both problems was:

{
  home.packages = with pkgs; [ vesktop ];
}

Now I can stream with audio, and Krisp is working nicely :) Keep in mind this might be against TOS, but Discord is not likely to ban you (read the disclaimers).

Want to add to this as well, it seems like Vesktop has "krisp" now, but it doesn't work, at all. :)

Yep, it's not working anymore.

@eyJhb
Copy link
Member

eyJhb commented Jul 3, 2024

If anyone wants to update it in the future, you might, maybe, could, potentially, somewhat... Not sure.. But grep for the following strings, and replace them in the patcher script, like so...

[nix-shell:~/stash/discord-krisp]$ strings ~/.config/discord/0.0.46/modules/discord_krisp/discord_krisp.node | grep -i KrispInitializeEv
_ZN7discord15KrispInitializeEv
_ZN7discord15KrispInitializeEv

[nix-shell:~/stash/discord-krisp]$ strings ~/.config/discord/0.0.46/modules/discord_krisp/discord_krisp.node | grep -i IsSignedByDiscord
_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
IsSignedByDiscord
_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE

@hallowatcher did you try to copy the new values from here, into the patcher script?

krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[0].entry.st_value
isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value

EDIT: I just closed and opened Discord again, to confirm no new updates, and that it was working.

@hallowatcher
Copy link

hallowatcher commented Jul 3, 2024

If anyone wants to update it in the future, you might, maybe, could, potentially, somewhat... Not sure.. But grep for the following strings, and replace them in the patcher script, like so...

[nix-shell:~/stash/discord-krisp]$ strings ~/.config/discord/0.0.46/modules/discord_krisp/discord_krisp.node | grep -i KrispInitializeEv
_ZN7discord15KrispInitializeEv
_ZN7discord15KrispInitializeEv

[nix-shell:~/stash/discord-krisp]$ strings ~/.config/discord/0.0.46/modules/discord_krisp/discord_krisp.node | grep -i IsSignedByDiscord
_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
IsSignedByDiscord
_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE

@hallowatcher did you try to copy the new values from here, into the patcher script?

krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[0].entry.st_value
isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt4__Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value

EDIT: I just closed and opened Discord again, to confirm no new updates, and that it was working.

I meant the Vesktop solution isn't working anymore.

Krisp is working nicely now with the patch script:

image

@sersorrel
Copy link
Contributor

sersorrel commented Jul 14, 2024

seems like the discord_krisp module has completely disappeared in the latest update. any ideas where they've moved it to? krisp version 0.0.59 crashes when patched like this.

@sersorrel
Copy link
Contributor

update for latest changes to the krisp module (the jump changed size): https://github.com/sersorrel/sys/blob/de1ce2ba941318a05d4d029f717ad8be7b4b09ee/hm/discord/krisp-patcher.py

@chiefnoah
Copy link

update for latest changes to the krisp module (the jump changed size): https://github.com/sersorrel/sys/blob/de1ce2ba941318a05d4d029f717ad8be7b4b09ee/hm/discord/krisp-patcher.py

Looks like it broke again 🙁

@sersorrel
Copy link
Contributor

fixed: sersorrel/sys@d19bd7c

@Sliden101
Copy link

Will this be updated on the wiki?

@sersorrel
Copy link
Contributor

the wiki appears to link to this issue already; however, you can edit the wiki if you feel it can be improved

@sersorrel
Copy link
Contributor

broke again with v0.0.70, now fixed: sersorrel/sys@7806b21

@David-Kopczynski
Copy link

David-Kopczynski commented Nov 3, 2024

For anyone still struggling with this issue and disliking the idea of a krisp-patcher script, I have created a generic electron-wrapper that allows for any url. At the time of writing, support for external urls, screen sharing, spell checking, window management, and krisp is possible! You can use my derivation at: electron-wrapper.nix with your discord config like this: discord.nix. This should (as far as I know) be fine with their TOS, the reason I chose to make this wrapper!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.