From 7725c1ce71c6b7721359f70a64aacff2ac41aae0 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Sat, 12 Apr 2025 11:33:24 +0700 Subject: [PATCH] feat: fix instagram permission from impressions to views, fix md remover mess up the message --- .../src/components/launches/helpers/use.formatting.ts | 4 ---- .../src/integrations/social/instagram.provider.ts | 4 ++-- .../src/integrations/social/x.provider.ts | 10 ++-------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/apps/frontend/src/components/launches/helpers/use.formatting.ts b/apps/frontend/src/components/launches/helpers/use.formatting.ts index 8c2e71a1..f2c1a8ad 100644 --- a/apps/frontend/src/components/launches/helpers/use.formatting.ts +++ b/apps/frontend/src/components/launches/helpers/use.formatting.ts @@ -1,4 +1,3 @@ -import removeMd from 'remove-markdown'; import { useMemo } from 'react'; export const useFormatting = ( @@ -23,9 +22,6 @@ export const useFormatting = ( if (params.saveBreaklines) { newText = newText.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢'); } - if (params.removeMarkdown) { - newText = removeMd(newText); - } newText = newText.replace(/@\w{1,15}/g, function(match) { return `${match}`; }); diff --git a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts index c548a775..63d6af13 100644 --- a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts @@ -384,13 +384,13 @@ export class InstagramProvider const { data, ...all } = await ( await this.fetch( - `https://graph.facebook.com/v20.0/${id}/insights?metric=follower_count,impressions,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}` + `https://graph.facebook.com/v20.0/${id}/insights?metric=follower_count,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}` ) ).json(); const { data: data2, ...all2 } = await ( await this.fetch( - `https://graph.facebook.com/v20.0/${id}/insights?metric_type=total_value&metric=likes,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}` + `https://graph.facebook.com/v20.0/${id}/insights?metric_type=total_value&metric=likes,views,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}` ) ).json(); const analytics = []; diff --git a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts index 0f9ce41c..822943a4 100644 --- a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts @@ -145,10 +145,7 @@ export class XProvider extends SocialAbstract implements SocialProvider { await timer(2000); await client.v2.tweet({ - text: removeMd(fields.post.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢')).replace( - '𝔫𝔢𝔴𝔩𝔦𝔫𝔢', - '\n' - ), + text: fields.post, reply: { in_reply_to_tweet_id: id }, }); return true; @@ -297,10 +294,7 @@ export class XProvider extends SocialAbstract implements SocialProvider { // @ts-ignore const { data }: { data: { id: string } } = await client.v2.tweet({ - text: removeMd(post.message.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢')).replace( - '𝔫𝔢𝔴𝔩𝔦𝔫𝔢', - '\n' - ), + text: post.message, ...(media_ids.length ? { media: { media_ids } } : {}), ...(ids.length ? { reply: { in_reply_to_tweet_id: ids[ids.length - 1].postId } }