diff --git a/scpt/src/func.zsh b/scpt/src/func.zsh index 1bcdb83..2134260 100644 --- a/scpt/src/func.zsh +++ b/scpt/src/func.zsh @@ -1,5 +1,5 @@ function at-env() { - host=bsky.social + host=https://bsky.social handle_syui=syui.ai handle_yui=yui.syui.ai did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef @@ -15,6 +15,7 @@ function at-env() { d=${0:a:h} f=~/.config/.at-zsh.json if [ -f $f ];then + host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"` token=`cat $f|jq -r .accessJwt` did=`cat $f|jq -r .did` handle=`cat $f|jq -r .handle` @@ -103,7 +104,7 @@ function at-refresh() { echo $f token=`cat $f|jq -r .refreshJwt` req=/xrpc/com.atproto.server.refreshSession - url=https://${host}${req} + url=${host}${req} t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url` if echo $t |jq .;then echo $t >! $f @@ -114,13 +115,13 @@ function at-cid() { did=`at-did $1|jq -r .did` cid=$2 req=/xrpc/com.atproto.sync.getBlob - url="https://${host}${req}?did=${did}&cid=${cid}" + url="${host}${req}?did=${did}&cid=${cid}" curl -sL $url } function at-session() { req=/xrpc/com.atproto.server.getSession - url=https://${host}${req} + url=${host}${req} t=`curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url` if ! echo $t |jq .;then echo refresh @@ -136,6 +137,6 @@ function at-profile() { t=`at-session` fi req=/xrpc/app.bsky.actor.getProfile - url="https://${host}${req}?actor=$did" + url="${host}${req}?actor=$did" curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url|jq . }