ai/at
ai/at
1
0
Go to file
2024-10-22 01:59:55 +09:00
configs/postgres/init up 2024-10-22 01:59:55 +09:00
envs up 2024-10-22 01:59:55 +09:00
icons up 2024-10-22 01:59:55 +09:00
repos up 2024-10-22 01:59:55 +09:00
build.sh up 2024-10-22 01:59:55 +09:00
compose.yaml up 2024-10-22 01:59:55 +09:00
README.md up 2024-10-22 01:59:55 +09:00

atproto(at protocol)

  • @
  • [at]mosphere
  • at://domain

account

@ai.syu.is

$ curl -sL syu.is/xrpc/_health
{"version":"0.4.65"}

# latest
# https://github.com/bluesky-social/atproto/blob/main/packages/pds/package.json
$ curl -sL https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/pds/package.json |jq -r .version
$ curl -sL "syu.is/xrpc/com.atproto.repo.describeRepo?repo=ai.syu.is" |jq -r .did
did:plc:6qyecktefllvenje24fcxnie

$ curl -sL "syu.is/xrpc/com.atproto.repo.listRecords?repo=ai.syu.is&collection=app.bsky.feed.post&reverse=true&limit=1" 
{"records":[{"uri":"at://did:plc:6qyecktefllvenje24fcxnie/app.bsky.feed.post/3l6s2riuouk2j","cid":"bafyreibjohl7va4upkibw5twaxdd4jg3l6rmfatu4dpjjfd5xkb2ijtlx4","value":{"text":"hello","$type":"app.bsky.feed.post","langs":["ja"],"createdAt":"2024-10-18T13:21:39.809Z"}}],"cursor":"3l6s2riuouk2j"}

feed

at://did:plc:6qyecktefllvenje24fcxnie/app.bsky.feed.generator/cmd

self-host

currently, bsky and bsync require patches to function properly. additionally, social-app is not displaying avatars. for components that are not working, it's recommended to use itaru2622/bluesky-selfhost-env. this repository provides an environment for self-hosting bluesky.

  • bsky = appview
  • ozone = mod
name service patch
pds https://github.com/bluesky-social/atproto/blob/main/services/pds/Dockerfile
bsky https://github.com/bluesky-social/atproto/blob/main/services/bsky/Dockerfile itaru2622/bluesky-atproto-bsky
bsync https://github.com/bluesky-social/atproto/blob/main/services/bsync/Dockerfile
ozone https://github.com/bluesky-social/atproto/blob/main/services/ozone/Dockerfile
plc https://github.com/did-method-plc/did-method-plc/tree/main/packages/server
bgs https://github.com/bluesky-social/indigo/tree/main/cmd/bigsky
feed https://github.com/bluesky-social/feed-generator
web https://github.com/bluesky-social/social-app bluesky-selfhost-env
# BSKY_IMG_URI_ENDPOINT, BSKY_BLOB_CACHE_LOC
# avatar link example
1. https://appview.${host}/img/avatar/plain/${did}/${cid}@jpeg
2. https://${host}/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${cid}

docker compose will not be published unless you write ports. it is only valid internally. add ports only for what you want to publish.

api

# create account
url=https://${pds}/xrpc/com.atproto.server.createAccount
json="{\"email\": \"$email\", \"handle\": \"$handle\", \"password\": \"$password\"}"
curl -X POST -H "Content-Type: application/json" -d $json -sL $url 

change src/pds/handle to use a name of 3 characters or less. also, you cannot create an account with a name of 3 characters or less from social-app (web client). please create it from api.

# invite code
admin_password=xxx
url=https://$host/xrpc/com.atproto.server.createInviteCode
json="{\"useCount\":1}"
curl -X POST -u admin:${admin_password} -H "Content-Type: application/json" -d "$json" -sL $url

oauth

# https://github.com/bluesky-social/cookbook/tree/main/python-oauth-web-app
$ cd ./repos/cookbook/python-oauth-web-app
$ rye sync
$ rye run python3 -c 'import secrets; print(secrets.token_hex())'|xargs echo FLASK_SECRET_KEY|tr -d ' ' >> .env
$ rye run python3 generate_jwk.py |xargs echo FLASK_CLIENT_SECRET_JWK|tr -d ' ' >> .env
$ cat .env
$ rye run flask run

please access 127.0.0.1:5000. it may not work if you use localhost.

also, oauth doesn't work on localhost. use ngrok, tailscale.

$ ngrok http http://localhost:5000