fix pds
This commit is contained in:
parent
c2dc0b72d5
commit
c38a271e11
@ -8,7 +8,7 @@ source $d/src/func.zsh
|
||||
at-env
|
||||
case $1 in
|
||||
version|v)
|
||||
at-version
|
||||
at-pds-version
|
||||
;;
|
||||
uri|u)
|
||||
at-uri $2
|
||||
|
@ -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`
|
||||
@ -26,13 +27,29 @@ function at-unset() {
|
||||
unset t password token refresh
|
||||
}
|
||||
|
||||
function at-version() {
|
||||
latest=`curl -sL https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/pds/package.json |jq -r .version`
|
||||
echo latest: $latest
|
||||
echo $host
|
||||
curl -sL ${host}/xrpc/_health |jq .
|
||||
echo syu.is
|
||||
curl -sL syu.is/xrpc/_health |jq .
|
||||
function at-pds-version-env() {
|
||||
title="atproto pds version"
|
||||
latest=https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/pds/package.json
|
||||
pds=(bsky.social syu.is boobee.blue socl.is )
|
||||
}
|
||||
|
||||
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() {
|
||||
@ -103,7 +120,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 +131,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 +153,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 .
|
||||
}
|
||||
|
@ -37,3 +37,4 @@ github=(
|
||||
https://github.com/did-method-plc/did-method-plc
|
||||
)
|
||||
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