From caae3a63df1f30931b108cab99369c9891ee3d86 Mon Sep 17 00:00:00 2001 From: syui Date: Wed, 30 Apr 2025 00:50:06 +0900 Subject: [PATCH] fix --- scpt/at.zsh | 15 ++++++------ scpt/src/ai/syui/game/character.zsh | 38 +++++++++++++++++------------ scpt/src/func.zsh | 14 +++++++---- scpt/src/is/syu/main.zsh | 13 ++++++++++ 4 files changed, 51 insertions(+), 29 deletions(-) create mode 100644 scpt/src/is/syu/main.zsh diff --git a/scpt/at.zsh b/scpt/at.zsh index 1b9f4bd..6987456 100755 --- a/scpt/at.zsh +++ b/scpt/at.zsh @@ -4,6 +4,8 @@ d=${0:a:h} source $d/src/tag.zsh source $d/src/func.zsh +source $d/src/ai/syui/game/character.zsh +source $d/src/is/syu/main.zsh at-env case $1 in @@ -38,32 +40,29 @@ case $1 in at-profile ;; download-character-icon) - source $d/src/ai/syui/game/character.zsh download_character_icon ;; create-game-character) - source $d/src/ai/syui/game/character.zsh create_game_character ;; create-game-user) - source $d/src/ai/syui/game/character.zsh create_game_user $2 ;; - create-yui) - source $d/src/ai/syui/game/character.zsh - create_yui + create-system) + create_system ;; get-game-user) - source $d/src/ai/syui/game/character.zsh get_game_user $2 ;; delete-game-user) - source $d/src/ai/syui/game/character.zsh delete_game_user $2 $3 ;; verify-icon) verify-icon ;; + self-col) + self-col + ;; *) echo "${help[@]}" echo "${host[@]}" diff --git a/scpt/src/ai/syui/game/character.zsh b/scpt/src/ai/syui/game/character.zsh index b89b164..49b229d 100755 --- a/scpt/src/ai/syui/game/character.zsh +++ b/scpt/src/ai/syui/game/character.zsh @@ -219,9 +219,12 @@ delete_game_user() { function create_game_user() { col=ai.syui.game rkey=$1 - did=$did_yui - handle=$handle_yui - pds=bsky.social + 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=4 #rkey=syui #img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg @@ -283,8 +286,8 @@ function create_game_user() { v1_json=" { - \"repo\": \"$handle_yui\", - \"did\": \"$did_yui\", + \"repo\": \"$handle\", + \"did\": \"$did\", \"collection\": \"$col\", \"rkey\": \"$rkey\", \"record\": { @@ -310,8 +313,8 @@ json_item=" json=" { - \"repo\": \"$handle_yui\", - \"did\": \"$did_yui\", + \"repo\": \"$handle\", + \"did\": \"$did\", \"collection\": \"$col\", \"rkey\": \"$rkey\", \"record\": { @@ -351,19 +354,22 @@ if echo $json|jq . ;then fi } -function create_yui() { - col=ai.syui.yui +function create_system() { + col=ai.syui.system rkey=self - did=$did_yui - handle=$handle_yui - pds=bsky.social + 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 + #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 ".[]"` @@ -373,8 +379,8 @@ function create_yui() { json_ability=`curl -sL https://git.syui.ai/ai/ai/raw/branch/main/json/ability.json|jq ".[]"` json=" { - \"repo\": \"$handle_yui\", - \"did\": \"$did_yui\", + \"repo\": \"$handle\", + \"did\": \"$did\", \"collection\": \"$col\", \"rkey\": \"$rkey\", \"record\": { diff --git a/scpt/src/func.zsh b/scpt/src/func.zsh index f66db20..aa19d31 100644 --- a/scpt/src/func.zsh +++ b/scpt/src/func.zsh @@ -9,20 +9,24 @@ function at-env() { handle=$handle_yui did=$did_yui created=2025-04-21T00:00:00.323Z - at_uri=at://$did_yui/ai.syui.game.user/syui docs_uri=https://docs.bsky.app/docs/api - 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/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 + 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` } function at-unset() { diff --git a/scpt/src/is/syu/main.zsh b/scpt/src/is/syu/main.zsh new file mode 100644 index 0000000..0bfed20 --- /dev/null +++ b/scpt/src/is/syu/main.zsh @@ -0,0 +1,13 @@ +#!/bin/zsh + +function self-col(){ + 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 +}