draw things doodl.waow.tech
draw atproto
0

Configure Feed

Select the types of activity you want to include in your feed.

bot: upload the flattened image with its actual content-type (may be jpeg)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

+11 -8
+11 -8
bot/bot.js
··· 158 158 async function postDrawing(env, did, rkey, cid) { 159 159 const [author, bot] = await Promise.all([miniDoc(did), miniDoc(BOT_HANDLE)]); 160 160 161 - // post the white-backed PNG (the worker flattens the transparent drawing onto 162 - // white), not the raw blob — otherwise the transparency shows the dark 161 + // post the white-backed image (the worker flattens the transparent drawing 162 + // onto white), not the raw blob — otherwise the transparency shows the dark 163 163 // background in Bluesky's dark mode. fall back to the raw blob if /img fails. 164 - let imgRes = await fetch( 165 - `${APP}/img/${did}/${cid}?w=1024&bg=ffffff&fmt=png`, 166 - { headers: { accept: "image/png" } }, 167 - ); 168 - if (!imgRes.ok) { 164 + // upload with the ACTUAL returned content-type (the flattener may emit jpeg). 165 + let imgRes = await fetch(`${APP}/img/${did}/${cid}?w=1024&bg=ffffff&fmt=png`, { 166 + headers: { accept: "image/png" }, 167 + }); 168 + let mime = "image/png"; 169 + if (imgRes.ok) { 170 + mime = imgRes.headers.get("content-type") || "image/png"; 171 + } else { 169 172 imgRes = await fetch(`${author.pds}/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${cid}`); 170 173 } 171 174 if (!imgRes.ok) throw new Error(`image fetch ${imgRes.status}`); ··· 181 184 bot.pds, 182 185 "com.atproto.repo.uploadBlob", 183 186 bytes, 184 - "image/png", 187 + mime, 185 188 auth, 186 189 ); 187 190 const detail = `${APP}/l/${did}/${rkey}`;