From 0c74bb42500c6e86b9e66cc39c1ca98fdf7a4082 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Wed, 26 Nov 2025 15:02:33 +0700 Subject: [PATCH] feat: fix posting for lemmy --- .../src/integrations/social/lemmy.provider.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 } : {}),