Lemmy finally fixed auth tokens to not be in the fucking query params
This commit is contained in:
parent
ba29b1491d
commit
b1cb700ef7
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.7
|
pkgver=0.2.0
|
||||||
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')
|
||||||
|
|
5
api.sh
5
api.sh
|
@ -1,8 +1,7 @@
|
||||||
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(){ 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 -sH "Cookie:jwt=$TOKE" "$(baseurl)$1?${*:3}" | jq "${2:-.}"; }
|
||||||
getauth(){ get "$1" "$2" "auth=$TOKE&${*:3}"; }
|
post(){ curl -sH "Cookie:jwt=$TOKE" "$(baseurl)$1" --json "${*:2}"; }
|
||||||
post(){ curl -s "$(baseurl)$1" --json "$(echo ${*:2} | jq '.+{"auth":"'$TOKE'"}')"; }
|
|
||||||
# I'm just gonna clone this thing rather than try to palm the -X PUT into post. I can fix it later.
|
# I'm just gonna clone this thing rather than try to palm the -X PUT into post. I can fix it later.
|
||||||
put(){ curl -sX PUT "$(baseurl)$1" --json "$(echo ${*:2} | jq '.+{"auth":"'$TOKE'"}')"; }
|
put(){ curl -sX PUT "$(baseurl)$1" --json "$(echo ${*:2} | jq '.+{"auth":"'$TOKE'"}')"; }
|
|
@ -1,13 +1,13 @@
|
||||||
pendcount()
|
pendcount()
|
||||||
{
|
{
|
||||||
getauth "admin/registration_application/count" ".registration_applications"
|
get "admin/registration_application/count" ".registration_applications"
|
||||||
}
|
}
|
||||||
|
|
||||||
pending()
|
pending()
|
||||||
{
|
{
|
||||||
applications=$(getauth "admin/registration_application/list" ".registration_applications" "unread_only=true")
|
applications=$(get "admin/registration_application/list" ".registration_applications" "unread_only=true")
|
||||||
i=0
|
i=0
|
||||||
app=$(jq .[$i] <<< "$applications")
|
app=$(jq ".[$i] // empty" <<< "$applications")
|
||||||
while [ -n "$app" ]; do
|
while [ -n "$app" ]; do
|
||||||
appid=$(jq -r .registration_application.id <<< "$app")
|
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"
|
jq '.registration_application.id, (.creator | .name,.published,.bio,"bot: "+.bot_account,"matrix: "+.matrix_user_id,.avatar,.banner), "captcha: "+.registration_application.answer' <<< "$app"
|
||||||
|
|
|
@ -9,4 +9,4 @@ source $imps/commands/posts.sh
|
||||||
source $imps/commands/admin.sh
|
source $imps/commands/admin.sh
|
||||||
|
|
||||||
#Misc
|
#Misc
|
||||||
deref(){ getauth "resolve_object" "" "q=$*"; }
|
deref(){ get "resolve_object" "" "q=$*"; }
|
|
@ -1,7 +1,7 @@
|
||||||
#Community hoardan
|
#Community hoardan
|
||||||
follow(){ post "community/follow" '{"community_id":'$1',"follow":true}'; }
|
follow(){ post "community/follow" '{"community_id":'$1',"follow":true}'; }
|
||||||
unfollow(){ post "community/follow" '{"community_id":'$1',"follow":false}'; }
|
unfollow(){ post "community/follow" '{"community_id":'$1',"follow":false}'; }
|
||||||
following(){ getauth "community/list" ".communities | $communities_jq" "type_=Subscribed"; } # Alright it's time
|
following(){ get "community/list" ".communities | $communities_jq" "type_=Subscribed"; } # Alright it's time
|
||||||
|
|
||||||
comcreate(){ namedget desc "The community's display name (can be edited later)"; post "community" '{"name":"'$1'","title":"'"$desc"'"}'; }
|
comcreate(){ namedget desc "The community's display name (can be edited later)"; post "community" '{"name":"'$1'","title":"'"$desc"'"}'; }
|
||||||
comedit(){ echo "stub"; }
|
comedit(){ echo "stub"; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Lurkan
|
#Lurkan
|
||||||
notifs(){ getauth "user/replies" ".replies | reverse | $notifs_jq"; }
|
notifs(){ get "user/replies" ".replies | reverse | $notifs_jq"; }
|
||||||
notifs2(){ echo "use mentions instead"; }
|
notifs2(){ echo "use mentions instead"; }
|
||||||
mentions(){ getauth "user/mention" ".mentions | reverse | $notifs_jq"; }
|
mentions(){ get "user/mention" ".mentions | reverse | $notifs_jq"; }
|
||||||
home(){ getauth "post/list" ".posts | $posts_jq" "type_=Subscribed"; }
|
home(){ get "post/list" ".posts | $posts_jq" "type_=Subscribed"; }
|
||||||
#This has to get complex now -.-
|
#This has to get complex now -.-
|
||||||
comments(){ getauth "post" "(.post_view | $full_post_jq)" "id=$1"; getauth "comment/list" "(.comments | reverse | $comments_jq)" "post_id=$1&sort=New"; }
|
comments(){ get "post" "(.post_view | $full_post_jq)" "id=$1"; get "comment/list" "(.comments | reverse | $comments_jq)" "post_id=$1&sort=New"; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Post hoardan
|
#Post hoardan
|
||||||
save(){ put "post/save" '{"post_id":'$1',"save":true}'; }
|
save(){ put "post/save" '{"post_id":'$1',"save":true}'; }
|
||||||
unsave(){ put "post/save" '{"post_id":'$1',"save":false}'; }
|
unsave(){ put "post/save" '{"post_id":'$1',"save":false}'; }
|
||||||
load(){ getauth "post/list" ".posts | .[] | $short_post_jq" "type_=All&saved_only=true"; }
|
load(){ get "post/list" ".posts | .[] | $short_post_jq" "type_=All&saved_only=true"; }
|
||||||
#Postan
|
#Postan
|
||||||
freepost(){ getbody; post "post" '{"community_id":'$1',"name":"'${*:2}'","body":"'$body'"}'; }
|
freepost(){ getbody; post "post" '{"community_id":'$1',"name":"'${*:2}'","body":"'$body'"}'; }
|
||||||
shitpost(){ getbody; postid=$1; parentid=$2; if [ -z $parentid ]; then parentid=null; fi; post "comment" '{"post_id":'$postid',"parent_id":'$parentid',"content":"'$body'"}'; }
|
shitpost(){ getbody; postid=$1; parentid=$2; if [ -z $parentid ]; then parentid=null; fi; post "comment" '{"post_id":'$postid',"parent_id":'$parentid',"content":"'$body'"}'; }
|
Loading…
Reference in New Issue
Block a user