ReviewOS

also looking at this

stacks/postline

Queued posts carry title, link card, and image through to publish

#13
Merged glennmichael123 wants to merge feat/queue-content into main
8 files +158 -11
app/Actions/Postline/CrosspostPublishAction.tsmodified+4-8
Changes to app/Actions/Postline/CrosspostPublishAction.ts
@@ -3,6 +3,7 @@ import type { RequestInstance } from '@stacksjs/types'
33import { Action } from '@stacksjs/actions'
44import { response } from '@stacksjs/router'
55import { crosspost, crosspostProviders } from '../../Services/Social/CrosspostService'
6import { readUploadedImage } from '../../Support/Social/uploads'
67
78export default new Action({
89 name: 'Postline Crosspost Publish',
@@ -34,14 +35,9 @@ export default new Action({
3435 const imageAlt = String(request.get('image_alt') || '').trim()
3536
3637 const media: NonNullable<Parameters<typeof crosspost.publish>[2]>['media'] = []
37 const uploaded = request.file?.('image')
38 if (uploaded?.buffer && uploaded.buffer.byteLength > 0) {
39 media.push({
40 bytes: new Uint8Array(uploaded.buffer),
41 mimeType: uploaded.mimetype || 'image/jpeg',
42 altText: imageAlt || undefined,
43 })
44 }
38 const uploadedImage = await readUploadedImage(request.file?.('image'))
39 if (uploadedImage)
40 media.push({ ...uploadedImage, altText: imageAlt || undefined })
4541 if (imageUrl)
4642 media.push({ url: imageUrl, altText: imageAlt || undefined })
4743