upgpkg: discord-electron 0.0.39-2: update electron

* Update Electron version to 27
* Update launch script to require config variable set in order to patch Krisp binary
This commit is contained in:
Manuel 2024-01-04 15:07:13 +01:00
parent 1f7fac9ee7
commit 27a74ff543
Signed by: SunRed
GPG Key ID: 4085037435E1F07A
4 changed files with 26 additions and 20 deletions

View File

@ -1,7 +1,7 @@
pkgbase = discord-electron
pkgdesc = Discord using system provided electron (v24) for increased security and performance
pkgdesc = Discord using system provided electron (v27) for increased security and performance
pkgver = 0.0.39
pkgrel = 1
pkgrel = 2
url = https://discord.com
install = discord-electron.install
arch = x86_64
@ -9,7 +9,7 @@ pkgbase = discord-electron
makedepends = asar
makedepends = curl
makedepends = python-html2text
depends = electron24
depends = electron27
depends = libxss
optdepends = libpulse: Pulseaudio support
optdepends = libappindicator-gtk3: Systray indicator support
@ -21,6 +21,6 @@ pkgbase = discord-electron
source = https://dl.discordapp.net/apps/linux/0.0.39/discord-0.0.39.tar.gz
source = discord-launcher.sh
sha512sums = 9f18aea5d82f5db4efa9db9babbc440b24e47dc80df18df5cc58d99d677f1c0863df21ed96d69896785f8fbe0dc0ff1f7317398b8f39606289da79f5a38074f1
sha512sums = 723250b70c7f5367701675c6581e9eac2143263910c4ffc35957a6ab858492c5febe89ea0d46fce19ac1416c23d9ca3953e48b9db5aa174b4a401fb6efa5daf5
sha512sums = e68467468e9ebfe7aae873442998bda03212598a87d9af1b9ac976fdbafc81eb376e7770dccca6eb943d579f39717a0473fa4f0a46a0c3e436460688827a2dc7
pkgname = discord-electron

View File

@ -14,8 +14,8 @@
pkgname=discord-electron
_pkgname=discord
pkgver=0.0.39
pkgrel=1
_electronver=24
pkgrel=2
_electronver=27
_electronname="electron${_electronver}"
pkgdesc="Discord using system provided electron (v${_electronver}) for increased security and performance"
arch=('x86_64')
@ -36,7 +36,7 @@ optdepends=(
source=("https://dl.discordapp.net/apps/linux/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
'discord-launcher.sh')
sha512sums=('9f18aea5d82f5db4efa9db9babbc440b24e47dc80df18df5cc58d99d677f1c0863df21ed96d69896785f8fbe0dc0ff1f7317398b8f39606289da79f5a38074f1'
'723250b70c7f5367701675c6581e9eac2143263910c4ffc35957a6ab858492c5febe89ea0d46fce19ac1416c23d9ca3953e48b9db5aa174b4a401fb6efa5daf5')
'e68467468e9ebfe7aae873442998bda03212598a87d9af1b9ac976fdbafc81eb376e7770dccca6eb943d579f39717a0473fa4f0a46a0c3e436460688827a2dc7')
_krisp_b2sum='310e3d5ad2311ceace91d20004a677c1a1e49fa1cd5c0458ee5bdb31c01c49df68cac625e66dadcaddf90c67568cde22c2cec3c0b6bca8385225141a8d8d53c1'

View File

@ -1,4 +1,12 @@
post_upgrade() {
# return if old package version is greater than or equal to 0.0.39-1...
(( $(vercmp $2 '0.0.39-2') >= 0 )) && return
cat <<EOF
==> In order to patch Krisp noise suppression support set 'PATCH_KRISP=true'
in '~/.config/discord.conf' in addition to having 'rizin' installed.
EOF
# return if old package version is greater than or equal to 0.0.27-5...
(( $(vercmp $2 '0.0.27-5') >= 0 )) && return
@ -18,9 +26,10 @@ EOF
post_install() {
cat <<EOF
==> For Krisp noise suppression support consider installing 'rizin'. Restart
your Discord client after installation or update to apply the patch.
==> In case of performance problems consider adding or uncommenting Electron
flags in '~/.config/discord-flags.conf'.
==> For Krisp noise suppression support consider installing 'rizin' and
setting 'PATCH_KRISP=true' in '~/.config/discord.conf'. Restart your
Discord client afterwards to apply the patch.
==> In case of performance problems consider setting additional flags
in '~/.config/discord-flags.conf'.
EOF
}

View File

@ -5,29 +5,26 @@ set -euo pipefail
declare -a flags
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@.conf" ]] && source "${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@.conf"
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf"
krisp_bin="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@/@PKGVER@/modules/@PKGNAME@_krisp/@PKGNAME@_krisp.node"
krisp_b2=@KRISPB2@
if hash rizin &> /dev/null; then
if hash rizin &> /dev/null && [[ "${PATCH_KRISP}" == true ]]; then
# Patch Krisp binary to ignore signature check
if [[ -f "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == $krisp_b2 ]]; then
if [[ -w "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == $krisp_b2 ]]; then
addr=$(rz-find -x '4881ec00010000' "${krisp_bin}" | head -n1)
rizin -q -w -c "s $addr + 0x30 ; wao nop" "${krisp_bin}" &> /dev/null
fi
fi
if [[ -f "${flags_file}" ]]; then
if [[ -w "${flags_file}" ]]; then
# Replacing because old flag does not work
if grep -q '\--ignore-gpu-blacklist' "${flags_file}"; then
sed -i "s|--ignore-gpu-blacklist|--ignore-gpu-blocklist|" "${flags_file}"
fi
mapfile -t < "${flags_file}"
else
cat > "${flags_file}" <<EOF
#--ignore-gpu-blocklist
#--enable-gpu-rasterization
#--enable-zero-copy
EOF
fi
for line in "${MAPFILE[@]}"; do