Skip to content

Commit 54b2b95

Browse files
committed
feat: connect accounts with not picture
1 parent 8a1e45a commit 54b2b95

23 files changed

+32
-40
lines changed

libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
213213
accessToken: accessJwt,
214214
id: did,
215215
name: profile.data.displayName!,
216-
picture: profile.data.avatar!,
216+
picture: profile?.data?.avatar || '',
217217
username: profile.data.handle!,
218218
};
219219
} catch (e) {

libraries/nestjs-libraries/src/integrations/social/dev.to.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class DevToProvider extends SocialAbstract implements SocialProvider {
8181
accessToken: body.apiKey,
8282
id,
8383
name,
84-
picture: profile_image,
84+
picture: profile_image || '',
8585
username,
8686
};
8787
} catch (err) {

libraries/nestjs-libraries/src/integrations/social/discord.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export class DiscordProvider extends SocialAbstract implements SocialProvider {
242242
.filter((role: any) =>
243243
role.name.toLowerCase().includes(data.query.toLowerCase())
244244
)
245-
.filter((f) => f.name !== '@everyone' && f.name !== '@here');
245+
.filter((f: any) => f.name !== '@everyone' && f.name !== '@here');
246246

247247
const list = await (
248248
await fetch(

libraries/nestjs-libraries/src/integrations/social/dribbble.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class DribbbleProvider extends SocialAbstract implements SocialProvider {
5454
accessToken: access_token,
5555
refreshToken: refreshToken,
5656
expiresIn: expires_in,
57-
picture: profile_image,
57+
picture: profile_image || '',
5858
username,
5959
};
6060
}

libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
236236
const {
237237
id,
238238
name,
239-
picture: {
240-
data: { url },
241-
},
239+
picture
242240
} = await (
243241
await fetch(
244242
`https://graph.facebook.com/v20.0/me?fields=id,name,picture&access_token=${access_token}`
@@ -251,7 +249,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
251249
accessToken: access_token,
252250
refreshToken: access_token,
253251
expiresIn: dayjs().add(59, 'days').unix() - dayjs().unix(),
254-
picture: url,
252+
picture: picture?.data?.url || '',
255253
username: '',
256254
};
257255
}

libraries/nestjs-libraries/src/integrations/social/farcaster.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class FarcasterProvider
6161
accessToken: data.signer_uuid,
6262
refreshToken: '',
6363
expiresIn: dayjs().add(200, 'year').unix() - dayjs().unix(),
64-
picture: data.pfp_url,
64+
picture: data?.pfp_url || '',
6565
username: data.username,
6666
};
6767
}

libraries/nestjs-libraries/src/integrations/social/hashnode.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class HashnodeProvider extends SocialAbstract implements SocialProvider {
9191
accessToken: body.apiKey,
9292
id,
9393
name,
94-
picture: profilePicture,
94+
picture: profilePicture || '',
9595
username,
9696
};
9797
} catch (err) {

libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,7 @@ export class InstagramProvider
364364
const {
365365
id,
366366
name,
367-
picture: {
368-
data: { url },
369-
},
367+
picture
370368
} = await (
371369
await fetch(
372370
`https://graph.facebook.com/v20.0/me?fields=id,name,picture&access_token=${access_token}`
@@ -379,7 +377,7 @@ export class InstagramProvider
379377
accessToken: access_token,
380378
refreshToken: access_token,
381379
expiresIn: dayjs().add(59, 'days').unix() - dayjs().unix(),
382-
picture: url,
380+
picture: picture?.data?.url || '',
383381
username: '',
384382
};
385383
}

libraries/nestjs-libraries/src/integrations/social/instagram.standalone.provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class InstagramStandaloneProvider
4141
)
4242
).json();
4343

44-
const { user_id, name, username, profile_picture_url } = await (
44+
const { user_id, name, username, profile_picture_url = '' } = await (
4545
await fetch(
4646
`https://graph.instagram.com/v21.0/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
4747
)
@@ -53,7 +53,7 @@ export class InstagramStandaloneProvider
5353
accessToken: access_token,
5454
refreshToken: access_token,
5555
expiresIn: dayjs().add(59, 'days').unix() - dayjs().unix(),
56-
picture: profile_picture_url,
56+
picture: profile_picture_url || '',
5757
username,
5858
};
5959
}

libraries/nestjs-libraries/src/integrations/social/lemmy.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class LemmyProvider extends SocialAbstract implements SocialProvider {
107107
user.person_view.person.display_name ||
108108
user.person_view.person.name ||
109109
'',
110-
picture: user.person_view.person.avatar || '',
110+
picture: user?.person_view?.person?.avatar || '',
111111
username: body.identifier || '',
112112
};
113113
} catch (e) {

0 commit comments

Comments
 (0)