π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: sync stars anyway
Nevo Davida99b6c09df1d
diff --git a/apps/frontend/src/components/launches/helpers/use.formatting.ts b/apps/frontend/src/components/launches/helpers/use.formatting.tsindex 5f2cc5537..549d547d5 100644--- a/apps/frontend/src/components/launches/helpers/use.formatting.ts+++ b/apps/frontend/src/components/launches/helpers/use.formatting.ts@@ -11,16 +11,20 @@ export const useFormatting = (removeMarkdown?: boolean;saveBreaklines?: boolean;specialFunc?: (text: string) => string;+ beforeSpecialFunc?: (text: string) => string;}) => {return useMemo(() => {return text.map((value) => {let newText = value.content;+ if (params.beforeSpecialFunc) {+ newText = params.beforeSpecialFunc(newText);+ }if (params.saveBreaklines) {newText = newText.replace('\n', 'π«π’π΄π©π¦π«π’');}if (params.removeMarkdown) {- newText = removeMd(value.content);+ newText = removeMd(newText);}if (params.saveBreaklines) {newText = newText.replace('π«π’π΄π©π¦π«π’', '\n');diff --git a/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx b/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsxindex cd40533f0..a1e9c0793 100644--- a/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx+++ b/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx@@ -3,6 +3,7 @@ import { withProvider } from '@gitroom/frontend/components/launches/providers/hiimport { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration';import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting';import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory';+import {afterLinkedinCompanyPreventRemove, linkedinCompanyPreventRemove} from "@gitroom/helpers/utils/linkedin.company.prevent.remove";const LinkedinPreview: FC = (props) => {const { value: topValue, integration } = useIntegration();@@ -10,8 +11,11 @@ const LinkedinPreview: FC = (props) => {const newValues = useFormatting(topValue, {removeMarkdown: true,saveBreaklines: true,+ beforeSpecialFunc: (text: string) => {+ return linkedinCompanyPreventRemove(text);+ },specialFunc: (text: string) => {- return text.slice(0, 280);+ return afterLinkedinCompanyPreventRemove(text.slice(0, 280));},});@@ -39,9 +43,7 @@ const LinkedinPreview: FC = (props) => {</div></div><div>- <pre className="font-['helvetica'] text-[14px] font-[400] text-wrap">- {firstPost?.text}- </pre>+ <pre className="font-['helvetica'] text-[14px] font-[400] text-wrap" dangerouslySetInnerHTML={{__html: firstPost?.text}} />{!!firstPost?.images?.length && (<div className="-ml-[16px] -mr-[40px] flex-1 h-[555px] flex overflow-hidden mt-[12px] gap-[2px]">diff --git a/apps/workers/src/app/stars.controller.ts b/apps/workers/src/app/stars.controller.tsindex 9deaa261d..d70c7d8a7 100644--- a/apps/workers/src/app/stars.controller.ts+++ b/apps/workers/src/app/stars.controller.ts@@ -43,16 +43,14 @@ export class StarsController {}// if there is stars in the database, sync the new stars- if (totalNewsStars > 0) {- return this._starsService.createStars(- data.login,- totalNewsStars,- totalStars,- totalNewsForks,- totalForks,- new Date()- );- }+ return this._starsService.createStars(+ data.login,+ totalNewsStars,+ totalStars,+ totalNewsForks,+ totalForks,+ new Date()+ );}@EventPattern('sync_all_stars', Transport.REDIS, { concurrency: 1 })diff --git a/libraries/helpers/src/utils/linkedin.company.prevent.remove.ts b/libraries/helpers/src/utils/linkedin.company.prevent.remove.tsnew file mode 100644index 000000000..55ac62aeb--- /dev/null+++ b/libraries/helpers/src/utils/linkedin.company.prevent.remove.ts@@ -0,0 +1,10 @@+export const linkedinCompanyPreventRemove = (text: string) => {+ const regex = /@\[(.*?)]\(urn:li:organization:(\d+)\)/g;++ return text.replace(regex, `[bold]@$1[/bold]`);+}++export const afterLinkedinCompanyPreventRemove = (text: string) => {+ const regex = /\[bold]@([^[]+)\[\/bold]/g;+ return text.replace(regex, "<strong>@$1</strong>");+}\ No newline at end of filediff --git a/libraries/nestjs-libraries/src/database/prisma/stars/stars.repository.ts b/libraries/nestjs-libraries/src/database/prisma/stars/stars.repository.tsindex 99f54732b..305beac80 100644--- a/libraries/nestjs-libraries/src/database/prisma/stars/stars.repository.ts+++ b/libraries/nestjs-libraries/src/database/prisma/stars/stars.repository.ts@@ -71,7 +71,7 @@ export class StarsRepository {}async getStarsByLogin(login: string) {- return await this._stars.model.star.findMany({+ return this._stars.model.star.findMany({where: {login,},diff --git a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.tsindex a3a939a29..e43179bc5 100644--- a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts@@ -8,7 +8,7 @@ import { makeId } from '@gitroom/nestjs-libraries/services/make.is';import sharp from 'sharp';import { lookup } from 'mime-types';import { readOrFetch } from '@gitroom/helpers/utils/read.or.fetch';-import removeMd from "remove-markdown";+import removeMd from 'remove-markdown';export class LinkedinProvider implements SocialProvider {identifier = 'linkedin';@@ -203,7 +203,9 @@ export class LinkedinProvider implements SocialProvider {},body: JSON.stringify({author: `urn:li:person:${id}`,- commentary: removeMd(firstPost.message.replace('\n', 'π«π’π΄π©π¦π«π’')).replace('π«π’π΄π©π¦π«π’', '\n'),+ commentary: removeMd(+ firstPost.message.replace('\n', 'π«π’π΄π©π¦π«π’')+ ).replace('π«π’π΄π©π¦π«π’', '\n'),visibility: 'PUBLIC',distribution: {feedDistribution: 'MAIN_FEED',@@ -261,7 +263,10 @@ export class LinkedinProvider implements SocialProvider {actor: `urn:li:person:${id}`,object: topPostId,message: {- text: removeMd(post.message.replace('\n', 'π«π’π΄π©π¦π«π’')).replace('π«π’π΄π©π¦π«π’', '\n'),+ text: removeMd(post.message.replace('\n', 'π«π’π΄π©π¦π«π’')).replace(+ 'π«π’π΄π©π¦π«π’',+ '\n'+ ),},}),}