Can use http without ssl now. I use it internally for my instance. Maybe I'll also allow ignoring specific SSL errors, maybe some passthrough to curl.

This commit is contained in:
Zergling_man 2023-06-19 00:47:48 +10:00
parent bcd456e55b
commit b31c474ff0
4 changed files with 14 additions and 9 deletions

View File

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

2
api.sh
View File

@ -1,4 +1,4 @@
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
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
#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) INSTANCE=${insts[$OPTARG]}; TOKE=${tokes[$OPTARG]};;
a) select_account $OPTARG;;
i) INSTANCE=$OPTARG;;
h) echo $actions; exit;;
v) echo 0.1.2; exit;;
v) echo 0.1.3; exit;;
esac done
shift $((OPTIND-1))

View File

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