Comments no longer show post's link instead of id->replyid.

This commit is contained in:
Zergling_man 2022-09-04 04:09:08 +10:00
parent 7fe2645f58
commit 83ce8024a3

View File

@ -11,13 +11,19 @@ TOKE=${tokes[0]}
baseurl="https://$INSTANCE/api/v3/"
# Please don't abuse jq like this
showpost='(.post | (.id | tostring)+" "+(.name | tostring)),
(.post.url)+", "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
showcomment='(.post | (.id | tostring)+" "+(.name | tostring)),
(.post.url // (.comment | (.parent_id | tostring)+"->"+(.id | tostring)))+", "+(.creator.display_name // .creator.name)+":",
(.comment | (.parent_id | tostring)+"->"+(.id | tostring))+", "+(.creator.display_name // .creator.name)+":",
((.comment // .post) | .published,
(.body // .content)),
""'
comments=".[] | $showcomment"
posts=".[] | $showpost"
#Generics
get(){ curl -s "$baseurl$1?${*:3}" | jq "$2"; }
@ -34,15 +40,15 @@ actions="notifs notifs2 comments freepost shitpost follow unfollow following der
#Lurkan
notifs(){ getauth "user/replies" ".replies | $comments"; }
notifs2(){ getauth "user/mention"; }
following(){ getauth "post/list" ".posts | $comments" "type_=Subscribed"; }
comments(){ getauth "post" "(.post_view | $showcomment), (.comments | reverse | $comments)" "id=$1"; }
following(){ getauth "post/list" ".posts | $posts" "type_=Subscribed"; }
comments(){ getauth "post" "(.post_view | $showpost), (.comments | reverse | $comments)" "id=$1"; }
#Postan
freepost(){ getbody; post "post" "{\"community_id\":$1,\"name\":\"$2\",\"body\":\"$body\"}"; }
shitpost(){ getbody; postid=$1; parentid=$2; post "comment" "{\"post_id\":$postid,\"parent_id\":$parentid,\"content\":\"$body\"}"; }
#Post hoardan
save(){ put "post/save" "{\"post_id\":$1,\"save\":true}"; }
unsave(){ put "post/save" "{\"post_id\":$1,\"save\":false}"; }
load(){ getauth "post/list" ".posts | $comments" "type_=All&saved_only=true"; }
load(){ getauth "post/list" ".posts | $posts" "type_=All&saved_only=true"; }
#Community hoardan
follow(){ post "community/follow" "{\"community_id\":$1,\"follow\":true}"; }
unfollow(){ post "community/follow" "{\"community_id\":$1,\"follow\":false}"; }