mcaptcha-api-py/scripts/download-cli.sh
Aravinth Manivannan c58fab7d81
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix: mcaptcha-cli download script
2023-12-31 21:20:42 +05:30

34 lines
765 B
Bash
Executable file

#!/bin/bash
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
readonly PROJECT_ROOT=$(pwd)
readonly SOURCE=https://dl.mcaptcha.org/mcaptcha/cli/0.3.0/x86_64-unknown-linux-gnu.tar.gz
readonly BIN_PATH=tmp/cli/mcaptcha-cli
readonly TARBALL=mcaptcha-cli.tar.gz
download() {
if [ ! -e $BIN_PATH ];
then
mkdir -p tmp/cli
cd tmp/cli/
wget $SOURCE --quiet --output-document=$TARBALL $SOURCE
tar -xvzf $TARBALL > /dev/null
rm $TARBALL
echo "[*] Downloaded mCaptcha CLI"
mv build/x86_64-unknown-linux-gnu/mcaptcha-cli .
rm -rf build/
cd $PROJECT_ROOT
fi
}
# 1: widget URI
gen_pow() {
$BIN_PATH widget-url $2 | cut -d ':' -f 2 | tr -d ' '
}
$1 $@