sneedmc/cf.sh

26 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/sh
# Copyleft (C) 2022 Chuckium
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
command -v wscat &> /dev/null || { echo "YOU MUST HAVE wscat INSTALLED." 1>&2 && exit 1; }
wget -qO- https://curseforge.overwolf.com/downloads/curseforge-latest-linux.zip | funzip > cf.AppImage
chmod +x cf.AppImage
./cf.AppImage --appimage-extract &> /dev/null
squashfs-root/resources/plugins/curse/linux/Curse.Agent.Host &> /dev/null &
sleep 15
printf '{"type":"method","id":0,"name":"getSystemProperties","args":[]}' | timeout 2 wscat -i /dev/stdin -c ws://127.0.0.1:12345/CurseForge | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | jq -r .result.data.Ak | tr -d '\n'
rm cf.AppImage &> /dev/null
rm -rf squashfs-root &> /dev/null
kill %1