Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bluesky のフィードを作ろう / 20250620-niigata-5min-tech

Bluesky のフィードを作ろう / 20250620-niigata-5min-tech

2025/06/20 Niigata5分Tech #20 で話した資料です

Avatar for girigiribauer

girigiribauer

June 20, 2025
Tweet

More Decks by girigiribauer

Other Decks in Programming

Transcript

  1. ϑΟʔυʹؔ͢Δެࣜ৘ใ w ։ൃऀ͸ެࣜυΩϡϝϯτΛݟΑ͏ w IUUQTEPDTCTLZBQQEPDTTUBSUFSUFNQMBUFTDVTUPNGFFET w ελʔλʔΩοτ͕Ұ൪Θ͔Γ΍͍͢ w IUUQTHJUIVCDPNCMVFTLZTPDJBMGFFEHFOFSBUPS w

    ͱ͸͍͑΋ͬͱ࡟͗མͱͤΔͷͰɺࢀߟʹͭͭࣗ͠લͰ࡞Δ w ඞཁʹԠͯ͡"51SPUPDPMʢΞοτϓϩτίϧʣΛݟΔ w IUUQTHJUIVCDPNCMVFTLZTPDJBMBUQSPUP w ྫϨίʔυΛ௥Ճ͢Δ"1*Ͱ΋ɺʮͲ͜ʹʯʮԿΛʯ͕ͬͪ͜ʹॻ͍ͯ ͋Δʢਖ਼௚ͪΐͬͱΘ͔ΓͮΒ͍ʣ 6
  2. ద੾ͳ+40/Λฦ͢ΤϯυϙΠϯτΛؚΉ8FCαʔϏεΛ༻ҙ͢Δ  10 const app = new Hono(); app.get("/.well-known/did.json", (c)

    => { return c.json({ "@context": ["https://www.w3.org/ns/did/v1"], id: "did:web:feeds.bsky.girigiribauer.com", service: [ { id: "#bsky_fg", type: "BskyFeedGenerator", serviceEndpoint: "https://feeds.bsky.girigiribauer.com", }, ], }); });
  3. 12

  4. ద੾ͳ+40/Λฦ͢ΤϯυϙΠϯτΛؚΉ8FCαʔϏεΛ༻ҙ͢Δ  13 const app = new Hono(); app.get("/xrpc/app.bsky.feed.getFeedSkeleton", async

    (c) => { return c.json({ feed: [ { post: "at://did:plc:tsvcmd72oxp47wtixs4qllyi/app.bsky.feed.post/ 3ldcooerekc2y", }, ], }) });
  5. खݩͰ"1*Λୟ͍ͯϑΟʔυΛొ࿥͢Δ  15 const agent = new AtpAgent({ service: "https://bsky.social"

    }); await agent.login({ identi fi er: handle, password }); // தུ const image = await fs.readFile(path); const blobResponse = await agent.com.atproto.repo.uploadBlob(image, { encoding: "image/png", }); // தུ const result = await agent.com.atproto.repo.putRecord({ repo: agent.session?.did ?? "", collection: "app.bsky.feed.generator", rkey: "helloworld", record: { did: "did:web:feeds.bsky.girigiribauer.com", displayName: "Helloworld feed", description: "Hello! Hello!", avatar, // BlobRef createdAt: new Date().toISOString(), }, });