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:
parent
bcd456e55b
commit
b31c474ff0
2
PKGBUILD
2
PKGBUILD
|
@ -2,7 +2,7 @@
|
||||||
#Well, it seems to work now.
|
#Well, it seems to work now.
|
||||||
|
|
||||||
pkgname=clemmy
|
pkgname=clemmy
|
||||||
pkgver=0.1.2
|
pkgver=0.1.3
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
|
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
|
||||||
arch=('any')
|
arch=('any')
|
||||||
|
|
2
api.sh
2
api.sh
|
@ -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
|
#Generics
|
||||||
get(){ curl -s "$(baseurl)$1?${*:3}" | jq "$2"; }
|
get(){ curl -s "$(baseurl)$1?${*:3}" | jq "$2"; }
|
||||||
|
|
|
@ -9,10 +9,10 @@ source $imps/creds.sh
|
||||||
source $imps/utils.sh
|
source $imps/utils.sh
|
||||||
|
|
||||||
while getopts "a:hi:v" o;do case "${o}" in
|
while getopts "a:hi:v" o;do case "${o}" in
|
||||||
a) INSTANCE=${insts[$OPTARG]}; TOKE=${tokes[$OPTARG]};;
|
a) select_account $OPTARG;;
|
||||||
i) INSTANCE=$OPTARG;;
|
i) INSTANCE=$OPTARG;;
|
||||||
h) echo $actions; exit;;
|
h) echo $actions; exit;;
|
||||||
v) echo 0.1.2; exit;;
|
v) echo 0.1.3; exit;;
|
||||||
esac done
|
esac done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
|
15
creds.sh
15
creds.sh
|
@ -11,11 +11,16 @@ if [ ! -f ~/.config/clemmy/accounts.csv ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
accs=$(cat ~/.config/clemmy/accounts.csv)
|
accsr=$(cat ~/.config/clemmy/accounts.csv)
|
||||||
i=0
|
i=0
|
||||||
for line in ${accs[*]}; do
|
for line in ${accsr[*]}; do
|
||||||
IFS=, read insts[$i] tokes[$i] <<< $line
|
accs[$i]="$line"
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
INSTANCE=${insts[0]}
|
|
||||||
TOKE=${tokes[0]}
|
select_account()
|
||||||
|
{
|
||||||
|
IFS=, read INSTANCE TOKE INSEC <<< "${accs[$1]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
select_account 0
|
Loading…
Reference in New Issue
Block a user