diff --git a/libraries/nestjs-libraries/src/integrations/social/lemmy.provider.ts b/libraries/nestjs-libraries/src/integrations/social/lemmy.provider.ts index da71b53a..6234eb0f 100644 --- a/libraries/nestjs-libraries/src/integrations/social/lemmy.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/lemmy.provider.ts @@ -149,13 +149,30 @@ export class LemmyProvider extends SocialAbstract implements SocialProvider { const valueArray: PostResponse[] = []; for (const lemmy of firstPost.settings.subreddit) { + console.log({ + community_id: +lemmy.value.id, + name: lemmy.value.title, + body: firstPost.message, + ...(lemmy.value.url ? { url: lemmy.value.url } : {}), + ...(firstPost.media?.length + ? { custom_thumbnail: firstPost.media[0].path } + : {}), + nsfw: false, + }); const { post_view, ...all } = await ( await fetch(body.service + '/api/v3/post', { body: JSON.stringify({ community_id: +lemmy.value.id, name: lemmy.value.title, body: firstPost.message, - ...(lemmy.value.url ? { url: lemmy.value.url } : {}), + ...(lemmy.value.url + ? { + url: + lemmy.value.url.indexOf('http') === -1 + ? `https://${lemmy.value.url}` + : lemmy.value.url, + } + : {}), ...(firstPost.media?.length ? { custom_thumbnail: firstPost.media[0].path } : {}),