π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: long upload should not be in a concurrenct
Nevo David5e5ca78e9aff
diff --git a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.tsindex d4731735b..da870fd17 100644--- a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts@@ -254,20 +254,26 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {const etags = [];for (let i = 0; i < picture.length; i += 1024 * 1024 * 2) {- const upload = await this.fetch(sendUrlRequest, {- method: 'PUT',- headers: {- 'X-Restli-Protocol-Version': '2.0.0',- 'LinkedIn-Version': '202501',- Authorization: `Bearer ${accessToken}`,- ...(isVideo- ? { 'Content-Type': 'application/octet-stream' }- : isPdf- ? { 'Content-Type': 'application/pdf' }- : {}),+ const upload = await this.fetch(+ sendUrlRequest,+ {+ method: 'PUT',+ headers: {+ 'X-Restli-Protocol-Version': '2.0.0',+ 'LinkedIn-Version': '202501',+ Authorization: `Bearer ${accessToken}`,+ ...(isVideo+ ? { 'Content-Type': 'application/octet-stream' }+ : isPdf+ ? { 'Content-Type': 'application/pdf' }+ : {}),+ },+ body: picture.slice(i, i + 1024 * 1024 * 2),},- body: picture.slice(i, i + 1024 * 1024 * 2),- });+ 'linkedin',+ 0,+ true+ );etags.push(upload.headers.get('etag'));}@@ -737,7 +743,9 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {return elements.map((p: any) => ({id: String(p.id),label: p.localizedName,- image: p.logoV2?.['original~']?.elements?.[0]?.identifiers?.[0]?.identifier || '',+ image:+ p.logoV2?.['original~']?.elements?.[0]?.identifiers?.[0]?.identifier ||+ '',}));}diff --git a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts b/libraries/nestjs-libraries/src/integrations/social/x.provider.tsindex 14bff67a4..1467352e9 100644--- a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts@@ -317,22 +317,24 @@ export class XProvider extends SocialAbstract implements SocialProvider {postDetails.flatMap((p) =>p?.media?.flatMap(async (m) => {return {- id: await this.runInConcurrent(async () =>- client.v1.uploadMedia(- m.path.indexOf('mp4') > -1- ? Buffer.from(await readOrFetch(m.path))- : await sharp(await readOrFetch(m.path), {- animated: lookup(m.path) === 'image/gif',- })- .resize({- width: 1000,+ id: await this.runInConcurrent(+ async () =>+ client.v1.uploadMedia(+ m.path.indexOf('mp4') > -1+ ? Buffer.from(await readOrFetch(m.path))+ : await sharp(await readOrFetch(m.path), {+ animated: lookup(m.path) === 'image/gif',})- .gif()- .toBuffer(),- {- mimeType: lookup(m.path) || '',- }- )+ .resize({+ width: 1000,+ })+ .gif()+ .toBuffer(),+ {+ mimeType: lookup(m.path) || '',+ }+ ),+ true),postId: p.id,};