From 334391069394defd366933f3455f03170d7e1a30 Mon Sep 17 00:00:00 2001 From: Folf Date: Sun, 14 Aug 2022 01:23:38 +0100 Subject: [PATCH] Install script --- .github/workflows/build.yml | 8 ++++++- README.md | 7 +++++- scripts/install.sh | 46 +++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100755 scripts/install.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e464e2d1..b13d762a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Node.js CI on: push: branches: [ main ] + tags: [ "*" ] pull_request: branches: [ main ] @@ -23,4 +24,9 @@ jobs: - uses: actions/upload-artifact@v3 with: name: linux-fix.node - path: build/Release/linux-fix.node \ No newline at end of file + path: build/Release/linux-fix.node + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: build/Release/linux-fix.node \ No newline at end of file diff --git a/README.md b/README.md index 704ffcf0..2995843e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # Discord Screenshare Linux -WIP repo that adds Discord screenshare support for Wayland and Pipewire aswell as audio sharing, without the need to use the web client. \ No newline at end of file +WIP repo that adds Discord screenshare support for Wayland and Pipewire aswell as audio sharing, without the need to use the web client. + +## Install +``` +sh -c "$(curl https://raw.githubusercontent.com/fuwwy/Discord-Screenshare-Linux/main/scripts/install.sh -sSfL)" +``` diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 00000000..bc83d027 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,46 @@ +#!/bin/sh +username=$(logname) +dirs=(/home/$username/.config/discord*/*/modules/discord_voice) +len=${#dirs[@]} + +if [[ $len -eq 0 ]]; then + echo "No Discord installation found" + exit 1 +fi + +if [[ $len -gt 1 ]]; then + echo "Multiple Discord installations found" + echo "Please select one:" + for i in "${!dirs[@]}"; do + echo -n "$((i+1)) " + echo "${dirs[$i]}" | cut --delimiter='/' --fields=5 + done + read -p "Enter selection: " selection + selectedIndex=$((selection-1)) + selected=${dirs[$selectedIndex]} + if [[ $selectedIndex -lt 0 || $selectedIndex -ge $len ]]; then + echo "Invalid selection" + exit 1 + fi +else + selected=${dirs[0]} +fi + +echo "Installing LinuxFix to $selected..." + +chmod 644 $selected/index.js + +separator="\/\/ ==Discord Screenshare Linux Fix==" + +# Remove any existing installation +sed -i.bak '/^'"$separator"'/,/^'"$separator"'/{/^#/!{/^\$/!d}}' $selected/index.js + +#Download latest +downloadUrl=$(wget -qO- https://api.github.com/repos/fuwwy/Discord-Screenshare-Linux/releases/latest | grep browser_download_url | cut -d '"' -f 4) +wget -O $selected/linux-fix.node -q --show-progress "$downloadUrl" +code=$(wget -qO- https://raw.githubusercontent.com/fuwwy/Discord-Screenshare-Linux/main/scripts/patch.js) + +#echo -e "\n" >> $selected/index.js +echo "$code" >> $selected/index.js + +chmod 444 $selected/index.js \ No newline at end of file