ai/at
ai/at
1
0

update scpt

This commit is contained in:
syui 2024-12-26 22:03:20 +09:00
parent 64a709e5a0
commit 3ac6bf6b81
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
3 changed files with 94 additions and 86 deletions

48
scpt/at.zsh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/zsh
d=${0:a:h}
source $d/src/tag.zsh
source $d/src/func.zsh
at-env
case $1 in
version|v)
at-version
;;
uri|u)
at-uri $2
;;
did|d)
at-did $2
;;
collection|c)
at-collection $2 $3
;;
at-docs|docs)
at-docs
;;
cid)
at-cid $2 $3
;;
login|l)
at-login $2 $3
;;
refresh|r)
at-refresh
;;
session|s)
at-session
;;
profile|pro)
at-profile
;;
*)
echo "${help[@]}"
echo "${host[@]}"
echo "${lexicon[@]}"
echo "${github[@]}"
echo "${tag[@]}"
;;
esac
at-unset

93
at.zsh → scpt/src/func.zsh Executable file → Normal file
View File

@ -1,50 +1,13 @@
#!/bin/zsh
help=(
at.zsh v
at.zsh d handle
at.zsh u at-uri
at.zsh c at-uri -r
at.zsh docs
at.zsh l handle password
at.zsh r
at.zsh s
at.zsh cid handle cid
at.zsh pro
at.zsh col ai.syui.game.user self
)
host=(
bsky.social
public.api.bsky.app
plc.directory
)
lexicon=(
# https://github.com/bluesky-social/atproto/tree/main/lexicons
com.atproto.repo.describeRepo
com.atproto.repo.getRecord
com.atproto.repo.listRecords
com.atproto.identity.resolveHandle
com.atproto.server.createSession
com.atproto.server.refreshSession
com.atproto.server.getSession
com.atproto.sync.getBlob
app.bsky.actor.getProfile
)
github=(
https://github.com/bluesky-social/atproto
https://github.com/bluesky-social/social-app
https://github.com/bluesky-social/feed-generator
https://github.com/bluesky-social/jetstream
https://github.com/bluesky-social/indigo
https://github.com/did-method-plc/did-method-plc
)
tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth )
function at-env() { function at-env() {
host=bsky.social host=bsky.social
at_uri=at://did:plc:4hqjfn7m6n5hno3doamuhgef/ai.syui.game.user/syui handle_syui=syui.ai
handle_yui=yui.syui.ai
did_yui=did:plc:4hqjfn7m6n5hno3doamuhgef
did_syui=did:plc:uqzpqmrjnptsxezjx4xuh2mn
handle=$handle_yui
did=$did_yui
at_uri=at://$handle_yui/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
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`
@ -170,45 +133,3 @@ function at-profile() {
url="https://${host}${req}?actor=$did" url="https://${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 .
} }
at-env
case $1 in
version|v)
at-version
;;
uri|u)
at-uri $2
;;
did|d)
at-did $2
;;
collection|c)
at-collection $2 $3
;;
at-docs|docs)
at-docs
;;
cid)
at-cid $2 $3
;;
login|l)
at-login $2 $3
;;
refresh|r)
at-refresh
;;
session|s)
at-session
;;
profile|pro)
at-profile
;;
*)
echo "${help[@]}"
echo "${host[@]}"
echo "${lexicon[@]}"
echo "${github[@]}"
echo "${tag[@]}"
;;
esac
at-unset

39
scpt/src/tag.zsh Normal file
View File

@ -0,0 +1,39 @@
help=(
at.zsh v
at.zsh d handle
at.zsh u at-uri
at.zsh c at-uri -r
at.zsh docs
at.zsh l handle password
at.zsh r
at.zsh s
at.zsh cid handle cid
at.zsh pro
at.zsh col ai.syui.game.user self
)
host=(
bsky.social
public.api.bsky.app
plc.directory
)
lexicon=(
# https://github.com/bluesky-social/atproto/tree/main/lexicons
com.atproto.repo.describeRepo
com.atproto.repo.getRecord
com.atproto.repo.listRecords
com.atproto.identity.resolveHandle
com.atproto.server.createSession
com.atproto.server.refreshSession
com.atproto.server.getSession
com.atproto.sync.getBlob
app.bsky.actor.getProfile
)
github=(
https://github.com/bluesky-social/atproto
https://github.com/bluesky-social/social-app
https://github.com/bluesky-social/feed-generator
https://github.com/bluesky-social/jetstream
https://github.com/bluesky-social/indigo
https://github.com/did-method-plc/did-method-plc
)
tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth )