# atproto https://github.com/bluesky-social/atproto - @ - [at]mosphere - at://proto - at protocol ## account [@ai.syu.is](https://web.syu.is/profile/ai.syu.is) - https://at.syu.is/at/yui.syui.ai - https://plc.syu.is/did:plc:6qyecktefllvenje24fcxnie - https://plc.directory/did:plc:ytvoptig4ddshmwdsjmhtcym ```sh $ 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 ``` ```sh $ 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 - https://api.bsky.app/xrpc/app.bsky.feed.getFeed?feed=at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.generator/cmd - https://feed.syu.is/xrpc/app.bsky.feed.getFeedSkeleton?feed=at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.generator/cmd - https://desc.syu.is/xrpc/app.bsky.feed.getFeedSkeleton?feed=at://did:plc:6qyecktefllvenje24fcxnie/app.bsky.feed.generator/cmd ## link - https://github.com/bluesky-social/atproto - https://github.com/itaru2622/bluesky-selfhost-env - https://github.com/bluesky-social/atproto/discussions/2026 ## 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](https://github.com/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](https://hub.docker.com/r/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](https://github.com/itaru2622/bluesky-selfhost-env/blob/master/patching/160-social-app-disable-hackModifyThumbnailPath.diff)| ```sh # 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 ```sh # 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. - [/atproto/packages/pds/src/handle/index.ts](https://github.com/bluesky-social/atproto/blame/d4d5a6edba972c0e9976289bde8bc0b42ff547ca/packages/pds/src/handle/index.ts#L86-L88) ```sh # 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 ```sh # 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](https://ngrok.com/), [tailscale](https://tailscale.com/), [cloudflare](https://github.com/cloudflare/cloudflared). ```sh $ ngrok http http://localhost:5000 ``` ```sh $ cloudflared tunnel --url http://localhost:5000 ```