Skip to content

Commit

Permalink
Install script
Browse files Browse the repository at this point in the history
  • Loading branch information
itsfolf committed Aug 14, 2022
1 parent 9018814 commit 3343910
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Node.js CI
on:
push:
branches: [ main ]
tags: [ "*" ]
pull_request:
branches: [ main ]

Expand All @@ -23,4 +24,9 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: linux-fix.node
path: build/Release/linux-fix.node
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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
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)"
```
46 changes: 46 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3343910

Please sign in to comment.