feat: threads error

This commit is contained in:
Nevo David 2026-05-18 20:32:45 +07:00
parent 0b3328daeb
commit faeb89853b

View file

@ -45,6 +45,12 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
return { type: 'refresh-token', value: 'Threads access token expired' };
}
if (body.includes('The media could not be fetched from this URI')) {
return {
type: 'bad-body',
value: 'One of the media URLs is invalid or inaccessible, make sure it\'s being uploaded to Postiz first',
};
}
if (body.includes('text must be at most 500 characters')) {
return {
type: 'bad-body',
@ -189,8 +195,9 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
isCarouselItem = false,
replyToId?: string
): Promise<string> {
const mediaType =
hasExtension(media.path, 'mp4') ? 'video_url' : 'image_url';
const mediaType = hasExtension(media.path, 'mp4')
? 'video_url'
: 'image_url';
const mediaParams = new URLSearchParams({
...(mediaType === 'video_url' ? { video_url: media.path } : {}),
...(mediaType === 'image_url' ? { image_url: media.path } : {}),