feat: fix posting for lemmy
This commit is contained in:
parent
518d76e972
commit
0c74bb4250
|
|
@ -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 }
|
||||
: {}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue