add patch
This commit is contained in:
31
scpt/at.zsh
31
scpt/at.zsh
@@ -4,6 +4,9 @@ d=${0:a:h}
|
||||
|
||||
source $d/src/tag.zsh
|
||||
source $d/src/func.zsh
|
||||
source $d/src/ue.zsh
|
||||
source $d/src/ai/syui/game/character.zsh
|
||||
source $d/src/is/syu/main.zsh
|
||||
|
||||
at-env
|
||||
case $1 in
|
||||
@@ -38,16 +41,34 @@ case $1 in
|
||||
at-profile
|
||||
;;
|
||||
download-character-icon)
|
||||
source $d/ai/syui/game/character.zsh
|
||||
download_character_icon
|
||||
;;
|
||||
create-game-character)
|
||||
source $d/ai/syui/game/character.zsh
|
||||
create_game_character
|
||||
;;
|
||||
ai-create-user)
|
||||
source $d/ai/syui/game/character.zsh
|
||||
ai_create_user
|
||||
create-game-user)
|
||||
create_game_user $2
|
||||
;;
|
||||
create-system)
|
||||
create_system
|
||||
;;
|
||||
get-game-user)
|
||||
get_game_user $2
|
||||
;;
|
||||
delete-game-user)
|
||||
delete_game_user $2 $3
|
||||
;;
|
||||
verify-icon)
|
||||
verify-icon
|
||||
;;
|
||||
self-col)
|
||||
self-col $2
|
||||
;;
|
||||
ue-system)
|
||||
ue-system
|
||||
;;
|
||||
ue-user)
|
||||
ue-user $2
|
||||
;;
|
||||
*)
|
||||
echo "${help[@]}"
|
||||
|
||||
@@ -1,33 +1,3 @@
|
||||
character=(
|
||||
ai
|
||||
manny
|
||||
quinn
|
||||
chinese
|
||||
kirin
|
||||
leviathan
|
||||
phoenix
|
||||
wyvern
|
||||
cerberus
|
||||
dragon
|
||||
kitsune
|
||||
pegasus
|
||||
)
|
||||
|
||||
img=(
|
||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||
bafkreiegpqedlrfa4ljhssdnkrr5hyd5huy2xhh2zszj5wq2wuuzejggmq
|
||||
bafkreig6vszkx3c4dcortjwfsz6sa6zwqgj7zpxj4lxfrrkwql4xhiu5ou
|
||||
bafkreich7fsumke2yvumvixkruonzrcevk3f6g2cntzfwdn4n2c2vox5dm
|
||||
bafkreiacjvagsekhiiljz3j237b6klrt6pkptxljt7kltprgg5276gv25q
|
||||
bafkreihpni4lp55jysalcntulzal5rbhidtbseanlucpyucagzxmv6xj24
|
||||
bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||
bafkreidy74aieb6ie646xhosginox5zbnbnrtd76cnt4pbn73hrxgfnple
|
||||
bafkreifnbfj27fr6nv7qeqqmwdibf7qrw4lauvzoknw5hexbifmwqt6kmq
|
||||
)
|
||||
|
||||
function download_character_icon(){
|
||||
|
||||
t=(
|
||||
@@ -189,60 +159,104 @@ json="{
|
||||
|
||||
}
|
||||
|
||||
function ai_create_user() {
|
||||
function get_game_user() {
|
||||
rkey=$did.$pds
|
||||
pds=bsky.social
|
||||
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
|
||||
rkey=$1
|
||||
fi
|
||||
req=com.atproto.repo.getRecord
|
||||
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game"
|
||||
curl -sL $url|jq .
|
||||
}
|
||||
|
||||
col=ai.syui.game.user
|
||||
rkey=ai
|
||||
did=$did_yui
|
||||
handle=$handle_yui
|
||||
delete_game_user() {
|
||||
rkey=$2
|
||||
if [ -z "$1" ];then
|
||||
col=ai.syui.game
|
||||
else
|
||||
col=$1
|
||||
fi
|
||||
req=com.atproto.repo.DeleteRecord
|
||||
url=https://$pds/xrpc/$req
|
||||
repo=$did
|
||||
#repo=did:plc:6qyecktefllvenje24fcxnie
|
||||
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
|
||||
echo $json
|
||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
|
||||
}
|
||||
|
||||
function create_game_user() {
|
||||
col=ai.syui.game
|
||||
rkey=$1
|
||||
handle_yui=$handle
|
||||
did_yui=$did
|
||||
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||
if [ "$pds" != "syu.is" ];then
|
||||
pds=bsky.social
|
||||
fi
|
||||
version=4
|
||||
#rkey=syui
|
||||
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
||||
req=com.atproto.repo.putRecord
|
||||
url=https://$host/xrpc/$req
|
||||
url=https://$pds/xrpc/$req
|
||||
|
||||
for ((i=1; i<=${#character}; i++)); do
|
||||
cname=dragon
|
||||
cid=bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||
|
||||
cname=${character[$i]}
|
||||
cid=${img[$i]}
|
||||
imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
||||
echo $imguri
|
||||
echo $i $character $cname
|
||||
season=1
|
||||
group=test
|
||||
lv=1
|
||||
hp=100
|
||||
exp=0
|
||||
rank=0
|
||||
mode=0
|
||||
attack=0
|
||||
attack_post=0
|
||||
critical=0
|
||||
critical_d=0
|
||||
if [ "$rkey" = "ai" ];then
|
||||
cname=$rkey
|
||||
cid=bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
gender=none
|
||||
fi
|
||||
if [ "$rkey" = "syui" ];then
|
||||
cname=chinese
|
||||
did=$did_syui
|
||||
handle=syui.ai
|
||||
cid=bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||
gender=male
|
||||
fi
|
||||
if [ "$rkey" = "self" ];then
|
||||
cname=manny
|
||||
unset did handle gender
|
||||
pds=bsky.social
|
||||
plc=plc.directory
|
||||
fi
|
||||
imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
||||
season=1
|
||||
group=test
|
||||
lv=1
|
||||
hp=1
|
||||
exp=0
|
||||
rare=0
|
||||
mode=0
|
||||
attack=0
|
||||
attack_post=0
|
||||
critical=0
|
||||
critical_d=0
|
||||
card=0
|
||||
weapon=0
|
||||
coin=0
|
||||
count=0
|
||||
|
||||
case $cname in
|
||||
ai)
|
||||
group=origin
|
||||
season=0
|
||||
mode=2
|
||||
;;
|
||||
manny|quinn)
|
||||
group=test
|
||||
;;
|
||||
*)
|
||||
group=fantasy
|
||||
;;
|
||||
esac
|
||||
case $cname in
|
||||
ai)
|
||||
group=origin
|
||||
season=0
|
||||
mode=2
|
||||
;;
|
||||
manny|quinn)
|
||||
group=test
|
||||
;;
|
||||
*)
|
||||
group=fantasy
|
||||
;;
|
||||
esac
|
||||
|
||||
jc="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"img\": \"$imguri\", \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"rank\": $rank, \"mode\": $mode, \"attack\": $attack, \"attack_post\": $attack_post, \"critical\": $critical, \"critical_d\": $critical_d }"
|
||||
json="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"mode\": $mode, \"attack\": $attack, \"critical\": $critical, \"critical_d\": $critical_d, \"card\": $card, \"coin\": $coin, \"weapon\": $weapon, \"count\": $count, \"rare\": $rare}"
|
||||
#json="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"img\": \"$imguri\", \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"rank\": $rank, \"mode\": $mode, \"attack\": $attack, \"attack_post\": $attack_post, \"critical\": $critical, \"critical_d\": $critical_d }"
|
||||
|
||||
if [ $#character -ne $i ];then
|
||||
jc=${jc},
|
||||
fi
|
||||
|
||||
json=${json}${jc}
|
||||
|
||||
done
|
||||
json="
|
||||
v1_json="
|
||||
{
|
||||
\"repo\": \"$handle_yui\",
|
||||
\"did\": \"$did_yui\",
|
||||
@@ -254,7 +268,7 @@ function ai_create_user() {
|
||||
\"login\": false,
|
||||
\"handle\": \"$handle\",
|
||||
\"aiten\": 10,
|
||||
\"gender\": \"famale\",
|
||||
\"gender\": \"$gender\",
|
||||
\"character\": {
|
||||
$json
|
||||
},
|
||||
@@ -263,40 +277,101 @@ function ai_create_user() {
|
||||
}
|
||||
}"
|
||||
|
||||
json_item="
|
||||
\"coin\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||
\"card\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||
\"weapon\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}]
|
||||
"
|
||||
|
||||
if echo $json|jq . ;then
|
||||
echo $token_yui
|
||||
echo y
|
||||
read y
|
||||
if [ "y" = "$y" ];then
|
||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
||||
fi
|
||||
fi
|
||||
|
||||
col=ai.syui.game
|
||||
rkey=self
|
||||
at_uri=at://$did_yui/ai.syui.game.user/ai
|
||||
|
||||
json="
|
||||
{
|
||||
\"repo\": \"$handle_yui\",
|
||||
\"did\": \"$did_yui\",
|
||||
\"collection\": \"$col\",
|
||||
\"rkey\": \"$rkey\",
|
||||
\"record\": {
|
||||
\"account\": \"$at_uri\",
|
||||
\"username\": \"ai\",
|
||||
\"createdAt\": \"$created\"
|
||||
}
|
||||
json="
|
||||
{
|
||||
\"repo\": \"$handle_yui\",
|
||||
\"did\": \"$did_yui\",
|
||||
\"collection\": \"$col\",
|
||||
\"rkey\": \"$rkey\",
|
||||
\"record\": {
|
||||
\"version\": $version,
|
||||
\"did\": \"$did\",
|
||||
\"handle\": \"$handle\",
|
||||
\"plc\": \"$plc\",
|
||||
\"pds\": \"$pds\",
|
||||
\"player\": {
|
||||
\"limit\": false,
|
||||
\"login\": false,
|
||||
\"ten\": 0,
|
||||
\"gender\": \"$gender\"
|
||||
},
|
||||
\"character\": {
|
||||
$json
|
||||
},
|
||||
\"item\": {
|
||||
$json_item
|
||||
},
|
||||
\"createdAt\": \"${created}\",
|
||||
\"updatedAt\": \"${created}\"
|
||||
}
|
||||
}"
|
||||
|
||||
if echo $json|jq . ;then
|
||||
echo y
|
||||
read y
|
||||
if [ "y" = "$y" ];then
|
||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||
echo $t|jq .
|
||||
#f=~/ai/ue/json/v${version}_${rkey}.json
|
||||
#if [ -f $f ];then
|
||||
# get_game_user $rkey >! $f
|
||||
#fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function create_system() {
|
||||
col=ai.syui.system
|
||||
rkey=self
|
||||
did=$did
|
||||
handle=$handle
|
||||
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||
if [ "$pds" != "syu.is" ];then
|
||||
pds=bsky.social
|
||||
fi
|
||||
version=1
|
||||
#rkey=syui
|
||||
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
||||
req=com.atproto.repo.putRecord
|
||||
url=https://$pds/xrpc/$req
|
||||
#cid=bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||
#imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
||||
imgurl=https://git.syui.ai/ai/ai/raw/branch/main/img/item/card
|
||||
json_card=" \"id\": $id, \"name\": \"$name\", \"img\": \"${imgurl}/${id}.webp\""
|
||||
json_card=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/card.json|jq ".[]"`
|
||||
json_weapon=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/weapon.json|jq ".[]"`
|
||||
json_system=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/system.json|jq ".[]"`
|
||||
json_character=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/character.json|jq ".[]"`
|
||||
json_ability=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/ability.json|jq ".[]"`
|
||||
json="
|
||||
{
|
||||
\"repo\": \"$handle\",
|
||||
\"did\": \"$did\",
|
||||
\"collection\": \"$col\",
|
||||
\"rkey\": \"$rkey\",
|
||||
\"record\": {
|
||||
\"card\": ${json_card},
|
||||
\"weapon\": ${json_weapon},
|
||||
\"system\": ${json_system},
|
||||
\"character\": ${json_character},
|
||||
\"ability\": ${json_ability},
|
||||
\"createdAt\": \"${created}\",
|
||||
\"updatedAt\": \"${created}\"
|
||||
}
|
||||
}"
|
||||
|
||||
if echo $json|jq . ;then
|
||||
echo y
|
||||
read y
|
||||
if [ "y" = "$y" ];then
|
||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||
echo $t|jq .
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
function at-env() {
|
||||
pds=bsky.social
|
||||
plc=plc.directory
|
||||
host=https://bsky.social
|
||||
handle_syui=syui.ai
|
||||
handle_yui=yui.syui.ai
|
||||
@@ -6,21 +8,25 @@ function at-env() {
|
||||
did_syui=did:plc:uqzpqmrjnptsxezjx4xuh2mn
|
||||
handle=$handle_yui
|
||||
did=$did_yui
|
||||
created=2020-01-01T00:00:00+09:00
|
||||
at_uri=at://$did_yui/ai.syui.game.user/syui
|
||||
created=2025-04-21T00:00:00.323Z
|
||||
docs_uri=https://docs.bsky.app/docs/api
|
||||
at_uri=at://$handle/ai.syui.game/ai
|
||||
did=`echo $at_uri|cut -d / -f 3`
|
||||
collection=`echo $at_uri|cut -d / -f 4`
|
||||
rkey=`echo $at_uri|cut -d / -f 5`
|
||||
d=${0:a:h}
|
||||
f=~/.config/.at-zsh.json
|
||||
f=~/.config/ai/token.json
|
||||
if [ -f $f ];then
|
||||
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"`
|
||||
host=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||
token=`cat $f|jq -r .accessJwt`
|
||||
did=`cat $f|jq -r .did`
|
||||
handle=`cat $f|jq -r .handle`
|
||||
actor=$did
|
||||
fi
|
||||
if [ "$host" = "syu.is" ];then
|
||||
plc=plc.syu.is
|
||||
pds=$host
|
||||
fi
|
||||
}
|
||||
|
||||
function at-unset() {
|
||||
@@ -39,18 +45,17 @@ function at-version-env() {
|
||||
;;
|
||||
*)
|
||||
tag=pds
|
||||
list=( bsky.social syu.is boobee.blue socl.is )
|
||||
list=( bsky.social syu.is socl.is )
|
||||
;;
|
||||
esac
|
||||
title="atproto $tag version"
|
||||
latest=https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/$tag/package.json
|
||||
|
||||
latest=`curl -sL $latest |jq -r .version`
|
||||
# bgs=( bsky.network bgs.syu.is )
|
||||
# plc=( plc.directory plc.syu.is )
|
||||
}
|
||||
|
||||
function at-version-json() {
|
||||
latest=`curl -sL $latest |jq -r .version`
|
||||
echo "[{\"title\":\"$title\",\"latest\":\"$latest\"},["
|
||||
e=${list[@]: -1}
|
||||
for i in $list; do
|
||||
@@ -64,8 +69,8 @@ function at-version-json() {
|
||||
}
|
||||
|
||||
function at-version() {
|
||||
at-version-env $1
|
||||
at-version-json |jq .
|
||||
at-version-env
|
||||
at-version-json|jq .
|
||||
}
|
||||
|
||||
function at-uri() {
|
||||
@@ -172,3 +177,32 @@ function at-profile() {
|
||||
url="${host}${req}?actor=$did"
|
||||
curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url|jq .
|
||||
}
|
||||
|
||||
function verify-icon() {
|
||||
syuisadmin_handle=ai.syu.is
|
||||
syuisadmin_did=did:plc:6qyecktefllvenje24fcxnie
|
||||
#rkey=
|
||||
col=app.bsky.graph.verification
|
||||
handle=syui.syu.is
|
||||
subject=did:plc:vzsvtbtbnwn22xjqhcu3vd6y
|
||||
displayName=syui
|
||||
req=/xrpc/com.atproto.repo.createRecord
|
||||
url=${host}${req}
|
||||
json="
|
||||
{
|
||||
\"repo\": \"$syuisadmin_handle\",
|
||||
\"did\": \"$syuisadmin_did\",
|
||||
\"collection\": \"$col\",
|
||||
\"record\": {
|
||||
\"subject\": \"$subject\",
|
||||
\"handle\": \"$handle\",
|
||||
\"displayName\": \"$displayName\",
|
||||
\"createdAt\": \"${created}\"
|
||||
}
|
||||
}"
|
||||
|
||||
if echo $json|jq . ;then
|
||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||
echo $t
|
||||
fi
|
||||
}
|
||||
|
||||
18
scpt/src/is/syu/main.zsh
Normal file
18
scpt/src/is/syu/main.zsh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/zsh
|
||||
|
||||
function self-col(){
|
||||
if [ -n "$1" ];then
|
||||
t=`curl -sL "$pds/xrpc/com.atproto.repo.listRecords?repo=$handle&collection=$1"`
|
||||
echo $t|jq .
|
||||
exit
|
||||
fi
|
||||
col=(
|
||||
ai.syui.game
|
||||
ai.syui.system
|
||||
)
|
||||
e=${col[@]: -1}
|
||||
for i in $col; do
|
||||
t=`curl -sL "$pds/xrpc/com.atproto.repo.listRecords?repo=$handle&collection=$i"`
|
||||
echo $t|jq .
|
||||
done
|
||||
}
|
||||
@@ -38,3 +38,33 @@ github=(
|
||||
)
|
||||
tag=( at bsky bsync pds bgs plc ozone feed jetstream social-app oauth )
|
||||
#pds_list=(bsky.social syu.is boobee.blue socl.is )
|
||||
|
||||
character=(
|
||||
ai
|
||||
manny
|
||||
quinn
|
||||
chinese
|
||||
kirin
|
||||
leviathan
|
||||
phoenix
|
||||
wyvern
|
||||
cerberus
|
||||
dragon
|
||||
kitsune
|
||||
pegasus
|
||||
)
|
||||
|
||||
character_img=(
|
||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||
bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||
bafkreiegpqedlrfa4ljhssdnkrr5hyd5huy2xhh2zszj5wq2wuuzejggmq
|
||||
bafkreig6vszkx3c4dcortjwfsz6sa6zwqgj7zpxj4lxfrrkwql4xhiu5ou
|
||||
bafkreich7fsumke2yvumvixkruonzrcevk3f6g2cntzfwdn4n2c2vox5dm
|
||||
bafkreiacjvagsekhiiljz3j237b6klrt6pkptxljt7kltprgg5276gv25q
|
||||
bafkreihpni4lp55jysalcntulzal5rbhidtbseanlucpyucagzxmv6xj24
|
||||
bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||
bafkreidy74aieb6ie646xhosginox5zbnbnrtd76cnt4pbn73hrxgfnple
|
||||
bafkreifnbfj27fr6nv7qeqqmwdibf7qrw4lauvzoknw5hexbifmwqt6kmq
|
||||
)
|
||||
|
||||
193
scpt/src/ue.zsh
Executable file
193
scpt/src/ue.zsh
Executable file
@@ -0,0 +1,193 @@
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
day=`gdate --iso-8601=seconds`
|
||||
;;
|
||||
*)
|
||||
day=`date --iso-8601=seconds`
|
||||
;;
|
||||
esac
|
||||
|
||||
function get_game_user() {
|
||||
rkey=$did.$pds
|
||||
pds=bsky.social
|
||||
if [ "$1" = "syui" ] || [ "$1" = "ai" ];then
|
||||
rkey=$1
|
||||
fi
|
||||
req=com.atproto.repo.getRecord
|
||||
url="https://$pds/xrpc/$req?rkey=$rkey&repo=$did_yui&collection=ai.syui.game"
|
||||
curl -sL $url|jq .
|
||||
}
|
||||
|
||||
function delete_game_user() {
|
||||
rkey=$2
|
||||
if [ -z "$1" ];then
|
||||
col=ai.syui.game
|
||||
else
|
||||
col=$1
|
||||
fi
|
||||
req=com.atproto.repo.DeleteRecord
|
||||
url=https://$pds/xrpc/$req
|
||||
repo=$did
|
||||
#repo=did:plc:6qyecktefllvenje24fcxnie
|
||||
json="{\"collection\":\"$col\", \"rkey\":\"$rkey\", \"repo\":\"$repo\"}"
|
||||
echo $json
|
||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
|
||||
}
|
||||
|
||||
function ue-user() {
|
||||
col=ai.syui.game
|
||||
rkey=$1
|
||||
handle_yui=$handle
|
||||
did_yui=$did
|
||||
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||
if [ "$pds" != "syu.is" ];then
|
||||
pds=bsky.social
|
||||
fi
|
||||
version=4
|
||||
#rkey=syui
|
||||
req=com.atproto.repo.putRecord
|
||||
url=https://$pds/xrpc/$req
|
||||
|
||||
cname=dragon
|
||||
|
||||
if [ "$rkey" = "ai" ];then
|
||||
cname=$rkey
|
||||
gender=none
|
||||
fi
|
||||
if [ "$rkey" = "syui" ];then
|
||||
cname=chinese
|
||||
did=$did_syui
|
||||
handle=syui.ai
|
||||
gender=male
|
||||
fi
|
||||
if [ "$rkey" = "self" ];then
|
||||
cname=manny
|
||||
unset did handle gender
|
||||
pds=bsky.social
|
||||
plc=plc.directory
|
||||
fi
|
||||
season=1
|
||||
group=test
|
||||
lv=1
|
||||
hp=1
|
||||
exp=0
|
||||
rare=0
|
||||
mode=0
|
||||
attack=0
|
||||
attack_post=0
|
||||
critical=0
|
||||
critical_d=0
|
||||
card=0
|
||||
weapon=0
|
||||
coin=0
|
||||
count=0
|
||||
|
||||
case $cname in
|
||||
ai)
|
||||
group=origin
|
||||
season=0
|
||||
mode=2
|
||||
;;
|
||||
manny|quinn)
|
||||
group=test
|
||||
;;
|
||||
*)
|
||||
group=fantasy
|
||||
;;
|
||||
esac
|
||||
|
||||
json_item="
|
||||
\"coin\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||
\"card\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}],
|
||||
\"weapon\": [{\"id\": 0, \"cp\": 0, \"rare\": 0, \"count\": 0}]
|
||||
"
|
||||
|
||||
json="
|
||||
{
|
||||
\"repo\": \"$handle_yui\",
|
||||
\"did\": \"$did_yui\",
|
||||
\"collection\": \"$col\",
|
||||
\"rkey\": \"$rkey\",
|
||||
\"record\": {
|
||||
\"version\": $version,
|
||||
\"did\": \"$did\",
|
||||
\"handle\": \"$handle\",
|
||||
\"plc\": \"$plc\",
|
||||
\"pds\": \"$pds\",
|
||||
\"player\": {
|
||||
\"limit\": false,
|
||||
\"login\": false,
|
||||
\"ten\": 0,
|
||||
\"gender\": \"$gender\"
|
||||
},
|
||||
\"character\": {
|
||||
$json
|
||||
},
|
||||
\"item\": {
|
||||
$json_item
|
||||
},
|
||||
\"createdAt\": \"${created}\",
|
||||
\"updatedAt\": \"${created}\"
|
||||
}
|
||||
}"
|
||||
|
||||
if echo $json|jq . ;then
|
||||
echo y
|
||||
read y
|
||||
if [ "y" = "$y" ];then
|
||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||
echo $t|jq .
|
||||
#f=~/ai/ue/json/v${version}_${rkey}.json
|
||||
#if [ -f $f ];then
|
||||
# get_game_user $rkey >! $f
|
||||
#fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function ue-system() {
|
||||
col=ai.syui.system
|
||||
rkey=self
|
||||
did=$did
|
||||
handle=$handle
|
||||
pds=`cat $f|jq -r ".didDoc.service.[].serviceEndpoint"|cut -d / -f 3`
|
||||
if [ "$pds" != "syu.is" ];then
|
||||
pds=bsky.social
|
||||
fi
|
||||
version=1
|
||||
#rkey=syui
|
||||
req=com.atproto.repo.putRecord
|
||||
url=https://$pds/xrpc/$req
|
||||
imgurl=https://git.syui.ai/ai/ai/raw/branch/main/img/item/card
|
||||
json_card=" \"id\": $id, \"name\": \"$name\", \"img\": \"${imgurl}/${id}.webp\""
|
||||
json_card=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/card.json|jq ".[]"`
|
||||
json_weapon=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/weapon.json|jq ".[]"`
|
||||
json_system=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/system.json|jq ".[]"`
|
||||
json_character=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/character.json|jq ".[]"`
|
||||
json_ability=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/ability.json|jq ".[]"`
|
||||
json="
|
||||
{
|
||||
\"repo\": \"$handle\",
|
||||
\"did\": \"$did\",
|
||||
\"collection\": \"$col\",
|
||||
\"rkey\": \"$rkey\",
|
||||
\"record\": {
|
||||
\"card\": ${json_card},
|
||||
\"weapon\": ${json_weapon},
|
||||
\"system\": ${json_system},
|
||||
\"character\": ${json_character},
|
||||
\"ability\": ${json_ability},
|
||||
\"createdAt\": \"${created}\",
|
||||
\"updatedAt\": \"${created}\"
|
||||
}
|
||||
}"
|
||||
|
||||
if echo $json|jq . ;then
|
||||
echo y
|
||||
read y
|
||||
if [ "y" = "$y" ];then
|
||||
t=`curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url`
|
||||
echo $t|jq .
|
||||
fi
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user