From 4738b41b6f58d359df3dd39ad6ca142ec42c35e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schimmelpfennig?= Date: Wed, 17 Apr 2024 19:21:25 +0200 Subject: [PATCH] remove unfinished image support --- main.js | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/main.js b/main.js index 16a46f4..728dcb1 100644 --- a/main.js +++ b/main.js @@ -56,39 +56,8 @@ async function main() { }; } - async function postToBluesky(textParts, images) { - const blueSkyImages = [] - /*const blueSkyImages = await images.reduce(async (list, {url, alt}) => { - const {data: imageData} = await axios.get(url, { - responseType: 'arraybuffer', - }); - //const base64Data = Buffer.from(imageData, 'binary').toString('base64') - console.log('🐈', url) - - // new Uint8Array(imageData), {encoding: 'utf8'} - const {data} = await agent.uploadBlob(url); - - return [ - ...list, - { - alt, - image: data.blob, - } - ]; - }, []);*/ - - const rootMessageResponse = await agent.post({ - ...(await createBlueskyMessage(textParts[0])), - ...(blueSkyImages.length > 0 - ? { - embed: { - type: 'app.bsky.embed.images', - images: blueSkyImages, - } - } - : {} - ), - }); + async function postToBluesky(textParts) { + const rootMessageResponse = await agent.post(await createBlueskyMessage(textParts[0])); if (textParts.length === 1) return; @@ -159,12 +128,7 @@ async function main() { try { console.log('📧 posting to BlueSky', currentTimestampId) const textParts = splitText(removeHtmlTags(item.object.content), 300); - - const images = item.object.attachment - .filter(attachment => attachment.type === 'Document' && attachment.mediaType.startsWith('image/')) - .map(({name: alt, url}) => ({ alt, url })); - - postToBluesky(textParts, images); + postToBluesky(textParts); } catch (error) { console.error('🔥 can\'t post to Bluesky', currentTimestampId, error) }