fix
This commit is contained in:
parent
f58ad9022d
commit
f11e5fff52
110
at.zsh
110
at.zsh
@ -21,51 +21,51 @@ lexicon=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
function at-env(){
|
function at-env(){
|
||||||
host=bsky.social
|
host=bsky.social
|
||||||
at_uri=at://did:plc:4hqjfn7m6n5hno3doamuhgef/ai.syui.game.user/syui
|
at_uri=at://did:plc:4hqjfn7m6n5hno3doamuhgef/ai.syui.game.user/syui
|
||||||
docs_uri=https://docs.bsky.app/docs/api
|
docs_uri=https://docs.bsky.app/docs/api
|
||||||
handle=yui.syui.ai
|
handle=yui.syui.ai
|
||||||
did=`echo $at_uri|cut -d / -f 3`
|
did=`echo $at_uri|cut -d / -f 3`
|
||||||
collection=`echo $at_uri|cut -d / -f 4`
|
collection=`echo $at_uri|cut -d / -f 4`
|
||||||
rkey=`echo $at_uri|cut -d / -f 5`
|
rkey=`echo $at_uri|cut -d / -f 5`
|
||||||
d=${0:a:h}
|
d=${0:a:h}
|
||||||
f=~/.config/.at-zsh.json
|
f=~/.config/.at-zsh.json
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-uri-search(){
|
function at-uri-search(){
|
||||||
if [ -n "$1" ];then
|
if [ -n "$1" ];then
|
||||||
at_uri=$1
|
at_uri=$1
|
||||||
fi
|
fi
|
||||||
req=/xrpc/com.atproto.repo.getRecord
|
req=/xrpc/com.atproto.repo.getRecord
|
||||||
url=https://${host}${req}
|
url=https://${host}${req}
|
||||||
did=`echo $at_uri|cut -d / -f 3`
|
did=`echo $at_uri|cut -d / -f 3`
|
||||||
collection=`echo $at_uri|cut -d / -f 4`
|
collection=`echo $at_uri|cut -d / -f 4`
|
||||||
rkey=`echo $at_uri|cut -d / -f 5`
|
rkey=`echo $at_uri|cut -d / -f 5`
|
||||||
curl -sL "$url?repo=$did&collection=$collection&rkey=$rkey"|jq .
|
curl -sL "$url?repo=$did&collection=$collection&rkey=$rkey"|jq .
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-did-search(){
|
function at-did-search(){
|
||||||
if [ -n "$1" ];then
|
if [ -n "$1" ];then
|
||||||
handle=$1
|
handle=$1
|
||||||
fi
|
fi
|
||||||
req=/xrpc/com.atproto.repo.describeRepo
|
req=/xrpc/com.atproto.repo.describeRepo
|
||||||
url=https://${host}${req}
|
url=https://${host}${req}
|
||||||
curl -sL "$url?repo=$handle"|jq .
|
curl -sL "$url?repo=$handle"|jq .
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-collection-search(){
|
function at-collection-search(){
|
||||||
reverse=false
|
reverse=false
|
||||||
if [ -n "$1" ];then
|
if [ -n "$1" ];then
|
||||||
at_uri=$1
|
at_uri=$1
|
||||||
fi
|
fi
|
||||||
if [ "$2" = "-r" ];then
|
if [ "$2" = "-r" ];then
|
||||||
reverse=true
|
reverse=true
|
||||||
fi
|
fi
|
||||||
req=/xrpc/com.atproto.repo.listRecords
|
req=/xrpc/com.atproto.repo.listRecords
|
||||||
url=https://${host}${req}
|
url=https://${host}${req}
|
||||||
did=`echo $at_uri|cut -d / -f 3`
|
did=`echo $at_uri|cut -d / -f 3`
|
||||||
collection=`echo $at_uri|cut -d / -f 4`
|
collection=`echo $at_uri|cut -d / -f 4`
|
||||||
curl -sL "$url?repo=$did&collection=$collection&reverse=$reverse"|jq .
|
curl -sL "$url?repo=$did&collection=$collection&reverse=$reverse"|jq .
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,37 +78,37 @@ done
|
|||||||
}
|
}
|
||||||
|
|
||||||
function at-login(){
|
function at-login(){
|
||||||
if [ -z "$1" ] || [ -z "$2" ];then
|
if [ -z "$1" ] || [ -z "$2" ];then
|
||||||
echo handle password
|
echo handle password
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
handle=$1
|
handle=$1
|
||||||
password=$2
|
password=$2
|
||||||
echo $password
|
echo $password
|
||||||
json="{\"identifier\":\"$handle\",\"password\":\"$password\"}"
|
json="{\"identifier\":\"$handle\",\"password\":\"$password\"}"
|
||||||
req=/xrpc/com.atproto.server.createSession
|
req=/xrpc/com.atproto.server.createSession
|
||||||
url=https://${host}${req}
|
url=https://${host}${req}
|
||||||
if [ ! -d ~/.config ];then
|
if [ ! -d ~/.config ];then
|
||||||
mkdir -p ~/.config
|
mkdir -p ~/.config
|
||||||
fi
|
fi
|
||||||
t=`curl -sL -X POST -H "Content-Type: application/json" -d $json $url`
|
t=`curl -sL -X POST -H "Content-Type: application/json" -d $json $url`
|
||||||
if echo $t |jq .;then
|
if echo $t |jq .;then
|
||||||
echo $t >! $f
|
echo $t >! $f
|
||||||
fi
|
fi
|
||||||
unset t password
|
unset t password
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-refresh(){
|
function at-refresh(){
|
||||||
echo $f
|
echo $f
|
||||||
token=`cat $f|jq -r .accessJwt`
|
token=`cat $f|jq -r .accessJwt`
|
||||||
refresh=`cat $f|jq -r .refreshJwt`
|
refresh=`cat $f|jq -r .refreshJwt`
|
||||||
req=/xrpc/com.atproto.server.refreshSession
|
req=/xrpc/com.atproto.server.refreshSession
|
||||||
url=https://${host}${req}
|
url=https://${host}${req}
|
||||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $refresh" $url`
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $refresh" $url`
|
||||||
if echo $t |jq .;then
|
if echo $t |jq .;then
|
||||||
echo $t >! $f
|
echo $t >! $f
|
||||||
fi
|
fi
|
||||||
unset t token refresh
|
unset t token refresh
|
||||||
}
|
}
|
||||||
|
|
||||||
at-env
|
at-env
|
||||||
|
Loading…
x
Reference in New Issue
Block a user