fix pds
This commit is contained in:
parent
c2dc0b72d5
commit
c38a271e11
@ -8,7 +8,7 @@ source $d/src/func.zsh
|
|||||||
at-env
|
at-env
|
||||||
case $1 in
|
case $1 in
|
||||||
version|v)
|
version|v)
|
||||||
at-version
|
at-pds-version
|
||||||
;;
|
;;
|
||||||
uri|u)
|
uri|u)
|
||||||
at-uri $2
|
at-uri $2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function at-env() {
|
function at-env() {
|
||||||
host=bsky.social
|
host=https://bsky.social
|
||||||
handle_syui=syui.ai
|
handle_syui=syui.ai
|
||||||
handle_yui=yui.syui.ai
|
handle_yui=yui.syui.ai
|
||||||
did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef
|
did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef
|
||||||
@ -15,6 +15,7 @@ function at-env() {
|
|||||||
d=${0:a:h}
|
d=${0:a:h}
|
||||||
f=~/.config/.at-zsh.json
|
f=~/.config/.at-zsh.json
|
||||||
if [ -f $f ];then
|
if [ -f $f ];then
|
||||||
|
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"`
|
||||||
token=`cat $f|jq -r .accessJwt`
|
token=`cat $f|jq -r .accessJwt`
|
||||||
did=`cat $f|jq -r .did`
|
did=`cat $f|jq -r .did`
|
||||||
handle=`cat $f|jq -r .handle`
|
handle=`cat $f|jq -r .handle`
|
||||||
@ -26,13 +27,29 @@ function at-unset() {
|
|||||||
unset t password token refresh
|
unset t password token refresh
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-version() {
|
function at-pds-version-env() {
|
||||||
latest=`curl -sL https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/pds/package.json |jq -r .version`
|
title="atproto pds version"
|
||||||
echo latest: $latest
|
latest=https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/pds/package.json
|
||||||
echo $host
|
pds=(bsky.social syu.is boobee.blue socl.is )
|
||||||
curl -sL ${host}/xrpc/_health |jq .
|
}
|
||||||
echo syu.is
|
|
||||||
curl -sL syu.is/xrpc/_health |jq .
|
function at-pds-version-json() {
|
||||||
|
latest=`curl -sL $latest |jq -r .version`
|
||||||
|
echo "[{\"title\":\"$title\",\"latest\":\"$latest\"},["
|
||||||
|
e=${pds[@]: -1}
|
||||||
|
for i in $pds; do
|
||||||
|
t=`curl -sL ${i}/xrpc/_health |jq -r .version`
|
||||||
|
echo "{\"$i\":\"$t\"}"
|
||||||
|
if [ "$e" != "$i" ];then
|
||||||
|
echo ,
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "]]"
|
||||||
|
}
|
||||||
|
|
||||||
|
function at-pds-version() {
|
||||||
|
at-pds-version-env
|
||||||
|
at-pds-version-json |jq .
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-uri() {
|
function at-uri() {
|
||||||
@ -103,7 +120,7 @@ function at-refresh() {
|
|||||||
echo $f
|
echo $f
|
||||||
token=`cat $f|jq -r .refreshJwt`
|
token=`cat $f|jq -r .refreshJwt`
|
||||||
req=/xrpc/com.atproto.server.refreshSession
|
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`
|
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url`
|
||||||
if echo $t |jq .;then
|
if echo $t |jq .;then
|
||||||
echo $t >! $f
|
echo $t >! $f
|
||||||
@ -114,13 +131,13 @@ function at-cid() {
|
|||||||
did=`at-did $1|jq -r .did`
|
did=`at-did $1|jq -r .did`
|
||||||
cid=$2
|
cid=$2
|
||||||
req=/xrpc/com.atproto.sync.getBlob
|
req=/xrpc/com.atproto.sync.getBlob
|
||||||
url="https://${host}${req}?did=${did}&cid=${cid}"
|
url="${host}${req}?did=${did}&cid=${cid}"
|
||||||
curl -sL $url
|
curl -sL $url
|
||||||
}
|
}
|
||||||
|
|
||||||
function at-session() {
|
function at-session() {
|
||||||
req=/xrpc/com.atproto.server.getSession
|
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`
|
t=`curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url`
|
||||||
if ! echo $t |jq .;then
|
if ! echo $t |jq .;then
|
||||||
echo refresh
|
echo refresh
|
||||||
@ -136,6 +153,6 @@ function at-profile() {
|
|||||||
t=`at-session`
|
t=`at-session`
|
||||||
fi
|
fi
|
||||||
req=/xrpc/app.bsky.actor.getProfile
|
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 .
|
curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url|jq .
|
||||||
}
|
}
|
||||||
|
@ -37,3 +37,4 @@ github=(
|
|||||||
https://github.com/did-method-plc/did-method-plc
|
https://github.com/did-method-plc/did-method-plc
|
||||||
)
|
)
|
||||||
tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth )
|
tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth )
|
||||||
|
#pds_list=(bsky.social syu.is boobee.blue socl.is )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user