Compare commits

..

No commits in common. "92fb24775668bdbe3bcf47d9ad7b0ab3aa637b26" and "bcd456e55b009c1b62066a043bf0c1c0760b4a6d" have entirely different histories.

5 changed files with 9 additions and 39 deletions

View File

@ -2,7 +2,7 @@
#Well, it seems to work now.
pkgname=clemmy
pkgver=0.1.3
pkgver=0.1.2
pkgrel=1
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
arch=('any')

2
api.sh
View File

@ -1,4 +1,4 @@
baseurl(){ if [ -z $INSEC ]; then sec=s; fi; echo "http$sec://$INSTANCE/api/v3/"; } # This needs to be a function so updates to INSTANCE affect it. This is a very old bug lmao
baseurl(){ echo "https://$INSTANCE/api/v3/"; } # This needs to be a function so updates to INSTANCE affect it. This is a very old bug lmao
#Generics
get(){ curl -s "$(baseurl)$1?${*:3}" | jq "$2"; }

View File

@ -9,10 +9,10 @@ source $imps/creds.sh
source $imps/utils.sh
while getopts "a:hi:v" o;do case "${o}" in
a) select_account $OPTARG;;
a) INSTANCE=${insts[$OPTARG]}; TOKE=${tokes[$OPTARG]};;
i) INSTANCE=$OPTARG;;
h) echo $actions; exit;;
v) echo 0.1.3; exit;;
v) echo 0.1.2; exit;;
esac done
shift $((OPTIND-1))

View File

@ -1,25 +0,0 @@
pendcount()
{
getauth "admin/registration_application/count" ".registration_applications"
}
pending()
{
applications=$(getauth "admin/registration_application/list" ".registration_applications" "unread_only=true")
i=0
app=$(jq .[$i] <<< "$applications")
while [ -n "$app" ]; do
appid=$(jq -r .registration_application.id <<< "$app")
jq '.registration_application.id, (.creator | .name,.published,.bio,"bot: "+.bot_account,"matrix: "+.matrix_user_id,.avatar,.banner), "captcha: "+.registration_application.answer' <<< "$app"
ans= # Better make sure this resets lol
while [ ! ans = 'y' -a ! ans = 'n' -a ! ans = 's' ]; do
namedget ans "Accept? (y)es (n)o (s)kip"
done
case $ans in
y) put "admin/registration_application/approve" "{\"id\":$appid,\"approve\":true}";;
n) namedget rejected "Why not?" true; put "admin/registration_application/approve" "{\"id\":$appid,\"deny_reason\":\"$rejected\",\"approve\":false}";;
esac
done
}
curl -iX PUT $INSTANCE/api/v3/admin/registration_application/approve --json "{\"id\":8,\"auth\":\"$TOKE\",\"approve\":true}"

View File

@ -11,16 +11,11 @@ if [ ! -f ~/.config/clemmy/accounts.csv ]; then
exit
fi
accsr=$(cat ~/.config/clemmy/accounts.csv)
accs=$(cat ~/.config/clemmy/accounts.csv)
i=0
for line in ${accsr[*]}; do
accs[$i]="$line"
for line in ${accs[*]}; do
IFS=, read insts[$i] tokes[$i] <<< $line
i=$((i+1))
done
select_account()
{
IFS=, read INSTANCE TOKE INSEC <<< "${accs[$1]}"
}
select_account 0
INSTANCE=${insts[0]}
TOKE=${tokes[0]}