From c0d56ff9075be7cedf6df1e56e570f417797b7db Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 6 Dec 2025 18:15:40 +0900 Subject: [PATCH] fix --- install.zsh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/install.zsh b/install.zsh index 311eafb..58cdca6 100755 --- a/install.zsh +++ b/install.zsh @@ -422,6 +422,56 @@ function at-repos-feed-generator-start-push() { npx tsx scripts/publish.ts } +function at-repos-feed-generator-update() { + + resp=$(curl -sL -X POST -H "Content-Type: application/json" -d "{\"identifier\":\"$handle\",\"password\":\"${APP_PASSWORD}\"}" https://${host}/xrpc/com.atproto.server.createSession) + token=$(echo $resp | jq -r .accessJwt) + if [ -z "$token" ] || [ "$token" == "null" ]; then + echo "Login failed: $resp" + exit 1 + fi + + avatar_json="{\"\$type\":\"blob\",\"ref\":{\"\$link\":\"${img_id}\"},\"mimeType\":\"image/jpeg\",\"size\":375259}" + + # 3. Delete cmd record + #curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" \ + # -d "{\"repo\":\"$handle\",\"collection\":\"app.bsky.feed.generator\",\"rkey\":\"cmd\"}" \ + # https://${host}/xrpc/com.atproto.repo.deleteRecord + + # 4. Put app record + echo "Creating app record..." + now=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + # Create JSON payload + # Note: feeding avatar_json directly into jq + payload=$(jq -n \ + --arg repo "$handle" \ + --arg collection "app.bsky.feed.generator" \ + --arg rkey "app" \ + --arg did "did:web:feed.${host}" \ + --arg type "app.bsky.feed.generator" \ + --arg created "$now" \ + --arg display "App Feed" \ + --arg desc "Automated App Feed" \ + --argjson avatar "$avatar_json" \ + '{ + repo: $repo, + collection: $collection, + rkey: $rkey, + record: { + did: $did, + "$type": $type, + createdAt: $created, + displayName: $display, + description: $desc, + avatar: $avatar + } + }') +curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" \ + -d @- \ + https://${host}/xrpc/com.atproto.repo.putRecord +} + at-repos-env case "$1" in pull)