diff --git a/social-app.-.md b/social-app.-.md index 96ba357..98a4591 100644 --- a/social-app.-.md +++ b/social-app.-.md @@ -5,11 +5,12 @@ + ./lib/constants.ts:export const PUBLIC_BSKY_SERVICE = 'https://bsky.syu.is' ``` -## timelineのavatarが表示されない +## social-app(web)のtimelineではavatarが表示されない - https://github.com/bluesky-social/atproto/tree/main/services/bsky - https://github.com/bluesky-social/atproto/discussions/1990#discussioncomment-10983003 + 基本的にavatarは以下のようなurlを使用し、timelineは`avatar_thumbnail`を使用します。 ```sh @@ -19,6 +20,8 @@ 例えば、`BSKY_IMG_URI_ENDPOINT=https://cdn.bsky.app/img`を使用すると以下のようになります。 +> + ```sh https://cdn.bsky.app/img/avatar_thumbnail/plain/${did}/${rkey}@jpeg ``` @@ -43,7 +46,21 @@ function hackModifyThumbnailPath(uri: string, isEnabled: boolean): string { source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }} ``` -## profile +### cloudflareで解決する + +しかし、上記の方法はwebだけで有効な方法です。iosではまた違った解決が必要になります。 + +まずprofileを見てください。 + +```sh +host=`cat ~/.config/ai/token.json|jq -r ".didDoc.service.[].serviceEndpoint"` +token=`cat ~/.config/ai/token.json|jq -r .accessJwt` +did=`cat ~/.config/ai/token.json|jq -r .did` +req=/xrpc/app.bsky.actor.getProfile +url="${host}${req}?actor=$did" + +curl -sL -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url|jq . +``` ```json { @@ -75,3 +92,21 @@ source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }} + https://bsky.syu.is/img/avatar/plain/did:plc:vzsvtbtbnwn22xjqhcu3vd6y/bafkreibj33gomcziy3rxx7hdnqlnpgjk4rwo3i564ooooooodsakrk6o7e@jpeg - https://bsky.syu.is/img/avatar_thumbnail/plain/did:plc:vzsvtbtbnwn22xjqhcu3vd6y/bafkreibj33gomcziy3rxx7hdnqlnpgjk4rwo3i564ooooooodsakrk6o7e@jpeg ``` + +> BSKY_IMG_URI_ENDPOINT - (recommended) the base url for resized images, e.g. https://cdn.bsky.app/img. When not set, sets-up an image resizing service directly on the appview. +> +> BSKY_BLOB_CACHE_LOC - when BSKY_IMG_URI_ENDPOINT is not set, this determines where resized blobs are cached by the image resizing service. + +基本的に`BSKY_IMG_URI_ENDPOINT`をコメントして、`BSKY_BLOB_CACHE_LOC`を設定します。すると、volumeに設定した場所、例えば、`/data/bsky`以下にこのようなファイルが作られます。 + +```diff ++ did:plc:vzsvtbtbnwn22xjqhcu3vd6y::bafkreibj33gomcziy3rxx7hdnqlnpgjk4rwo3i564ooooooodsakrk6o7e::avatar ++ did:plc:vzsvtbtbnwn22xjqhcu3vd6y::bafkreibj33gomcziy3rxx7hdnqlnpgjk4rwo3i564ooooooodsakrk6o7e::avatar_thumbnail +``` +ファイルは作られているのですが、`avatar_thumbnail`にはなぜかアクセスできません。 + +そこで、cloudflareでurlの書き換えルールを設定します。これでiosから閲覧できるようになりました。 + +1. rule(ルール) -> urlの書き換え +2. req(リクエスト): `https://bsky.syu.is/img/avatar_thumbnail/*` +3. path(パス): `/img/avatar/*` --> `/img/avatar_thumbnail/*` \ No newline at end of file